fix(session-search): scope gateway recall to current chat - #62138
fix(session-search): scope gateway recall to current chat#62138ljy-2000 wants to merge 3 commits into
Conversation
Competing cluster for scoping |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Found potential issues:
- potential secret found
- conflict markers found
Reviewed by Hermes Agent
|
Followed up on the automated review summary in commit
Revalidated with:
|
|
Thanks for covering the normal sequential and direct agent tool-dispatch paths, plus the FTS and CJK retrieval variants. Problems
Suggested changes
Automated hermes-sweeper review. |
|
Addressed the The background-task Validation:
The deselected case is the branch's existing SQLite second-resolution |
|
Independent rebase check against current The intended scope contract is still useful, including the explicit global opt-out and the repaired |
What does this PR do?
Scopes
session_searchdiscovery and browse to the current gateway conversation by default, using the stablesession_keythat already encodes Hermes' DM, group, thread, profile, and per-user routing policy.scope=current_chat|global; gateway calls default tocurrent_chat, while CLI calls remain global.@sessionlinks and user-selected session IDs remain readable.Why
Gateway conversations already route live messages with
build_session_key(), butsession_searchreceived only the activesession_id. It could exclude the current lineage, yet every remaining session in the profile was eligible, so a query from one DM or thread could return matching history from another chat.Reusing the persisted session key keeps recall aligned with the existing routing policy without rebuilding platform/chat/thread/user rules in the tool.
Effect
The regression fixture contains two prior sessions matching the same query: one in the current chat and one in another chat.
scope=global: both prior hits remain available.Tests also cover same-base title collisions across chats, long-CJK trigram retrieval, short-CJK LIKE fallback, current-lineage exclusion, and explicit cross-chat session reads.
Validation
python -m pytest tests/test_hermes_state.py tests/tools/test_session_search.py tests/run_agent/test_token_persistence_non_cli.py tests/gateway/test_async_session_db.py -q -o addopts=— 420 passedruff checkon all changed Python files — passedscripts/check-windows-footguns.pyon all changed Python files — passedgit diff --check— passedFixes #10554