feat(gateway): add /sessions search - #57595
Closed
GodsBoy wants to merge 1 commit into
Closed
Conversation
GodsBoy
force-pushed
the
feat/gateway-sessions-search
branch
5 times, most recently
from
July 3, 2026 10:09
c217f08 to
a6b2c00
Compare
GodsBoy
force-pushed
the
feat/gateway-sessions-search
branch
from
July 3, 2026 10:14
a6b2c00 to
34aaaea
Compare
teknium1
added a commit
that referenced
this pull request
Jul 3, 2026
Gateway users can now search resumable sessions from messaging surfaces: /sessions search <query> (alias: find) matches titles and session ids — including every title/id in a row's forward compression chain, so a compressed-away title still surfaces its live tip — plus a punctuation-normalized variant so 'an94' matches 'AN-94'. Implemented by generalizing the existing id_query chain-filter in SessionDB.list_sessions_rich into a combined SQL-level filter (search stays ORDER BY last-active + LIMIT at SQL level), threading a search_query through the shared query_session_listing helper, and teaching parse_session_listing_args to split off a search query. Search results pass through the existing _resume_row_visible guard unchanged: origin scoping, admin-only 'all', and the fail-closed legacy-row posture from the July 1 hardening are preserved exactly. Over-fetch (50) before the visibility cut so origin-invisible matches can't starve the page. Salvages the feature direction of PR #57595 by @GodsBoy with a minimal implementation that keeps the resume authorization surface untouched.
Contributor
|
Merged via #57595 |
This was referenced Jul 7, 2026
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
Gateway users can now search resumable sessions from messaging surfaces: /sessions search <query> (alias: find) matches titles and session ids — including every title/id in a row's forward compression chain, so a compressed-away title still surfaces its live tip — plus a punctuation-normalized variant so 'an94' matches 'AN-94'. Implemented by generalizing the existing id_query chain-filter in SessionDB.list_sessions_rich into a combined SQL-level filter (search stays ORDER BY last-active + LIMIT at SQL level), threading a search_query through the shared query_session_listing helper, and teaching parse_session_listing_args to split off a search query. Search results pass through the existing _resume_row_visible guard unchanged: origin scoping, admin-only 'all', and the fail-closed legacy-row posture from the July 1 hardening are preserved exactly. Over-fetch (50) before the visibility cut so origin-invisible matches can't starve the page. Salvages the feature direction of PR NousResearch#57595 by @GodsBoy with a minimal implementation that keeps the resume authorization surface untouched.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Gateway users can now search resumable sessions from messaging surfaces: /sessions search <query> (alias: find) matches titles and session ids — including every title/id in a row's forward compression chain, so a compressed-away title still surfaces its live tip — plus a punctuation-normalized variant so 'an94' matches 'AN-94'. Implemented by generalizing the existing id_query chain-filter in SessionDB.list_sessions_rich into a combined SQL-level filter (search stays ORDER BY last-active + LIMIT at SQL level), threading a search_query through the shared query_session_listing helper, and teaching parse_session_listing_args to split off a search query. Search results pass through the existing _resume_row_visible guard unchanged: origin scoping, admin-only 'all', and the fail-closed legacy-row posture from the July 1 hardening are preserved exactly. Over-fetch (50) before the visibility cut so origin-invisible matches can't starve the page. Salvages the feature direction of PR NousResearch#57595 by @GodsBoy with a minimal implementation that keeps the resume authorization surface untouched.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Gateway users can now search resumable sessions from messaging surfaces: /sessions search <query> (alias: find) matches titles and session ids — including every title/id in a row's forward compression chain, so a compressed-away title still surfaces its live tip — plus a punctuation-normalized variant so 'an94' matches 'AN-94'. Implemented by generalizing the existing id_query chain-filter in SessionDB.list_sessions_rich into a combined SQL-level filter (search stays ORDER BY last-active + LIMIT at SQL level), threading a search_query through the shared query_session_listing helper, and teaching parse_session_listing_args to split off a search query. Search results pass through the existing _resume_row_visible guard unchanged: origin scoping, admin-only 'all', and the fail-closed legacy-row posture from the July 1 hardening are preserved exactly. Over-fetch (50) before the visibility cut so origin-invisible matches can't starve the page. Salvages the feature direction of PR NousResearch#57595 by @GodsBoy with a minimal implementation that keeps the resume authorization surface untouched.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Gateway users can now search resumable sessions from messaging surfaces: /sessions search <query> (alias: find) matches titles and session ids — including every title/id in a row's forward compression chain, so a compressed-away title still surfaces its live tip — plus a punctuation-normalized variant so 'an94' matches 'AN-94'. Implemented by generalizing the existing id_query chain-filter in SessionDB.list_sessions_rich into a combined SQL-level filter (search stays ORDER BY last-active + LIMIT at SQL level), threading a search_query through the shared query_session_listing helper, and teaching parse_session_listing_args to split off a search query. Search results pass through the existing _resume_row_visible guard unchanged: origin scoping, admin-only 'all', and the fail-closed legacy-row posture from the July 1 hardening are preserved exactly. Over-fetch (50) before the visibility cut so origin-invisible matches can't starve the page. Salvages the feature direction of PR NousResearch#57595 by @GodsBoy with a minimal implementation that keeps the resume authorization surface untouched.
This was referenced Aug 8, 2026
Route session-metadata picker candidates through Unicode/CJK/trigram FTS
Skywind5487/hermes-agent#14
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Gateway users can now run
/sessions search <query>from messaging surfaces to find resumable sessions without leaving the chat. Ordinary search uses persisted gateway origin filters plus the existing caller-visible resume guard, so results stay scoped to the relevant chat, user, and session boundary instead of enumerating another user's sessions. Explicit admins can still use/sessions all search <query>to search the broader non-tool session set and see source labels.The search path is not limited to the short recent
/sessionsor/resumelist. It pages matching sessions from the session DB, returns numbered rows, and stores the latest numbered result list for that gateway chat. After a search,/resume <number>or/sessions <number>resumes that numbered result through the existing authorization and session-switch flow. Bare/resumestill lists recent titled sessions and refreshes the numbered picks for that chat.The gateway search also handles legacy rows found in real gateway history:
chat_id.user_id, while current events use a phone JID plus lid chat id.an94can matchAN-94.cod, can surface above weak title matches likeCodex.Related Issue
Related: #17193
Related: #49038
No separate feature-request issue was opened because no exact issue or PR exists for gateway
/sessions search <query>, and this PR carries the proposal plus implementation. The related links remain context only: #17193 is broader cross-session management, and #49038 is a Telegram inline picker. The duplicate pass also reviewed #47535; that PR changes dashboard/api/sessions/searchrole scope, not gateway slash-command session search.Type of Change
Changes Made
/sessionsargument parsing for list flags, resume targets, andsearchorfindqueries.SessionDB.list_sessions_rich, including compression-chain title/id matches so projected live continuations are searchable.an94matchingAN-94.chat_id, WhatsApp JID/lid owner changes, same-user threaded topic rows with blank chat/thread fields, and compressed continuation rows whose ancestry proves ownership./sessions search <query>with missing-query usage feedback, existing caller visibility filtering, existing admin cross-origin handling, and/sessions all search <query>support for explicit admins./resume <number>and/sessions <number>can resume a result from the latest/sessionslist or/sessions searchoutput.How to Test
python3 -m pytest tests/hermes_cli/test_session_listing.py tests/gateway/test_resume_command.py tests/test_hermes_state.py -q(380 passed)python3 -m ruff check gateway/slash_commands.py hermes_cli/session_listing.py hermes_state.py tests/gateway/test_resume_command.py tests/hermes_cli/test_session_listing.py tests/test_hermes_state.pygit diff --checkLive VPS verification on the PR commit:
/sessionsin WhatsApp DM lists named sessions and shows the search footer./sessions search wintonin WhatsApp DM returnsWinton Email Sheet Update #3as result 1, and/resume 1switches to that session./sessions search codin the Telegram topic returnsAN-94 Prestige Barrel Build #2as result 1, and/resume 1switches to that session./sessions search an94in the Telegram topic also returnsAN-94 Prestige Barrel Build #2as result 1, and/resume 1switches to that session.Duplicate checks run for this PR:
gh search issues --repo NousResearch/hermes-agent '"/sessions search"' --json number,title,state,url --limit 20gh search prs --repo NousResearch/hermes-agent '"/sessions search"' --json number,title,state,url --limit 20gh issue view 17193 --repo NousResearch/hermes-agent --json number,title,state,url,body,updatedAtgh pr view 49038 --repo NousResearch/hermes-agent --json number,title,state,url,body,updatedAt,filesgh pr view 47535 --repo NousResearch/hermes-agent --json number,title,state,url,body,filesNo exact duplicate gateway slash-command issue or PR was found.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass. Not run locally; targeted pytest, ruff, and diff whitespace checks passed.Documentation & Housekeeping
docs/, docstrings) - implementation plan added underdocs/plans/cli-config.yaml.exampleif I added/changed config keys - N/A, no config keys addedCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - N/A, no architecture/workflow changeFor New Skills
N/A
Screenshots / Logs
Screenshot.Video.2026-07-03_12-28-39.mp4