fix(search): include compression parents in session_search results#6256
Open
MacroAnarchy wants to merge 1 commit into
Open
fix(search): include compression parents in session_search results#6256MacroAnarchy wants to merge 1 commit into
MacroAnarchy wants to merge 1 commit into
Conversation
After context compression, the parent session's full transcript is summarized away — the agent no longer has that content. Yet session_search excluded the entire lineage root, making hours of pre-compression conversation invisible to search. This was especially painful for long gateway sessions that compress multiple times: each compression split made more history unsearchable. Fix: only exclude the current session_id itself, not its compression parents. Dedup via _resolve_to_parent still groups child sessions correctly for summarization.
iamagenius00
added a commit
to iamagenius00/hermes-agent
that referenced
this pull request
Apr 21, 2026
…nt sessions Context compaction splits the active session: the parent is closed with end_reason='compression' and a new child becomes the active session. The parent's messages are summarized into a compact handoff, and the original messages are no longer in the agent's context window. Previously, session_search excluded the entire current session lineage, including compression-ended parents. This created a 'memory black hole' — the agent could not recall specific details from compacted portions of the conversation, even though those messages still exist in the database. The fix narrows the exclusion: only skip sessions in the current lineage whose content the agent still has access to. Compression-ended sessions are no longer excluded, since their original content is gone from context and should be recoverable via search. Closes NousResearch#5447, NousResearch#6256, NousResearch#6507, NousResearch#8803
Collaborator
Collaborator
|
Likely duplicate of #13841 — same fix: narrow lineage exclusion to allow compression-ended parents in session_search results. |
14 tasks
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.
Bug
After context compression (
/compress, hygiene auto-compression, or mid-run compression), the parent session's full transcript is summarized away — the agent no longer has that content in its context window. Yetsession_searchexcluded the entire lineage root, making hours of pre-compression conversation completely invisible to search.This was especially painful for long gateway sessions that compress multiple times: each compression split made progressively more history unsearchable.
Root Cause
_resolve_to_parent()walks UP the compression chain to find the root session. The code then excluded ALL sessions matching that root — including the compression parent whose content was already lost to summarization.Fix
Only exclude
raw_sid == current_session_id(the actual live session). Do not exclude compression parents — their content was compressed away and is no longer in the agent's context, so it SHOULD be searchable.Dedup via
_resolve_to_parentstill works correctly for grouping child sessions for summarization.Testing
Files Changed
tools/session_search_tool.py— 7 lines removed, 6 added (net -1 line)tests/tools/test_session_search.py— tests updated to match corrected behavior