Summary
After context compaction, session_search still excludes compression-ended parent sessions from results. The agent has lost access to the original messages (replaced by a compact summary), but can't search for them either — creating a memory black hole.
Root Cause
session_search_tool.py line 415 excludes all sessions in the current lineage:
if current_lineage_root and resolved_sid == current_lineage_root:
continue # skips ALL parent sessions, including compression-ended ones
This assumes all sessions in the lineage are still visible to the agent. After compaction, this assumption is wrong — the parent's messages have been replaced by a summary in the new child session's context.
Who this affects
Any long-running conversation that triggers context compaction (common in gateway mode with large sessions). After compaction, the agent cannot recall specific details from the first half of the conversation, even though they exist in the database.
Expected behavior
- Delegation parents: should still be excluded (the parent session IS the active conversation)
- Compression parents: should be searchable (the original content is gone from the agent's context window)
Related
#5447, #6256, #6507, #8803 (independent reports of the same issue)
PR #13501 (fix submitted)
Summary
After context compaction,
session_searchstill excludes compression-ended parent sessions from results. The agent has lost access to the original messages (replaced by a compact summary), but can't search for them either — creating a memory black hole.Root Cause
session_search_tool.pyline 415 excludes all sessions in the current lineage:This assumes all sessions in the lineage are still visible to the agent. After compaction, this assumption is wrong — the parent's messages have been replaced by a summary in the new child session's context.
Who this affects
Any long-running conversation that triggers context compaction (common in gateway mode with large sessions). After compaction, the agent cannot recall specific details from the first half of the conversation, even though they exist in the database.
Expected behavior
Related
#5447, #6256, #6507, #8803 (independent reports of the same issue)
PR #13501 (fix submitted)