Repository navigation
fix(hermes): stop marking panes as waiting during automatic smart-approval checks - #51683
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
…roval checks Hermes' smart-approval guardian fires pre_approval_request with surface "smart" before its aux-LLM verdict, and post_approval_response only for approve/deny. Orca mapped these to waiting/working, so every guardian check flashed needs-input (and could stick on escalate). Ignore smart-surface events; escalations fire their own human-surface request, which still shows waiting. Fixes stablyai#51676 Co-authored-by: Neil <[email protected]>
13dcb53 to
4c3f58c
Compare
ELI5
Hermes can ask a built-in "guardian" AI whether a command is safe before running it. Orca treated that automatic check as if Hermes were asking you for permission, so the pane flashed "waiting for input" (and could send a notification) even though nobody needed to do anything. Now Orca ignores the guardian's own check and only shows "waiting" when a real person actually has to answer.
What Changed
pre_approval_requestwithsurface: "smart", which Orca mapped towaiting. Approve/deny then fired a smartpost_approval_response(mapped back toworking). On escalate Hermes sends no smart post, so if no human prompt followed (unattended or cron runs) the pane could stay atwaiting.normalizeHermesEvent(src/shared/agent-hook-listener/providers/hermes/hermes-events.ts) returnsnullfor events whosesurfaceis"smart", so they leave status, turn and tool state untouched. The pane staysworkingfrompre_tool_call. Human surfaces (cli,gateway,transport:*,mcp-elicitation/*,vault-payment, or no surface) still showwaiting.hermes-events.test.ts: smart approve gives null/null, and smart escalate (a smart request with no smart response) is followed by a cli request that goeswaitingand thenworking.Why
Upstream hermes-agent (origin/main
29bbd2d97b) setssurface: "smart"in only one place,tools/approval_smart.py:238(_smart_verdict). Every path that prompts a person uses its own surface. On escalate,_smart_gatereturns None and_human_decisionfires a new human-surfacepre_approval_request. A smart deny with an owner present fires a human override prompt the same way. Filtering on the smart surface therefore drops only the observer-only guardian events and keeps every real prompt. The plugin forwardssurfaceonly on approval events, so no other event is affected.Linked Issue
Fixes #51676
Visual Proof
N/A for screenshots: this changes how hook events map to pane status, and a live capture would need a Hermes smart-approval session. Here is the behavior proof from a round trip. I rendered the real managed plugin (
getPluginInitSource()), ran its_payload_for_eventin python3 on Hermes-shaped kwargs, and fed the output throughnormalizeHookPayload:Testing
The new test fails on main (
expected { state: 'waiting', ... } to be null) and passes with the fix.vitest run src/shared/agent-hook-listener: 16 files, 45 tests passed.oxlint, oxfmt --check, anti-slop oxlint, native-plugins oxlint, ast-grep and the changed-code quality gate are clean on the touched files.
Platforms: this is pure shared normalization, and the plugin payload is the same on macOS, Linux, Windows and SSH. I verified the logic with unit tests and the round trip on macOS.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The change adds one property comparison per Hermes hook event in the main-process hook listener, with no I/O, subprocesses, polling or renderer/fanout work, and it is O(1) at any number of panes. Micro-benchmark, old vs new: cli-surface events 1054-1090 vs 1038-1177 ns/event (noise). Smart-surface events 1037-1054 vs 259-268 ns/event, because they now return early.
Risk
Level: Low
The riskiest part: if a future Hermes reused
surface: "smart"for a prompt a person must answer, Orca would not show waiting for it. No upstream code does that today. Older Hermes versions emit no smart hooks, and payloads withoutsurfacebehave exactly as before. To back out, revert this commit.Review
Reviewed for correctness, upstream behavior (hermes-agent source), mixed-version compatibility and performance.
Agent skill upstream boundary
Notes
Original fix by @kervral in #51683. Their authorship is preserved on the commit.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)