Skip to content

fix(session-search): allow scrolling compacted lineage history - #72279

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:fix/session-search-compacted-scroll
Jul 26, 2026
Merged

fix(session-search): allow scrolling compacted lineage history#72279
teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:fix/session-search-compacted-scroll

Conversation

@helix4u

@helix4u helix4u commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

session_search discovery already returns compacted history from the current session lineage because those messages are no longer in the model's live context. The follow-up scroll call rejected the same result unconditionally, so the agent could find an older turn but could not load more context around it.

This makes the scroll guard inspect the anchor's owning session and storage state. It allows current-lineage scrolling only when the anchor is a compaction archive (active=0, compacted=1) or belongs to a legacy session that ended via compression. Active current/delegation content and rewound rows remain rejected.

Related Issue

Related support thread: https://discord.com/channels/1053877538025386074/1530818704831545549

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: reuse one message-state lookup for owner resolution and current-lineage visibility checks.
  • tools/session_search_tool.py: allow compacted anchors and compression-ended session history through scroll while preserving the guard for active and rewound content.
  • tests/tools/test_session_search.py: cover the discovery-to-scroll regression, legacy compression rotation, active delegation lineage exclusion, active current-session exclusion, and rewound-row exclusion.

How to Test

  1. Compact a session in place, discover one of its archived messages while that session is current, and pass the returned session_id and match_message_id back to scroll.
  2. Confirm scroll succeeds for that compacted anchor and for a compression-ended parent, while active current/delegation anchors and rewound anchors are still rejected.
  3. Run python scripts/run_tests_parallel.py -j 4 tests/tools/test_session_search.py -q.

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: Windows 11

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

Focused validation:

96 tests passed, 0 failed in tests/tools/test_session_search.py with 4 workers.

@helix4u
helix4u marked this pull request as ready for review July 26, 2026 22:39
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/memory Memory tool and memory providers area/sessions Session lifecycle, resume, persistence, history area/compression Context compression and continuation sessions P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 26, 2026
@teknium1
teknium1 merged commit b93fd07 into NousResearch:main Jul 26, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compression Context compression and continuation sessions area/sessions Session lifecycle, resume, persistence, history comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state 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.

3 participants