fix: ignore tool-call items when collecting user senders#284
Open
rendigua2025-gif wants to merge 1 commit into
Open
fix: ignore tool-call items when collecting user senders#284rendigua2025-gif wants to merge 1 commit into
rendigua2025-gif wants to merge 1 commit into
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.
Summary
Fixes #276.
User-side extraction strategies assumed every item in
memcell.itemsexposes aroleattribute. Agent/tool-call trajectories can includeToolCallRequestitems, which do not exposerole, soextract_atomic_factsandextract_foresightcould crash before processing otherwise valid user messages.This PR adds a small shared helper for collecting user sender ids defensively, then uses it in both strategies.
Scope
role == "user".This does not add tool-call semantics to user-side extraction; it only prevents unrelated tool-call items from crashing the user memory pipeline.
Tests
tests/unit/test_memory/test_strategies/test_strategy_to_handler_contract.pytests/unit/test_memory/test_strategies/test_extract_atomic_facts.pytests/unit/test_memory/test_strategies/test_extract_foresight.pyNote: I verified locally on Windows with a test-process-only
fcntlstub because the current repository still imports POSIXfcntlduring test collection on Windows.