Repository navigation
Description
Summary
Add a RequestApproval tool that lets the agent explicitly ask the user for permission when the LLM judge (Auto+Judge mode / approval_behaviour: judge, #1147, #1148) rejects a tool call. Today the judge is the last word: the driver gets rejected by judge: <model>: <reason> and either gives up or loops on retries. In practice the judge rejects legitimate actions when it lacks context (observed with git push judged against a bare "continue"), and the user has no way to override short of switching modes.
The tool is a question-and-answer round trip between the agent and the user:
- Question (agent side): the agent calls
RequestApprovalwith the tool call it wants to run (name + arguments), what it needs permission for, and why (its justification, in its own words). The judge's rejection reason should be included so the user sees both sides. - Answer (user side): the user is prompted with the question through the existing human approval path (TUI approval prompt, IPC approver in headless when one is reachable). The user can approve, deny, or type a free-text answer. The tool result carries that decision and text back to the agent, so a denial with an explanation ("not yet, run the e2e suite first") steers the next step instead of ending the turn.
On approval the original call runs once with the judge bypassed for that single invocation. On denial the agent receives the standard rejection tool result with the user's answer appended.
Design notes:
- Reuse
requestToolApprovaland the approval channel; no new approver transport. Headless with no reachable approver returns a distinguishable "no approver reachable" result rather than hanging. - Scope it to calls the judge actually rejected (key on the rejected call's tool name + argument hash) so the tool cannot be used to nag past Standard mode gating.
- One escalation per rejected call, so a stubborn model cannot loop on the prompt.
- Append a hint to the judge rejection reason ("call RequestApproval to ask the user directly") so the driver knows the path exists.
- Consider a
judge.escalation: prompt|blockswitch for environments where prompting is undesirable.
Acceptance Criteria
-
RequestApprovaltool registered ininternal/agent/tools/registry.go, available only when the judge is the active approver - Tool input carries the pending tool call, what permission is needed, and why; the judge's rejection reason is shown to the user alongside it
- The user is prompted through the existing approval path (TUI + IPC) and can approve, deny, or answer with free text
- Tool result returns the decision and the user's answer text to the agent
- Approval runs the original call once with the judge bypassed for that invocation only
- Denial returns the standard rejection tool result with the user's answer appended and does not end the turn
- Escalation limited to judge-rejected calls, one attempt per rejected call
- Headless with no reachable approver returns a distinguishable "no approver reachable" result
- Judge rejection reason hints at
RequestApproval - Unit tests for the tool and the bypass marker; e2e scenario under
INFER_GATEWAY_MOCK=true -
docs/judge-mode.mdanddocs/commands-reference.mdupdated
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Sep 2, 2026
@infer Can you work on this? use /ponytail:ponytail /go /go-concurrency /cobra-viper
inference-gateway-maintainer commentedon Sep 2, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1162
The agent hit the job's time limit before finishing, so it was stopped to salvage its work. Its committed changes were pushed; the draft pull request is linked above.
Let me check the judge_verdict event keys around agent.go:1802.
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 23m 15sTokens: 15,140,957 in · 112,913 out · 15,253,870 total (114 requests)
Tool calls: 171 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
fix: resolve #1156
inference-gateway-releaser commentedon Sep 2, 2026
🎉 This issue has been resolved in version 0.188.0 🎉
The release is available on:
Your semantic-release bot 📦🚀