Repository navigation
Conversation
…der exec ask
Under exec ask (on-miss or always), native Claude Code tools in claude-cli
turns (Agent/Workflow kept by the managedNativeTools opt-in, or native Read
through exec host node) were denied about 30 ms after the call without any
approval request. requestCliNativeToolApproval called plugin.approval.request
without naming the backend as approval owner, so the Gateway rejected the
agent-runtime request with "signed plugin approval owner is unavailable" and
the catch turned that into "approval was not granted".
Wrap the request in withGatewayToolApprovalOwner like the before_tool_call
and harness approval paths do, and log the swallowed Gateway error before
failing closed (aborts stay silent).
Docs promise this path: docs/gateway/cli-backends.md, "Keeping Claude Code
orchestration tools on managed turns" ("ask on-miss or always routes it
through approval").
Context: openclaw#183765
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR binds native CLI approval requests to their backend owner and logs approval failures while keeping cancellations quiet. Example: A claude-cli turn calls native Agent with exec ask set to on-miss.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current, documented approval workflow failure with a focused change; no actionable defects remain. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI runtime passes native tool requests through OpenClaw policy and Gateway approvals, then returns permission to Claude Code only after checking the admitted turn is still active. flowchart TD
A[Claude native tool request] --> B[CLI host policy]
B --> C[Backend owner binding]
C --> D[Gateway approval]
D --> E[Operator decision]
E --> F[Final active turn check]
F --> G[Allow or deny native execution]
Technical reviewBest possible solution: Land the focused owner-binding repair while preserving existing policy, cancellation, and final execution checks. Do we have a high-confidence way to reproduce the issue? Yes: current-main registration omits the owner required by the Gateway, and the contributor records the same immediate denial through isolated Gateways; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch repairs registration at its existing owner using the established binding helper, leaves decision waiting outside that binding, and preserves downstream authority checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb6988695915. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +14, Tests +35. Total +49 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 26, 2026, 3:18 AM ET / 07:18 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…der exec ask (openclaw#183984) Bind native Claude tool approval registration to the existing backend owner so exec ask on-miss/always can present an approval instead of failing before prompting. Preserve the host's final active-run check, deny/cancel/timeout behavior, and add diagnostics for unavailable approval routes. Validation: ownership regression fails on base; all 41 focused tests pass. Exact-head CI 40248165098 is green. Contributor isolated Gateway/Control UI evidence covers allow, deny, timeout and cancellation; this maintenance pass retained that evidence without repeating the authenticated session. Related: openclaw#138853 (separate gateway call chat.send approval routing). Co-authored-by: Holger Gruenhagen <[email protected]>
What Problem This Solves
Fixes: native Claude Code tools are denied immediately, without an approval prompt, when a
claude-cliturn uses exec askon-missoralways.User Impact
Operators can approve or deny native tools exposed by
managedNativeToolsor the node exec host. Deny, timeout, cancellation, and unavailable approval routes still fail closed. Existing non-prompting policies are unchanged.Why This Change Was Made
Native approval registration omitted the backend owner required by the Gateway's agent-runtime authority check. Bind that request to the existing backend owner, as the other approval paths already do. Keep decision waiting outside that binding and retain the host's final active-run check. Log unavailable approval errors so operators can diagnose failures; intentional aborts stay quiet.
Thanks to @holgergruenhagen for the fix and isolated-Gateway reproduction. The simplification pass retained the focused implementation: it adds no new policy, configuration, or state owner. Net delta: production +14 lines, tests +35 lines. The small production increase supplies owner binding and failure diagnostics.
Evidence
642b31d1993bd93ce3a0ea68fc3bf581a8058ab1is identical to the PR baseline. Running the owner regression against that module fails becauseplugin.approval.requesthas noclaude-cliowner; the other 40 cases were skipped for this red run.node scripts/run-vitest.mjs src/agents/cli-runner/cli-native-tool-approval.test.ts --maxWorkers=1passes 41/41. Runner wall time was 198.47 s, including a cold shared-worker build; Vitest reported 164.01 s, with about 4% spent in tests.tsgorefuses this linked worktree's shared dependency installation; exact-head CI provides the broad type/build proof.b89bbfbeec508f73f697f498fc408a936aad0e38; the repository watcher reportsGREEN. Local merge-tree verification against current main is conflict-free.Live proof supplied by the contributor, using isolated Gateways and the real Control UI: before the fix, native Agent calls under ask policy were denied after 30–45 ms with no pending approval, and native Read on the node-host path was denied after 60 ms. With this production patch, Agent and Read created approval requests and ran after
allow-once; explicit denial and a 120-second timeout remained denied. An ordinary exec approval and non-prompting native tool execution remained working controls.The contributor also tested stop, stop followed by a new turn, session reset, and turn replacement while approval was pending. All four cancelled the old request, rejected late approval, and left the test marker absent; the active-turn control wrote its marker. The pending approval screenshot is retained below.
Not repeated in this maintenance pass: an authenticated Claude Code/Control UI round-trip. The existing isolated-Gateway evidence covers the unchanged production patch; no new authenticated harness was introduced.
Related: #138853 concerns the separate approval-route limitation of turns sent through
gateway call chat.send; this PR does not claim to fix it.