Skip to content

[session_search] Compression-ended parent sessions excluded from search results — memory black hole #13840

@iamagenius00

Description

@iamagenius00

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/toolsTool registry, model_tools, toolsetstool/memoryMemory tool and memory providerstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions