Skip to content

fix(hermes): stop marking panes as waiting during automatic smart-approval checks - #51683

Merged
nwparker merged 1 commit into
stablyai:mainfrom
kervral:kervral/hermes-smart-approval
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
kervral:kervral/hermes-smart-approval

Conversation

@kervral

@kervral kervral commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Before: in smart approval mode, every guardian check fired pre_approval_request with surface: "smart", which Orca mapped to waiting. Approve/deny then fired a smart post_approval_response (mapped back to working). On escalate Hermes sends no smart post, so if no human prompt followed (unattended or cron runs) the pane could stay at waiting.
  • After: normalizeHermesEvent (src/shared/agent-hook-listener/providers/hermes/hermes-events.ts) returns null for events whose surface is "smart", so they leave status, turn and tool state untouched. The pane stays working from pre_tool_call. Human surfaces (cli, gateway, transport:*, mcp-elicitation/*, vault-payment, or no surface) still show waiting.
  • New 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 goes waiting and then working.

Why

Upstream hermes-agent (origin/main 29bbd2d97b) sets surface: "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_gate returns None and _human_decision fires a new human-surface pre_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 forwards surface only 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_event in python3 on Hermes-shaped kwargs, and fed the output through normalizeHookPayload:

main:   smartApprove:     pre_tool_call=working | pre_approval_request(smart)=waiting | post_approval_response(smart)=working | ...
branch: smartApprove:     pre_tool_call=working | pre_approval_request(smart)=null    | post_approval_response(smart)=null    | ...
branch: smartEscalateCli: pre_approval_request(smart)=null | pre_approval_request(cli)=waiting | post_approval_response(cli)=working
branch: smartDenyThenGateway: smart pre/post=null | pre_approval_request(gateway)=waiting | post_approval_response(gateway)=working
branch: otherHumanSurfaces (mcp-elicitation, vault-payment, none, transport): waiting, unchanged from main

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 without surface behave 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Original fix by @kervral in #51683. Their authorship is preserved on the commit.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Hermes event normalization now returns null for events with a smart surface, as well as events without a mapped state. Tests verify that smart-surface approval requests and responses return null. They also verify that a CLI approval request produces waiting and its once response produces working.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 4c3f5

Automatic Hermes guardian checks will no longer mark panes as waiting or send needs-input notifications. Prompts that reach a person still show as waiting. The change is small, tested and easy to revert, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Issue #51676 requires that Hermes approval hooks with surface 'smart' not set a human wait, escalate a worker, or send a notification. Only a non-smart pre_approval_request, or a human-surface request…
Out of Scope Changes check Passed The whole-PR diff (merge base to head) changes two files. hermes-events.ts adds the smart-surface guard, which implements #51676 directly. hermes-events.test.ts adds a regression test for that guard a…
Title check Passed The title names the main change: Hermes panes no longer get marked as waiting during automatic smart-approval checks. It matches the raw summary, which shows normalizeHermesEvent returning null for su…
Description check Passed The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue (Fixes #51676), Visual Proof (N/A with a reason and a behavior round trip), Testing with chec…
Full details: Linked Issues check

Explanation

Issue #51676 requires that Hermes approval hooks with surface 'smart' not set a human wait, escalate a worker, or send a notification. Only a non-smart pre_approval_request, or a human-surface request that follows a smart escalation, should count as a wait. The source diff in hermes-events.ts changes the guard in normalizeHermesEvent to if (!stateName || hookPayload.surface === 'smart') return null. Smart pre_approval_request and post_approval_response events therefore produce no status. The change sits in the shared hook listener, so it applies to already-installed plugins, as the issue requests. The new test in hermes-events.test.ts checks smart-surface requests and responses return null, then checks a cli-surface pre_approval_request returns state 'waiting' and its post_approval_response returns 'working'. This covers the expected behavior. The diff was read directly. Runtime test results were not run; the test result is taken from the PR description.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff (merge base to head) changes two files. hermes-events.ts adds the smart-surface guard, which implements #51676 directly. hermes-events.test.ts adds a regression test for that guard and for the human-surface path. Both files connect directly to the linked issue. No unrelated files or behavior changes appear in the diff.

Full details: Title check

Explanation

The title names the main change: Hermes panes no longer get marked as waiting during automatic smart-approval checks. It matches the raw summary, which shows normalizeHermesEvent returning null for surface 'smart' events, and the PR objectives, which target the same false 'waiting' status. The title uses the fix(scope) convention and is 81 characters, which is slightly long but still clear.

Full details: Description check

Explanation

The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue (Fixes #51676), Visual Proof (N/A with a reason and a behavior round trip), Testing with checked items, Performance (None, because, with measurements), Risk with a Low level and a back-out plan, AI Disclosure, the Agent skill boundary, Notes, and the Checklist. The Review section is brief but filled in. The Risk section names the riskiest part and how to revert. The AI Disclosure section is left as the template comment, which is acceptable for an external contributor only if disclosure is not required, so this is a minor gap.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1b832f5-0d21-4e13-a4c0-9c1d8a9e938a
Commits

Reviewing files that changed from the base of the PR and between 13dcb53 and 4c3f58c.

Files selected for processing: 1

  • src/shared/agent-hook-listener/providers/hermes/hermes-events.test.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.

…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]>
@nwparker
nwparker force-pushed the kervral/hermes-smart-approval branch from 13dcb53 to 4c3f58c Compare November 28, 2026 09:50
@nwparker nwparker changed the title fix(hermes): ignore smart-approval hooks as human waits fix(hermes): stop marking panes as waiting during automatic smart-approval checks Nov 28, 2026
@nwparker
nwparker merged commit 49a10b0 into stablyai:main Nov 28, 2026
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hermes smart-approval checks are reported as "waiting on a human": false needs-input escalations and push notifications

2 participants