fix(session-search): allow scrolling compacted lineage history - #72279
Merged
teknium1 merged 1 commit intoJul 26, 2026
Merged
Conversation
helix4u
marked this pull request as ready for review
July 26, 2026 22:39
This was referenced Aug 9, 2026
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.
What does this PR do?
session_searchdiscovery already returns compacted history from the current session lineage because those messages are no longer in the model's live context. The follow-up scroll call rejected the same result unconditionally, so the agent could find an older turn but could not load more context around it.This makes the scroll guard inspect the anchor's owning session and storage state. It allows current-lineage scrolling only when the anchor is a compaction archive (
active=0, compacted=1) or belongs to a legacy session that ended via compression. Active current/delegation content and rewound rows remain rejected.Related Issue
Related support thread: https://discord.com/channels/1053877538025386074/1530818704831545549
Type of Change
Changes Made
tools/session_search_tool.py: reuse one message-state lookup for owner resolution and current-lineage visibility checks.tools/session_search_tool.py: allow compacted anchors and compression-ended session history through scroll while preserving the guard for active and rewound content.tests/tools/test_session_search.py: cover the discovery-to-scroll regression, legacy compression rotation, active delegation lineage exclusion, active current-session exclusion, and rewound-row exclusion.How to Test
session_idandmatch_message_idback to scroll.python scripts/run_tests_parallel.py -j 4 tests/tools/test_session_search.py -q.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Focused validation:
96 tests passed, 0 failedintests/tools/test_session_search.pywith 4 workers.