Skip to content

fix(approval): surface pending-approval state with explicit marker (#28000)#28323

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a
May 19, 2026
Merged

fix(approval): surface pending-approval state with explicit marker (#28000)#28323
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #28000 by @LifeJiggy.

What: When a tool requires approval (e.g. write_file, patch on sensitive paths), the approval prompt fires asynchronously but the tool result returned to the LLM was indistinguishable from a normal failure (exit_code=-1 plus a generic error string). The model couldn't tell whether to retry, wait, or give up.

How: Promote the status field from approval_required to pending_approval and add an explicit approval_pending: True field on both the guard payload (tools/approval.py) and the terminal-tool fallthrough (tools/terminal_tool.py). Clears the error field so the model sees the pending state directly instead of as a failure.

Original PR: #28000
Fixes #14806.

…sible to LLM

When a tool call requires user approval in the non-blocking gateway path,
the LLM previously received a result that was indistinguishable from a
failed tool call (exit_code=-1, error=message). The LLM could not tell
whether the tool was pending approval, had returned empty results, or had
failed silently — causing it to burn context on wrong hypotheses.

Fix changes the result format to include:
- status: pending_approval (clear state name)
- approval_pending: True (explicit boolean for LLMs to detect)
- error: cleared to empty string (removes misleading error signal)

This lets the LLM reason about approval latency vs actual errors,
short-circuiting the previous silent failure mode.

Fixes #14806
@teknium1 teknium1 merged commit 6d495d9 into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-3ad7d98a branch May 19, 2026 02:37
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-3ad7d98a vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8814 on HEAD, 8814 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4631 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets comp/agent Core agent loop, run_agent.py, prompt builder tool/terminal Terminal execution and process management labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool-approval pending state is invisible to the LLM — indistinguishable from "executed + empty result"

3 participants