Repository navigation
feat(agent): add RequestApproval tool to escalate judge rejections to the user - #1162
Conversation
… the user a judge rejection was previously the last word. the tool re-asks the human through the existing interactive question form (Approve/Deny + free text); approval sets a one-shot bypass marker so the next matching judge decision approves without a judge call, and the rejection reason now hints at the escalation path.
|
@infer Can you finalise the work on this PR? use /ponytail:ponytail /cobra-viper /go |
|
Model: Todos
Pull Request
|
|
@infer Can you finalise the work on this PR? use /ponytail:ponytail /cobra-viper /go |
|
Model: Todos
Pull Request✅ Infer Result: SuccessDone - the PR is finalised and fully green. What changedOne commit pushed to
No other code changes were needed - the work was already complete after the previous session recovered and pushed it; only this one-line formatting fix remained. Verification
Follow-up
The branch is clean and pushed; no downstream repos besides docs are affected. Model: Tokens: 3,294,615 in · 31,472 out · 3,326,087 total (53 requests) Tool calls: 68 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
…xempt it from the judge - RequestApproval is no longer judged itself and is always advertised, so the tool list stays mode-independent; drop Registry.SetAgentModeManager - escalation reuses the regular approval box (ToolApprovalRequestedEvent gains an optional Context shown above the call); question-form path and free-text answer removed; a closed response channel counts as a rejection - consuming an approved bypass drops the registry entry so a later rejection of the same call can be escalated again - fold state()+claim() into one locked claim - Auto+Judge guidance, rejection hint and tool description tell the model to attempt the call first and escalate only when the user asked for it - docs for judge-mode, tools-reference, commands-reference, README
|
🎉 This PR is included in version 0.188.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1156
Summary
Adds a
RequestApprovaltool that lets the agent explicitly ask the user to override a tool call the LLM judge rejected (auto-with-judge mode /approval_behaviour: judge). The question round trip reuses the existing interactive question form (TUI) with Approve/Deny options plus the free-text "Other" choice; approval records a one-shot bypass marker so the next matching judge decision approves without a judge call, and every judge rejection now hints that the escalation path exists.Changes
RequestApprovaltool (internal/agent/tools/request_approval.go): input carries the rejected call (name + arguments), what permission is needed and why; the judge's rejection reason is shown to the user alongside the agent's justification.internal/agent/judge_escalations.go): tracks judge-rejected calls keyed by tool name + canonical argument JSON (whitespace/key-order insensitive), one escalation per rejected call, and holds bypass markers consumed byrequestJudgeApprovalso the approved call runs exactly once with the judge bypassed for that invocation only.agentdomain.ApprovalEscalationport implemented by the agent service and injected into the tool's execution context on the chat path only; headless/no-TTY runs degrade to a distinguishable "no approver reachable" result (same pattern as AskUserQuestion) and never hang.Registry.SetAgentModeManagerwiring) ortools.safety.approval_behaviour: judgeconfig.config/prompts.go(user-overridable via prompts.yaml like other tools).INFER_GATEWAY_MOCK=truecovering judge rejection -> escalation attempt in headless -> distinguishable no-approver result -> turn continues.Deliberate skips
judge.escalation: prompt|blockconfig switch: the issue says "consider"; the nil-gate degrade already makes prompting opt-out in headless, and chat users can simply deny. Add the switch if a real workload needs to silence the hint/prompt in TUI too.