Skip to content

fix(system-agent): tell messaging users a delegated approval can't be applied from chat (#116519) - #117432

Merged
steipete merged 3 commits into
openclaw:mainfrom
SunnyShu0925:fix/delegated-approval-handoff-116519
Aug 28, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
SunnyShu0925:fix/delegated-approval-handoff-116519

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

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 dashboard on the Gateway host), or perform the change there with openclaw 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):

  • 280 focused tests passed across nine files, covering the real-tool agent-loop path, planner fallback, protected operations, direct approvals, operator-only Gateway resolution, MCP reconstruction, and CLI resume configuration.
  • Three real stdio subprocess probes passed. The production MCP config builder launched src/mcp/openclaw-tools-serve.ts with isolated temporary HOME/state. A delegated call returned needs-approval, the operator UI/setup instructions, and no conversational approval request. The direct control retained its yes instruction. A host-armed matching direct operation returned directive:approved-operation. No live operator configuration was changed.
  • Fresh Codex Autoreview reported no accepted/actionable findings. Manual review additionally followed the proposal owner, executor validation, Gateway approval registry, UI resolution, and direct/rescue siblings.
  • Changed-file repository checks and exact-head hosted CI are recorded in the maintainer proof comment before merge.

Focused test command:

node scripts/run-vitest.mjs src/agents/tools/system-agent-tool.test.ts src/mcp/openclaw-tools-serve.test.ts src/system-agent/agent-turn.test.ts src/system-agent/chat-turn-router.approval.test.ts src/system-agent/chat-turn-router.operations.test.ts src/agents/cli-runner/bundle-mcp.resume.test.ts src/system-agent/operations.test.ts src/system-agent/assistant.test.ts src/gateway/server-methods/system-agent.test.ts --maxWorkers=2

Exact-head terminal proof (ce35a264503257b199f6630adc39f8df006498ba):

ce35a264503257b199f6630adc39f8df006498ba
{"mode":"delegated","passed":true,"text":"needs-approval:86088ad9dc6698a3080f94ed68583cb553251592253ba56dab306c2524ad1806\nThis action changes state. The proposal is registered for operator approval. Do not request conversational approval. This change needs operator approval and cannot be applied from this chat. Approve it in the OpenClaw operator UI (`openclaw dashboard` on the Gateway host), or run the change there with `openclaw setup`."}
{"mode":"direct","passed":true,"text":"needs-approval:86088ad9dc6698a3080f94ed68583cb553251592253ba56dab306c2524ad1806\nThis action changes state. The proposal is registered; describe this exact change and ask the user to reply yes (their approval unlocks THIS action only — then retry the exact registered operation with approved=true)."}
{"mode":"direct-approved","passed":true,"text":"directive:approved-operation: the host accepted this exact approved action and will apply it after this turn. Do not call it again."}
Reproduce the real MCP subprocess proof

Save this as .local/stdio-handoff-proof.mjs in the source checkout after pnpm install --frozen-lockfile, then run node --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.

import assert from 'node:assert/strict';
import { mkdtemp, rm } from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { buildSystemAgentToolsMcpServerConfig } from '../src/mcp/openclaw-tools-serve-config.ts';
import { hashSystemAgentOperation } from '../src/agents/tools/system-agent-tool.ts';
const state = await mkdtemp(path.join(os.tmpdir(), 'openclaw-pr-117432-'));
const operation = { kind: 'config-set', path: 'agents.defaults.subagents.thinking', value: 'high' };
const hash = hashSystemAgentOperation(operation);
try {
  for (const mode of ['delegated', 'direct', 'direct-approved']) {
    const config = buildSystemAgentToolsMcpServerConfig({
      surface: 'cli',
      operatorApprovalOnly: mode === 'delegated',
      approvalArmed: mode === 'direct-approved',
      proposalRef: { current: hash },
    });
    const server = config.mcpServers.openclaw;
    const transport = new StdioClientTransport({
      command: server.command, args: server.args,
      env: { PATH: process.env.PATH, HOME: state, OPENCLAW_STATE_DIR: state, ...server.env },
      stderr: 'pipe',
    });
    const client = new Client({ name: 'approval-handoff-proof', version: '1.0.0' });
    const timer = setTimeout(() => void client.close(), 90000);
    try {
      await client.connect(transport);
      const result = await client.callTool({ name: 'openclaw', arguments: {
        action: 'config_set', path: operation.path, value: operation.value, approved: true,
      }});
      const text = result.content.filter(x => x.type === 'text').map(x => x.text).join('\n');
      if (mode === 'delegated') {
        assert.match(text, /needs-approval:/);
        assert.match(text, /cannot be applied from this chat/);
        assert.match(text, /openclaw dashboard/);
        assert.doesNotMatch(text, /ask the user to reply yes/);
      } else if (mode === 'direct') {
        assert.match(text, /ask the user to reply yes/);
      } else {
        assert.match(text, /directive:approved-operation:/);
      }
      console.log(JSON.stringify({ mode, passed: true, text }));
    } finally {
      clearTimeout(timer);
      await client.close();
    }
  }
} finally { await rm(state, { recursive: true, force: true }); }

Codex dependency behavior was inspected directly at upstream commit 6be2a6ca952ac9f70676ce4dd07fda27175aa9dd: rmcp-client/src/utils.rs preserves explicit child environment values; stdio_server_launcher.rs launches the server with that environment; exec/src/lib.rs supplies CLI overrides to the app server before thread resume; and app-server/src/dynamic_tools.rs forwards native dynamic-tool content and success unchanged. The exact-name child environment denylist in protocol/src/shell_environment.rs:14–26 does 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. Its pnpm build && pnpm openclaw setup --help probe 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 afterDecision callback 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 1:37 AM ET / 05:37 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

No 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
Reviewed head: ce35a264503257b199f6630adc39f8df006498ba
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): ClawSweeper live verification passed on the reviewed terminal surface.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): ClawSweeper live verification passed on the reviewed terminal surface.
Evidence reviewed 6 items Delegated approval authority: Gateway marks delegated chats as operator-only, queues the operation and hash, and invokes the exact-operation approval path only after an operator-manager decision.
Conversational approval remains blocked: The gateway test proves delegated "yes" does not resolve the proposal, while the operator-UI decision does.
Introduced handoff behavior: The router keeps operator-only sessions unarmed for conversational approval, and the tool returns a handoff instead of applying a staged operation.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw setup --help

Result: PASS (completed)

  --qwen-token-plan-api-key-cn ‹key›       Qwen Token Plan API key (China)
  --remote-password ‹password›             Remote Gateway password (optional)
  --remote-token ‹token›                   Remote Gateway token (optional)
  --remote-url ‹url›                       Remote Gateway WebSocket URL
  --reset                                  Reset config + credentials + sessions before running onboarding (workspace only with --reset-scope full)
  --reset-scope ‹scope›                    Reset scope: config|config+creds+sessions|full
  --runway-api-key ‹key›                   Runway API key
  --secret-input-mode ‹mode›               Credential persistence mode: plaintext|ref (default: plaintext)
  --skip-bootstrap                         Skip creating default agent workspace files
  --skip-channels                          Skip channel setup
  --skip-daemon                            Skip gateway service install
  --skip-health                            Skip health check
  --skip-hooks                             Accepted for onboard compatibility; hooks setup is skipped
  --skip-search                            Skip search provider setup
  --skip-skills                            Skip skills setup
  --skip-ui                                Skip Control UI/TUI launch
  --stepfun-api-key ‹key›                  StepFun API key
  --suppress-gateway-token-output          Disable the guided Control UI handoff
  --synthetic-api-key ‹key›                Synthetic API key
  --tailscale ‹mode›                       Tailscale: off|serve|funnel
  --together-api-key ‹key›                 Together AI API key
  --token ‹token›                          Token value (non-interactive; used with --auth-choice token)
  --token-expires-in ‹duration›            Optional token expiry duration (e.g. 365d, 12h)
  --token-profile-id ‹id›                  Auth profile id (non-interactive; default: ‹provider›:manual)
  --token-provider ‹id›                    Token provider id (non-interactive; used with --auth-choice token)
  --tokenhub-api-key ‹key›                 Tencent TokenHub API key
  --tokenplan-api-key ‹key›                Tencent TokenPlan API key
  --tui                                    Use the terminal hatch instead of the browser handoff (default: false)
  --venice-api-key ‹key›                   Venice API key
  --volcengine-api-key ‹key›               Volcano Engine API key
  --vydra-api-key ‹key›                    Vydra API key
  --wizard                                 Run interactive onboarding (default: false)
  --workspace ‹dir›                        Workspace proposal for guided setup; persisted by baseline/classic/non-interactive setup
  --xai-api-key ‹key›                      xAI API key
  --xiaomi-api-key ‹key›                   Xiaomi MiMo pay-as-you-go API key
  --xiaomi-token-plan-api-key ‹key›        Xiaomi MiMo Token Plan API key
  --yes                                    Approve persistent config writes for one --message request (default: false)
  --zai-api-key ‹key›                      Z.AI API key

Examples:
  openclaw setup
    Chat with OpenClaw, or onboard when setup is incomplete.
  openclaw setup -m "status"
    Run one system-agent request.
  openclaw setup --wizard
    Run full onboarding.

Docs: docs.openclaw.ai/cli/setup


Assertions:

  • PASS expect_output: setup

How this fits together

A 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]
Loading

Decision needed

Question Recommendation
Should this PR require a direct upstream Codex source check of the MCP stdio environment contract before merge? Verify Codex contract before merge: Inspect the upstream Codex MCP configuration and stdio environment handling, then merge if it confirms the existing projection is accepted.

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

  • Resolve merge risk (P1) - The PR changes environment state forwarded into Codex CLI MCP configuration; without direct upstream Codex-source verification, compatibility of that exact stdio-environment contract remains unconfirmed.
  • Complete next step (P2) - A maintainer must resolve the remaining direct Codex contract-verification requirement; no repair worker action is needed.
Agent review details

Security

None.

PR surface

Source +38, Tests +252, Docs +5. Total +295 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 7 51 13 +38
Tests 6 253 1 +252
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 309 14 +295

Review metrics

Metric Value Why it matters
Production versus test delta production +51/-13 (net +38); tests +253/-1 (net +252); docs +5/-0 Production growth carries operator-only state and a shared handoff across execution owners; focused tests cover the transport and validation paths.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116519
Summary: This PR is the candidate repair for the canonical delegated-approval messaging handoff defect.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Verify Codex MCP environment handling (recommended)
    Confirm upstream Codex accepts the projected stdio environment before merging this cross-runtime configuration change.
  2. Accept bounded contract uncertainty
    Merge based on the OpenClaw proof while explicitly accepting the unverified upstream Codex compatibility boundary.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. ClawSweeper live verification passed on the reviewed terminal surface.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • remove mantis: telegram-visible-proof: Current Telegram visible-proof status is not_needed.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status no longer selects a status label.

Label justifications:

  • P1: This fixes a real delegated persistent-change workflow that otherwise tells messaging users to perform an approval action the product intentionally ignores.
  • merge-risk: 🚨 compatibility: The new operator-only state is serialized through the Codex CLI MCP configuration boundary whose upstream environment contract was not directly verified.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • proof: sufficient: Contributor real behavior proof is sufficient. ClawSweeper live verification passed on the reviewed terminal surface.

Evidence

Acceptance criteria:

  • [P1] Inspect upstream Codex MCP configuration and stdio environment handling for the operator-only value.
  • [P1] Reconfirm the supplied production MCP stdio handoff proof after contract verification.

What I checked:

  • Delegated approval authority: Gateway marks delegated chats as operator-only, queues the operation and hash, and invokes the exact-operation approval path only after an operator-manager decision. (src/gateway/server-methods/system-agent.ts:591, ce35a2645032)
  • Conversational approval remains blocked: The gateway test proves delegated "yes" does not resolve the proposal, while the operator-UI decision does. (src/gateway/server-methods/system-agent.test.ts:907, ce35a2645032)
  • Introduced handoff behavior: The router keeps operator-only sessions unarmed for conversational approval, and the tool returns a handoff instead of applying a staged operation. (src/system-agent/chat-turn-router.ts:245, ce35a2645032)
  • User-visible contract: The shared operation parser and CLI documentation describe approval as an operator-surface handoff rather than a conversational confirmation. Public docs: docs/cli/openclaw.md. (docs/cli/openclaw.md:111, ce35a2645032)
  • Codex dependency signal and review gap: The bundled MCP configuration, including stdio environment, is projected into Codex CLI MCP overrides and covered by the Codex argument test. The required sibling Codex checkout was absent and DNS prevented obtaining its source, so its exact environment-handling contract was not independently verified. (src/agents/cli-runner/bundle-mcp.ts:232, ce35a2645032)
  • Exact-head behavior proof: The PR body supplies a production MCP-builder and stdio-client terminal run at this head showing delegated handoff wording, preserved direct-session confirmation wording, and an approved-operation directive. (src/mcp/openclaw-tools-serve.ts:50, ce35a2645032)

Likely related people:

  • steipete: Recent system-agent history includes the corrective approval-path work and the later concept-owner refactor. (role: recent system-agent contributor; confidence: high; commits: 8e4edf83695d, 6e851103dc81; files: src/system-agent/chat-turn-router.ts, src/system-agent/operations-parse.ts)
  • Ayaan Zaidi: The current MCP configuration canonicalization used by the Codex CLI path traces to this contributor's commit. (role: recent CLI/Codex MCP contributor; confidence: medium; commits: 4f9466af6f54; files: src/agents/cli-runner/bundle-mcp.ts, src/agents/codex-mcp-config.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Tighten the PR description with what changed, how it was validated, and any remaining risk.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (37 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-22T17:52:49.610Z sha 1d21bc6679526b098ce5265664fd5eed439281b4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-27T12:19:56.326Z sha 6f026bfd407fe508ed46fef3100f0978690b3935 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T12:38:11.104Z sha 6f026bfd407fe508ed46fef3100f0978690b3935 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T16:07:01.948Z sha 6f026bfd407fe508ed46fef3100f0978690b3935 :: needs changes before merge. :: [P2] Avoid raising the protected environment-variable budget
  • reviewed 2026-08-27T16:14:25.649Z sha 6f026bfd407fe508ed46fef3100f0978690b3935 :: needs changes before merge. :: [P2] Keep the environment-variable budget shrink-only
  • reviewed 2026-08-28T01:06:30.158Z sha 81c513fa9277dc6522f2a1828bb97541bb3e2df8 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T02:11:47.892Z sha e505adf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T05:11:35.237Z sha 8e4edf8 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 1, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/delegated-approval-handoff-116519 branch from cbc45e5 to 0bf9925 Compare August 1, 2026 14:36
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 2, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/delegated-approval-handoff-116519 branch from 0bf9925 to 8e71688 Compare August 2, 2026 15:52
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 11, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 11, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/delegated-approval-handoff-116519 branch from ea10057 to c65ecd0 Compare August 11, 2026 13:13
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Aug 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/delegated-approval-handoff-116519 branch from c65ecd0 to 03fa68b Compare August 11, 2026 13:44
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@SunnyShu0925
SunnyShu0925 force-pushed the fix/delegated-approval-handoff-116519 branch from 03fa68b to 35471b6 Compare August 11, 2026 14:03
@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

SunnyShu0925 and others added 2 commits August 28, 2026 09:54
…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]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Maintainer revision pushed as 8e4edf83695: the initial fallback returned before executor validation, so a protected auth.* write was incorrectly staged as an approvable proposal. I reproduced that failure, restored validation before staging, shared the operator UI/setup handoff, and aligned the primary system prompt. Direct approvals remain unchanged. The net production delta is now +38 instead of +62; the PR body explains the ownership/transport growth and records the separate completion-delivery follow-up.

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.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

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.
@steipete

Copy link
Copy Markdown
Contributor

Maintainer review and verification are complete for ce35a264503257b199f6630adc39f8df006498ba. Exact-head CI is green with no pending checks. Native review artifacts are validated with no remaining findings.

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.

@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Delegated OpenClaw writes request an approval that messaging users cannot complete

3 participants