Skip to content

fix(tools): keep compressed session history searchable - #24111

Closed
R1son234 wants to merge 1 commit into
NousResearch:mainfrom
R1son234:fix/session-search-compression-recall
Closed

R1son234 wants to merge 1 commit into
NousResearch:mainfrom
R1son234:fix/session-search-compression-recall

Conversation

@R1son234

Copy link
Copy Markdown

What does this PR do?

Fixes session_search recall for conversations that have been split by context compression.

Previously, session_search resolved every parent_session_id chain to the root session and skipped the whole current lineage. That works for delegation child sessions, but it also filtered out older compressed session fragments. Those fragments may no longer be present in the live context, so the agent could fail to recall earlier turns from the same long-running conversation even though they were persisted and indexed.

This change keeps delegation-style child sessions folded into their logical parent, while treating compression continuations as searchable session fragments.

Related Issue

No issue filed.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Tests (adding or improving test coverage)

Changes Made

  • Updated tools/session_search_tool.py to detect compression continuation links using parent end_reason == "compression" plus the child/parent timestamps.
  • Kept non-compression child sessions resolved to their parent so delegation behavior remains unchanged.
  • Added a regression test in tests/tools/test_session_search.py that verifies a compressed parent fragment remains searchable from its continuation session.

How to Test

  1. Run scripts/run_tests.sh tests/tools/test_session_search.py
  2. Run .venv/bin/python scripts/check-windows-footguns.py tools/session_search_tool.py tests/tools/test_session_search.py

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 the targeted test suite with scripts/run_tests.sh tests/tools/test_session_search.py
  • I've added tests for my changes
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • Documentation update N/A
  • cli-config.yaml.example update N/A
  • CONTRIBUTING.md / AGENTS.md update N/A
  • I've considered cross-platform impact and ran the Windows footgun checker
  • Tool schema update N/A

Screenshots / Logs

scripts/run_tests.sh tests/tools/test_session_search.py
39 passed

.venv/bin/python scripts/check-windows-footguns.py tools/session_search_tool.py tests/tools/test_session_search.py
No Windows footguns found

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/memory Memory tool and memory providers P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels May 12, 2026
@alt-glitch

Copy link
Copy Markdown

Duplicate of #13841 (fix PR for #13840) — same root cause: session_search lineage exclusion blanket-skips compression-ended parent sessions. #13841 narrows the exclusion to delegation-only, same approach as this PR. See also #6256, #15370 (prior duplicates).

@R1son234

Copy link
Copy Markdown
Author

Thanks for checking. I compared this with #13841 and agree it covers the same root cause with broader test coverage. Closing this duplicate in favor of #13841.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists 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.

2 participants