fix(gateway): resume numbered session search results - #60138
Conversation
a631d1b to
2983904
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the search/list and numeric-resume mismatch; current main still has that mismatch in gateway/slash_commands.py:3616-3629, so the fix direction is valid.
Problems
- In the PR head, bare
/resumereturns for an empty titled list atgateway/slash_commands.py:3605-3608before it reaches the new cache write at:3609. A previous/sessions searchmapping remains armed and is then used at:3629-3646, although the latest numbered-list command showed no choices. _latest_gateway_session_choicesis a plain unbounded dict atgateway/slash_commands.py:108-112. Main caps analogous long-lived session-source state atgateway/run.py:2975-2981and trims it at:10863-10868.
Suggested changes
- Clear the remembered entry before each empty-list return and add the bare-
/resumestale-selection regression case. - Bound remembered session-key entries with an LRU or existing lifecycle cleanup, with coverage for eviction.
Automated hermes-sweeper review.
Clear stale choices after empty resume lists and retain numbered mappings in a capped LRU cache.
Addressed in 8212691. Empty resume listings now disarm earlier search choices, and the mapping is a capped 512-entry LRU with eviction coverage. The focused resume suite passes: 58 passed. |
|
The implementation, test slices, e2e, lint, type, docs, JS/TS, supply-chain, and Docker checks all pass. The only failing gate is |
|
Current head merges cleanly with current |
What does this PR do?
Gateway session numbers now refer to the latest numbered session list shown in that same chat. After
/sessions search <query>returns old matching sessions,/resume <number>resumes the row the user picked instead of re-querying the unrelated default recent/resumelist.The remembered rows are scoped by gateway session key, bounded to the 10 displayed choices, and stored only after the existing visibility filtering. Final resume authorization is unchanged: the selected id still flows through continuation resolution, Matrix room checks, owner checks, and the existing switch path.
Related Issue
Fixes #60136
Related: #57685, #57595
Type of Change
Changes Made
gateway/slash_commands.py: remember the latest numbered gateway session list per session key and resolve numeric/resumeagainst it before falling back to the old bare/resumebehavior.hermes_cli/session_listing.py: clarify the gateway listing footer so numbers are documented as coming from the latest session list, not only from/resume.tests/gateway/test_resume_command.py: cover numbered resume from/sessions search, out-of-range search choices, stale no-result searches, and cross-chat isolation.How to Test
/sessions search <query>./resume <number>using a number from that search result.Local verification:
Manual validation:
/sessions search <query>followed by/resume <returned number>resumes the selected old session.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) or N/Acli-config.yaml.exampleif I added/changed config keys or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows or N/AScreenshots / Logs
Technical breakdown of the numbered session resume fix:
Sample of issue:
Manual Telegram validation above exercised the reported flow end to end.