Repository navigation
Conversation
The per-server approval mode that `openclaw mcp configure <server> --approval` writes was enforced only by the Codex harness. Embedded runs on other providers and CLI backends using the loopback MCP bridge, such as Claude CLI, ran prompt-mode tools without asking. Resolve the mode once in the before_tool_call policy so both the embedded wrapper and the loopback bridge ask with a plugin approval (Allow Once or Deny) after hooks. The Codex harness marks the tools it already guards so they are not asked twice.
Other annotation hints no longer waive the ask. Document that the approval never shows call arguments and that unattended runs with no approval route stop the call.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR applies explicit configured-MCP approval modes to embedded agents and CLI bridges while retaining Codex's existing approval owner. Example: Configure mailstub with --approval prompt, then ask an embedded agent to call send_mail.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR provides a coherent cross-runtime approval capability, but extending a documented Codex-only setting still needs a maintainer decision. Reviewed head: Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherConfigured MCP tools carry server policy into agent execution; the shared before-tool-call pipeline obtains an operator decision before dispatching calls to the MCP server. flowchart TD
A[Configured MCP metadata] --> B[Embedded tool wrapper]
A --> C[CLI loopback bridge]
B --> D[Before tool call policy]
C --> D
D --> E[Plugin approval routing]
E --> F[MCP server execution]
A --> G[Codex approval owner]
G --> F
Technical reviewBest possible solution: Use one maintainer-approved configured-MCP policy with existing approval routing while preserving Codex's approval ownership. Do we have a high-confidence way to reproduce the issue? Current-main materialization and execution paths establish the runtime difference, supported by contributor-supplied released-Gateway traces; no target code was executed during this read-only review. Is this the best way to solve the issue? Reusing the shared policy pipeline and approval transport is a focused implementation, but widening the stored setting and choosing different auto semantics require an explicit product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e36ee79bf2df. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +80, Tests +182, Docs +10. Total +272 across 10 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 November 29, 2026, 11:20 AM ET / 16:20 UTC (Revision 4). |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Second proof round for ClawSweeper's review of
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #208228
Related: #78308
What Problem This Solves
openclaw mcp configure <server> --approval prompt(stored asmcp.servers.<name>.codex.defaultToolsApprovalMode) asks the operator before a configured MCP tool runs, but only when the Codex harness runs the turn. On every other runtime, such as an embedded agent run on any model provider, or a CLI backend like Claude CLI reaching the tools through the Gateway loopback MCP bridge, a server set topromptruns its tools with no question asked. An operator who marks a mail or payments server as "ask first" gets no ask on most setups.User Impact
A server set to
promptorautonow asks before its tools run on every runtime OpenClaw executes MCP tools for. The ask is a normal plugin approval (Allow Once / Deny) on the operator's existing approval routes, such as the Telegram card or Control UI.promptasks for every tool.autoasks for every tool the server does not markreadOnlyHint: true; no other hint waives the ask. The card names the server and tool and never shows the call's arguments, which can carry credentials. A denial, a timeout, or a missing approval route stops the call, so an unattended run such as a cron job cannot use apromptorautoserver; servers those runs need stay onapprove. Servers with no mode, orapprove, behave as before. Codex turns are unchanged and are asked once, not twice.Why This Change Was Made
The mode is resolved once, from the tool's existing MCP metadata, and applied in
runBeforeToolCallHookafter the before_tool_call hooks. Both entry points pass it there: the before_tool_call wrapper (embedded runs) and the loopback bridge handler (CLI backends). One gate covers every runtime, and hooks keep their order and their ability to block first. The Codex harness already asks through its own interactive approval, so it marks the tools it guards (harnessApproval) and the shared gate skips them. The change reads the existing key rather than adding config. A neutralmcp.servers.<name>.approvalkey is left for maintainers to decide on. This is the operator-side gate in core; #78308 (a server-requested consent envelope) is complementary and would reuse the same approval route, so its ownership can be settled alongside this one.Evidence
Every run below is the shipped entry point:
openclaw gateway runbuilt from this branch (node dist/index.js), or the 2026.11.10 and 2026.11.12 npm releases for the before side. The approval mode is set with the shipped CLI,openclaw mcp configure mailstub --approval <mode>. An owner DM arrives through a stub Telegram Bot API and asks the agent to callsend_mailonce on a stdio test MCP server that logs every call it receives. Approval taps are Telegram callback queries on the card's own buttons. The 2026.11.12 upgrade runs use a build of the current headeb8d976; the earlier runs usedacb931e, andeb8d976adds only the test-mock fix, so runtime behavior is the same.readOnlyHint: truereadOnlyHint, Denymcp configure)No approval card in any run contains the call's arguments (the recipient address never appears in a card's text).
On upgrade, an existing
promptorautosetting written for Codex now asks on every runtime. That is the intended change and the compatibility risk themerge-risklabel names: unattended runs (cron) on such a server stop at the ask, so those servers stay onapprove. Whether the Codex-scoped key should carry this is the maintainer decision ClawSweeper raised; a neutralmcp.servers.<name>.approvalkey is the alternative.Regression tests, failing on
main(583e7ab) and passing on this branch, run withpnpm test <file> --maxWorkers=1on Node 24:src/gateway/mcp-http.handlers.mcp-approval.test.ts: 5 of 8 fail onmain(prompt asks, auto withoutreadOnlyHintasks, including a tool whose other hints say non-destructive and closed-world, deny and no decision do not run the tool); all 8 pass here. The 3 that pass on both (autoread-only,approve, unset) guard that the gate does not over-ask.src/agents/agent-tools.before-tool-call.mcp-approval.test.ts: 2 of 2 fail onmainand pass here (embedded run asks once, runs on Allow Once, refused on Deny).ClawSweeper's finding is fixed in
eb8d976: both Gateway mocks now spread the real module throughimportOriginaland replace onlycallGatewayTool.pnpm check:test-mock-exportsprintsMock factory ratchet OK: 6074 grandfathered factories.(baseline unchanged). oxfmt and oxlint are clean on the changed files.git merge-tree --write-tree upstream/main HEADis clean.Live runs (redacted, test data only)
Regression tests on main and on this branch
Gaps
openaiorcodexprovider with an OpenAI login, and this environment has none: a Codex-runtime agent on another provider is refused (Requested agent harness "codex" does not support <provider>/<model> (provider is not one of: codex, openai)). The change on that path is narrow: inapplyConfiguredMcpApproval(src/agents/agent-bundle-mcp-harness.ts) the harness keeps its existing approval and only marks the toolharnessApproval, whichresolveConfiguredMcpToolApprovalreads to skip the shared gate. The existing Codex configured-MCP and bundle MCP harness suites pass on this branch (424 neighbouring tests atacb931e; the new head changes only the two test mocks). A maintainer run on a signed-in Codex harness would close this gap.autooffers Allow Once / Deny only, with no Allow Always or stored grants. The Codex harness keeps its own existingautorule; only the shared gate is stricter.