Skip to content

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

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

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 runtime: loop, agent_init, prompt builder, context-compression, responses endpoint 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
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused report and regression tests. This is an automated hermes-sweeper review: the browse-mode behavior this PR changes is already implemented on current main through the session-list projection path.

  • tools/session_search_tool.py:263 calls list_sessions_rich(..., order_by_last_active=True) for browse results.
  • hermes_state.py:3254 projects a compression-root entry to the active continuation tip, including its session id and activity metadata; delegation children remain excluded.
  • tests/test_hermes_state.py:3839 verifies that the compression tip is surfaced while the root, intermediate continuation, and delegation child are absent.
  • The PR's condition checks end_reason on the child, but legacy rotation marks the parent as compression (tests/run_agent/test_in_place_compaction.py:207).

The member discussion pointing to #13841 identified the same original report; current main now covers this PR's browse-result goal with a lineage-aware implementation.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main 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

3 participants