Repository navigation
fix(system-agent): tell messaging users a delegated approval can't be applied from chat (#116519) - #117432
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 1:37 AM ET / 05:37 UTC. ClawSweeper reviewWhat this changesThe PR carries delegated operator-only approval state through system-agent and MCP execution paths so messaging users receive a Control UI or CLI handoff instead of being told that chat confirmation will apply a write. Merge readinessNo introduced functional or security defect was found, and the exact-head terminal proof demonstrates the intended operator-only handoff. Merge review remains open because the changed MCP environment is forwarded into Codex CLI configuration, but the required direct Codex-source contract check could not be completed locally. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherA regular agent delegates persistent OpenClaw operations to the system agent, which stages a hash-bound proposal for human approval. The system-agent result is relayed back through Gateway or an MCP subprocess to the originating conversation. flowchart LR
A[Messaging user request] --> B[Regular agent delegation]
B --> C[System-agent operation planner]
C --> D{Persistent change needs approval}
D -->|Direct session| E[Chat confirmation]
D -->|Delegated session| F[Operator UI or CLI handoff]
F --> G[Operator approval manager]
G --> H[Exact approved operation]
Decision needed
Why: Repository policy requires the acting reviewer to inspect the sibling Codex implementation when OpenClaw behavior depends on that CLI configuration contract, and that source was unavailable in this environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +38, Tests +252, Docs +5. Total +295 across 14 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Confirm the exact Codex CLI MCP environment/configuration contract against upstream source, then merge if it accepts the projected operator-only state unchanged. Do we have a high-confidence way to reproduce the issue? Yes for the source-defined path: current tests prove delegated chat confirmation is ignored, and the supplied exact-head stdio proof shows the replacement handoff behavior; a live messaging-channel rerun was not supplied. Is this the best way to solve the issue? Yes: preserving the operator-only approval boundary while replacing misleading confirmation copy with an actionable handoff is safer than allowing chat approval. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d7b0e07f4ca0. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (37 earlier review cycles; latest 8 shown)
|
cbc45e5 to
0bf9925
Compare
|
The current integration hard-codes runAgentTurn to null, so it never exercises the real default engine; delegated approvals still cannot complete through reply-yes, and the fallback path discards refusal evidence—please cover a real engine turn and preserve the operator-only refusal outcome before merging. |
0bf9925 to
8e71688
Compare
ea10057 to
c65ecd0
Compare
c65ecd0 to
03fa68b
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
03fa68b to
35471b6
Compare
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…gated routes (openclaw#116519) Delegated OpenClaw writes from messaging channels told the user to approve conversationally ("Say yes to apply"), but delegated sessions intentionally ignore chat approvals — only an operator in the OpenClaw UI can resolve them. - Default agent-loop route: thread operatorApprovalOnly from the engine through the turn runner into the ring-zero tool options; the tool registers the delegated proposal for the operator registry and instructs the model to surface the OpenClaw operator UI / `openclaw` CLI path instead of a dead-end conversational prompt (the needs-approval marker is kept so out-of-process CLI hosts still mirror the refusal). - Planner-fallback route: the delegated reply preserves refusal evidence (what was requested, that it was not applied) alongside the operator handoff. - Gateway: the closed SystemAgentChatResult schema is unchanged — the openclaw.chat response carries only needsApproval/proposalId; no approvalHint field. - Coverage: real agent-loop turn through the real ring-zero tool, tool-boundary delegated refusal + marker transition, engine default-route passthrough, and direct-session "Say yes to apply" preserved. - Plugin SDK: regenerate plugin-sdk-api-baseline.jsonl — the new optional operatorApprovalOnly field on SystemAgentToolOptions flows into the createOpenClawCodingTools options closure, changing its closureHash; the export declaration is unchanged.
Keep executor preapproval validation before staging delegated proposals, share actionable operator handoff text, and align the system prompt. Cover real tool and transport behavior while retaining direct approvals. Co-authored-by: SunnyShu0925 <[email protected]>
|
@clawsweeper re-review Maintainer revision pushed as 258 focused tests passed; after splitting the new handoff cases to satisfy the test-file size limit, both router files passed again (114 tests). Three real MCP stdio probes passed delegated, direct, and exact host-approved modes. Fresh Codex Autoreview is clean. The original check run found only the test-file size violation; the complete changed-file check is rerunning and hosted CI is now watching this exact head. Final check results will be recorded before merge. The PR body now distinguishes real subprocess evidence from the earlier mocked outbound-adapter proof; no live messaging session or full ephemeral-Gateway proof is claimed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep delegated approval coverage inside existing suites without increasing shard or file-size limits. Restore the CLI backend fixture dropped when chat-engine tests were split, avoiding real plugin setup loading in routing and continuity tests.
|
Maintainer review and verification are complete for The original misleading chat-approval instruction is confirmed on main. The revised patch carries the existing operator-only state through the loop and MCP child and shares one operator UI/setup handoff. I also repaired the initial PR's fallback regression: executor validation now runs before staging a proposal, so forbidden auth/default-model config writes are rejected without leaving pending state. Direct approvals and the operator-only authorization boundary remain unchanged. Production delta is +51/-13 (net +38), reduced from the incoming +62; tests are +253/-1 and docs +5. Verification covers 280 distinct focused cases across nine files, full changed-file checks plus checks of the final operation-test edit, fresh Codex Autoreview, and three real MCP subprocess modes on the exact final head. The PR body contains the raw terminal output, runnable probe, and direct upstream Codex source citations, including the explicit child environment merge, exact-name denylist, launch, and config/resume paths. These address the latest ClawSweeper source/proof requests. Its build/help probe timed out during the build, before reaching setup; no live messaging session or Telegram recording is claimed. The initial CI metadata/test-root failures are fixed without raising limits. Expanded testing also exposed a pre-existing CLI test timeout: a profile showed 119.4 seconds in real plugin setup loading, and history showed #121884 had dropped the scoped fixture introduced in #118541. Restoring that same fixture around the two CLI-loop tests made all 24 operation tests pass, with no timeout or assertion changes. The separate follow-up to deliver operator-approval completion back to the originating conversation remains documented in the PR body. |
|
Merged via squash.
|
Closes #116519
What Problem This Solves
Delegated persistent changes require operator approval, but the default system-agent tool and native CLI MCP path told messaging users to reply yes. The delegated session intentionally cannot accept conversational approval, so that instruction led to a dead end.
This change carries the existing operator-only state to the tool and MCP child, and shares one actionable handoff across the tool and planner fallback: approve in the operator UI (
openclaw dashboardon the Gateway host), or perform the change there withopenclaw setup. The system prompt now follows the approval instructions returned by the tool. Direct conversational approvals and rescue behavior remain unchanged; the operator-only authorization boundary is not relaxed.Maintainer review found and repaired a regression in the initial fallback implementation: returning before the executor skipped preapproval validation and staged forbidden config writes as pending proposals. The router now validates through the existing executor before staging anything. Regression coverage rejects protected auth/default-model config writes and verifies that no pending proposal remains. No alternate executor, compatibility path, configuration option, environment-variable name, protocol field, or storage change is introduced.
Evidence
The original messaging defect is present on the reviewed main baseline. Restoring the baseline MCP/tool implementations made the new transport and delegated-copy tests fail. A separate failing reproduction on the original PR showed a protected
auth.*config write incorrectly returning an operator-approval handoff; the repaired implementation rejects it before staging a proposal.Local verification on the revised source (the full initial run plus targeted reruns after test grouping):
src/mcp/openclaw-tools-serve.tswith isolated temporary HOME/state. A delegated call returnedneeds-approval, the operator UI/setup instructions, and no conversational approval request. The direct control retained its yes instruction. A host-armed matching direct operation returneddirective:approved-operation. No live operator configuration was changed.Focused test command:
Exact-head terminal proof (
ce35a264503257b199f6630adc39f8df006498ba):Reproduce the real MCP subprocess proof
Save this as
.local/stdio-handoff-proof.mjsin the source checkout afterpnpm install --frozen-lockfile, then runnode --import ./scripts/tsx.mjs .local/stdio-handoff-proof.mjs. It launches the production MCP entry with the production config builder, uses temporary HOME/state, and does not invoke a model or modify operator configuration.Codex dependency behavior was inspected directly at upstream commit
6be2a6ca952ac9f70676ce4dd07fda27175aa9dd:rmcp-client/src/utils.rspreserves explicit child environment values;stdio_server_launcher.rslaunches the server with that environment;exec/src/lib.rssupplies CLI overrides to the app server before thread resume; andapp-server/src/dynamic_tools.rsforwards native dynamic-tool content and success unchanged. The exact-name child environment denylist inprotocol/src/shell_environment.rs:14–26does not filter the OpenClaw approval state. These are direct maintainer source checks, not an inference from wrappers or generated schemas.Proof limits: no live WhatsApp, Telegram, or Slack session was run. The subprocess probe exercises the real changed transport, not Codex process orchestration or a live messaging client. The contributor's earlier channel evidence exercises the real outbound adapter with a mock transport; it is not a full ephemeral-Gateway end-to-end run. No channel transport or message schema changes in this PR.
An existing CLI-loop test repeatedly timed out during the expanded sibling run. A CPU profile attributed 119.4 seconds to real plugin setup/backend loading. History showed #121884 had dropped the scoped CLI backend fixture introduced in #118541. This PR restores that existing fixture around only the two CLI-loop tests; all 24 operation-suite tests then passed, with 16.94 seconds of test execution. No timeout or assertion was weakened. The new cases fit the existing approval/operation suites, preserving both the test-file line limit and the 720-root typecheck shard limit.
Review scope and remaining work
Production delta is +51/-13, net +38; tests +253/-1 (net +252); docs +5/-0. The positive production delta carries the existing operator-only state across the previously lossy tool/MCP boundaries and provides the shared handoff. Reusing executor validation and the plan formatter removed the separate fallback branch and reduced the original net +62 production lines. The environment budget remains 501.
The latest ClawSweeper review (reviewed
8e4edf83695, same production code as the final head) has no code findings. Its direct-Codex-source request is addressed above. Itspnpm build && pnpm openclaw setup --helpprobe timed out during the full build before reaching setup; the exact-head real stdio output above exercises the changed path and supplies the requested terminal proof. Exact-head hosted CI is recorded in the final proof comment. The optional Telegram Desktop recording is not included; no live messaging-account run or channel-rendering proof is claimed.Named follow-up: deliver operator-approval completion back to the originating conversation. The existing Gateway
afterDecisioncallback consumes the approval but discards the engine's detailed completion reply. This PR repairs the initial handoff; it does not add completion delivery or change persistence. Broader interactive setup handoff (#112077) remains separate.Thanks @SunnyShu0925 for the implementation and @andersonjeccel for the report. Maintainer changes preserve contributor credit. AI-assisted implementation and review.