Skip to content

fix(session_search): exclude current session lineage#2201

Closed
Gutslabs wants to merge 1 commit into
NousResearch:mainfrom
Gutslabs:fix/session-search-lineage-exclusion
Closed

fix(session_search): exclude current session lineage#2201
Gutslabs wants to merge 1 commit into
NousResearch:mainfrom
Gutslabs:fix/session-search-lineage-exclusion

Conversation

@Gutslabs

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes session_search() returning the active conversation as if it were a past session when the current session is part of a compression/delegation lineage.

Previously, search hits were resolved to their parent/root session, but the exclusion logic only checked the exact current_session_id. That meant if the active session was a child continuation, session_search() could still return its parent/root transcript as a "past" conversation.

This change resolves the current session to its lineage root first and excludes the entire active lineage from search results.

Type of Change

  • Bug fix
  • Tests

Changes Made

  • Resolve current_session_id to its lineage root before filtering search results
  • Exclude parent/root session hits for active child continuation sessions
  • Exclude child session hits when the current session is the lineage root
  • Added regression tests for both directions

How to Test

  1. Run source .venv/bin/activate
  2. Run pytest -q tests/tools/test_session_search.py
  3. Reproduce a session lineage where the current session is a child continuation of an earlier parent session
  4. Confirm session_search() does not return the parent/root session from the active conversation lineage

teknium1 pushed a commit that referenced this pull request Mar 20, 2026
Cherry-picked from PR #2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #2190. Cherry-picked cleanly onto current main with authorship preserved. Clean fix — resolving the current session to its lineage root before filtering is the right approach. Thanks!

@teknium1 teknium1 closed this Mar 20, 2026
teknium1 pushed a commit that referenced this pull request Mar 21, 2026
Cherry-picked from PR #2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Cherry-picked from PR NousResearch#2201 by @Gutslabs.

session_search resolved hits to parent/root sessions but only excluded
the exact current_session_id. If the active session was a child
continuation (compression/delegation), its parent could still appear
as a 'past' conversation result.

Fix: resolve current_session_id to its lineage root before filtering,
so the entire active lineage (parent and children) is excluded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants