Skip to content

fix(tools): show compression-continuation sessions in session search results (#13840)#15370

Open
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/session-search-compression-visibility
Open

fix(tools): show compression-continuation sessions in session search results (#13840)#15370
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/session-search-compression-visibility

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

_list_recent_sessions() in session_search_tool.py blanket-skips all sessions with parent_session_id set (line 292: if s.get("parent_session_id"): continue). This correctly hides delegation child sessions, but also hides compression-continuation sessions — sessions created when context compression splits a long conversation into a parent (archived) and child (active continuation). Users who compress long conversations lose all access to the continuation via session search, creating a "memory black hole".

Related Issue

Fixes #13840

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tools/session_search_tool.py: Change the blanket parent_session_id filter to also check end_reason. Compression-continuation sessions (which have end_reason == "compression") are now visible, while delegation children remain hidden.

How to Test

  1. Run the targeted test:
    python -m pytest tests/tools/test_session_search_compression.py -v
  2. The 3 tests cover:
    • Compression-continuation sessions (parent + end_reason=compression) are visible
    • Delegation child sessions (parent, no compression reason) stay hidden
    • Root sessions without parent remain visible

Tested on macOS (Python 3.14).

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 (Darwin 24.6.0)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

python -m pytest tests/tools/test_session_search_compression.py -v
# 3 passed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/memory Memory tool and memory providers labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #13841 — Same fix for #13840: allow compression-continuation sessions in session search. Superseded by #13841.

@Tranquil-Flow Tranquil-Flow force-pushed the fix/session-search-compression-visibility branch from eb7406e to 0a7c14f Compare May 18, 2026 21:17
@Tranquil-Flow Tranquil-Flow force-pushed the fix/session-search-compression-visibility branch from 0a7c14f to a09cdd6 Compare May 25, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants