Repository navigation
fix(agents): resume Hermes panes after a reboot or daemon loss - #31327
tomaszamoranoq wants to merge 3 commits into
Conversation
Orca's managed Hermes plugin already posts session_id on every hook, but extractAgentProviderSession dropped it for hermes, so the pane never stored a provider session and cold restore had nothing to resume. Capture the id, add hermes to RESUMABLE_TUI_AGENTS, map it to `hermes --resume <id>`, and gate remote hosts behind agent-session.hermes-resume.v1 like the other late agents.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
062837bc-02ca-40b1-8113-1eced22c0dbb
📒 Files selected for processing: 8
src/renderer/src/runtime/agent-resume-host-authority-capability.test.tssrc/renderer/src/runtime/agent-resume-host-authority-capability.tssrc/shared/agent-hook-listener-hermes-codex-droid.test.tssrc/shared/agent-resume-argv.tssrc/shared/agent-session-resume-runtime-capabilities.tssrc/shared/agent-session-resume.test.tssrc/shared/agent-session-resume.tssrc/shared/tui-agent-startup-hermes.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
A prompted Hermes launch splices agentArgs into its query command, so the recorded agentCommand lacked them and resume replayed the bare override. Record the full command like every other agent, and normalize the resumed command into TUI chat form so a --cli override or a stale --query never survives a restore.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3a73b9d4-2ad0-4767-86bf-c79f2de41d68
📒 Files selected for processing: 5
src/shared/hermes-startup-query.tssrc/shared/tui-agent-resume-startup.tssrc/shared/tui-agent-startup-hermes.spec.tssrc/shared/tui-agent-startup.spec.tssrc/shared/tui-agent-startup.ts
🚧 Files skipped from review as they are similar to previous changes: 1
- src/shared/tui-agent-startup-hermes.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Thanks for working on Hermes resume! This landed in #33514 (merged, with co-author credit to you), which records the Hermes session id from Orca's plugin hooks, gates remote resume on a new host capability, and keeps delegate children from replacing the pane's session. Closing in favor of it. |
…ession (#33514) Hermes panes resume their own conversation after an Orca restart: record the Hermes session id from Orca's Hermes plugin hooks and relaunch with `hermes --resume <id>` (remote hosts gated on agent-session.hermes-resume.v1). Delegate-child hooks no longer replace the pane's session id. Fixes #15808 Supersedes #31327, #15809, #12075 Co-authored-by: tomaszamoranoq <268064671+tomaszamoranoq@users.noreply.github.com> Co-authored-by: Yi Lok Enoch Lam <22125285+eloklam@users.noreply.github.com> Co-authored-by: GoodFarming <34622709+GoodFarming@users.noreply.github.com>
ELI5
When the Mac reboots, Orca brings back each Claude or Codex pane and reruns
claude --resume <id>inside it. Hermes panes come back as an empty shell. Hermes already sends Orca its session id on every hook. Orca discarded it, so it had nothing to resume. This PR keeps the id and resumes withhermes --resume <id>.What Changed
extractAgentProviderSession('hermes', …)now returns{ key: 'session_id', id }from the payload of Orca's managedorca-statusHermes plugin. Before, it returnednull, next toampandcommand-code.hermestoRESUMABLE_TUI_AGENTS.getAgentResumeArgv('hermes', …)returns['hermes', '--resume', id]. Cold restore appends this to the existing launch command, so the default becomeshermes --tui --resume <id>. User command overrides and the recorded launch config still apply.agent-session.hermes-resume.v1runtime capability and mapped it inagent-resume-host-authority-capability.ts. A newer client checks for it before asking an older remote host to resume a Hermes session. Without that check, the host would returninvalid_argumentfor the new enum member. This follows the same pattern as kiro, kimi and dsh.Before / after on a real machine. Shape of
agent-hooks/last-status.jsonentries in Orca 1.4.229, values elided:The plugin sends
session_idin every event (SELECTED_KEYSin the managedorca-status/__init__.py), so the id is lost on the Orca side.buildColdRestoreAgentResumeStartupreturns early whenproviderSessionis missing.The session id stays current. When Hermes compresses context it switches to a successor session id (
agent.session_id = child_session_id), and the nextpre_llm_callreports the new id. Orca therefore resumes the live conversation, not the pre-compression parent.Why
This is the gap tracked in #15808. Two earlier PRs proposed this: #15809 (@eloklam) and #12075 (@GoodFarming). Both have been inactive for weeks and no longer apply to
main. #12075 is marked conflicting, and both failgit apply --checkagainst currentmain. This PR is the minimal rebase of that approach onto currentmain. The one addition is the remote-host capability gate, whichmainnow requires for every agent added toRESUMABLE_TUI_AGENTS(an exhaustiveRecord, so typecheck fails without it). Happy to close this in favour of either earlier PR if the authors refresh them.Not in scope: Hermes named profiles (#19287). A session from
profiles/<name>/state.dbresumes correctly only if the pane's recorded launch config or command override still selects that profile. This is the same limitation as Session History resume today.Linked Issue
Fixes #15808
Visual Proof
N/A. There is no new UI: restored Hermes panes show the same session-restored banner as other resumable agents. The behavior change is the command a cold-restored pane runs, and unit tests cover it.
Testing
Automated, on macOS (arm64), Node 24:
session_id, which ignorestranscript_pathproviderSessionfor Hermespre_llm_callhermes --tui '--resume' '<id>'pnpm teston all 285 test files that reference resumable agents, provider sessions, runtime capabilities or Hermes: 280 passed, 3 skipped, 2 failed. The 2 failing files aresrc/main/runtime/rpc/methods/agent-launch-replay.test.tsandagent-launch-restart-replay.test.ts(11 tests). They fail the same way on unmodifiedmain(70b2197) and are unrelated to this change.pnpm tc: clean.pnpm run check:code-quality:changed: 0 new findings.oxfmt --check: clean.Manual: not done yet. I applied the equivalent change to the bundled JS of an installed Orca 1.4.235 on macOS, and I will report back here after a real reboot cycle. Linux, Windows and SSH were not tested manually. The change is in shared code paths those platforms already use for other agents.
AI Disclosure
Prepared with Claude (Anthropic) running inside Hermes Agent, which did the root-cause analysis, the patch and the tests.