Memory update from review of PR #16#18
Open
arcanist[bot] wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory updates from PR #16
Add: Checking Optional fields on Pydantic models using hasattr
Type:
gotchaMemory:
When checking if a Pydantic BaseModel field is set/truthy, never use
hasattr()— all declared fields always have the attribute. Use an explicitis not Nonecheck (oris not None+ not-empty) instead. E.g.,decision.params if decision.params is not None else {}.Rationale:
Why this is a memory (not a convention update): This is a situational pattern that helps the agent in specific contexts, not a permanent rule for all future code.
Referenced files:
nons/core/agents/agent.pyAdd: Operators or transforms that cache results and process dataclass objects
Type:
gotchaMemory:
When modifying dataclass objects inside operator
transform()methods (or any caching pipeline), never mutate fields in-place — usedataclasses.replace()to create a new instance. In-place mutation changes the object's hash, corrupting cache keys and causing unbounded cache growth.Rationale:
Why this is a memory (not a convention update): This is a situational pattern that helps the agent in specific contexts, not a permanent rule for all future code.
Referenced files:
nons/operators/deterministic.pySessions:
9db00177-844e-4c98-8cbd-e0c7354f9f04Merge to apply. Close to discard.