Repository navigation
hermes: follow gateway and cron sessions and register /te command - #259
Open
Tejas Lamba (TejasLamba2006) wants to merge 2 commits into
Open
Tejas Lamba (TejasLamba2006) wants to merge 2 commits into
Tejas Lamba (TejasLamba2006) wants to merge 2 commits into
Conversation
Follow sessions started through the API server, messaging platforms and cron, taking a gateway session's directory from TERMINAL_CWD when its row has none. Register /te through register_command where Hermes offers it. Subagents stay unfollowed, since a session's fold already prices them.
Collaborator
|
Thanks for the PR! The overall approach looks good. A few concerns before merging:
Otherwise, the changes look reasonable! |
…ere, end sessions on reset A gateway session whose row records no cwd no longer takes the gateway's TERMINAL_CWD, which every chat shares. It takes its chat's routed terminal_cwd from gateway_routing, then the directory scoped to the running turn, and is retried at its next hook if it has neither. /te runs in the calling session's directory (session_id, session_key), passes --cwd and cwd, honors an explicit --cwd, and says so when it has no directory. on_session_reset ends the session a /new leaves. Tests cover two repositories through the real dispatcher with gateway and cron sessions, finalize, reset, stale recovery, and /te status.
Contributor
Author
|
Thanks for the review jackhaohuang! Addressed all three points in
|
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.
Addresses part of #232.
Extends
plugin/hermesto follow gateway (api_server,discord,telegram,slack,whatsapp,signal,matrix,mattermost,email,sms,webhook) andcronsessions, handleon_session_reset, and register/teviactx.register_command.Changes
os.getcwd()or process-wideTERMINAL_CWD(both belong to the gateway daemon and are shared across chats). Resolve each session's repository from itssessions.cwdrow instate.db; for gateway andcronsessions whose row has none, fall back to the chat'sterminal_cwdingateway_routing, then to the task-local directory Hermes binds to the running turn (ctx.session_cwd()/agent.runtime_cwd.scoped_session_cwd()). If none is bound yet, retry on the next hook rather than associating the session with the gateway's directory.cronruns as single-turn (oneshot) so they fold aton_session_end, and registeron_session_resetalongsideon_session_finalizeso/newends the session it leaves on surfaces that emit reset without finalize. Unfinalized gateway sessions still recover and fold on the nextSessionStartin that repository afterSTALE_S./teslash command: RegisterBridge.commandviactx.register_commanddeclaringsession_idandsession_keyso Hermes passes the calling session context, pass--cwd <dir>andcwd=<dir>to thetesubprocess, respect explicit--cwdflags, and fail closed with a clear message when a repo-scoped command has no session directory.TE_FOLD_SYNC=1, realstate.db) integration tests intests/test_hermes_plugin.pycovering concurrent multi-repository gateway andcronisolation, finalization/reset/stale recovery, and/te statusexecution from an unrelated process directory.