Skip to content

feat: enable the new exec approvals pipeline behind an opt-in setting - #985

Merged
shanselman merged 3 commits into
openclaw:mainfrom
AlexAlves87:feat/exec-approvals-v2-wiring
Jul 21, 2026
Merged

shanselman merged 3 commits into
openclaw:mainfrom
AlexAlves87:feat/exec-approvals-v2-wiring

Conversation

@AlexAlves87

@AlexAlves87 AlexAlves87 commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

The new exec approvals pipeline (validator, normalizer, evaluator, store, coordinator) is fully merged but unreachable: nothing constructs the coordinator in production, and the system.run pipeline branch returned a typed error for every result — including Allow — so no command could ever execute through it. The pipeline could not be exercised or rolled out at all.

Why This Change Was Made

Two narrow additions make the pipeline reachable without changing any default behavior. First, SystemCapability now executes the approved payload when the handler allows: the validated argv reaches the process directly with no shell re-parsing and nothing re-derived from the raw request, so what was approved is exactly what executes. Second, NodeService wires ExecApprovalsCoordinator into SystemCapability behind a new ExecApprovalsNewPathEnabled setting (default false, no Settings UI yet — enabled by editing settings.json). The handler is built once per NodeService lifetime and reused across capability rebuilds, because the coordinator serializes approvals with a per-instance semaphore and a fresh instance per rebuild could race an in-flight approval on reconnects. A failed construction is not cached: only a real coordinator is stored, so a transient initialization fault is retried on the next rebuild, and until then a null handler gives every request a typed unavailable deny — never a silent fallback to the legacy path. Non-goal: the approval prompt UI is a follow-up; prompt-required decisions currently resolve through the store's ask fallback, and with no store file the pipeline default-denies everything.

The pipeline executes an allow as a direct argv, which the sandbox transport cannot carry yet, so system.run gates up front when the runner reports it cannot execute direct argv (IDirectArgvSupportAwareCommandRunner). MxcCommandRunner reports this only when the sandbox is enabled and available — the one state where an approved command would otherwise reach MXC and fail closed — and SystemCapability returns a typed unavailable error before evaluation, so nothing is approved that cannot execute. The sandbox is never disabled or bypassed: every other combination (sandbox off, or enabled but unavailable) keeps executing the approved argv on the host runner it already used, and strict fallback blocking keeps denying with its own explicit result. This interaction is documented on the setting property.

User Impact

No user-visible change by default. Operators who opt in can route system.run through the new approvals pipeline and get deny-by-default behavior with full per-request decision logging; turning the flag off and restarting restores the legacy path exactly.

Evidence

See Real Behavior Proof below: all four states exercised live against a running tray instance (flag off, flag on with no approvals file, flag on with an allow-all store, and flag off again after restart).

Change Type

  • Feature
  • Bug fix
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Windows node capability
  • Permissions, privacy, or security
  • Tray or WinUI UX
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Tests, CI, or docs

Validation

Merge with current main (93b645c9, 2026-07-20): merged cleanly (no conflicts; auto-merged overlapping SettingsData.cs, NodeService.cs, SettingsManager.cs). New head after merge: 0e914c28.

Suite Result
./build.ps1 ✅ All 5 projects built (Shared, Cli, WinNodeCli, SetupEngine, WinUI)
OpenClaw.Shared.Tests ✅ 2950 passed, 31 skipped, 0 failed
OpenClaw.Tray.Tests ✅ 1834 passed, 0 failed
OpenClaw.WinNode.Cli.Tests ✅ 126 passed, 0 failed
OpenClaw.Connection.Tests ✅ 446 passed, 0 failed
validate-mxc-e2e.ps1 ⚠️ Infrastructure blocked — port 61112 EADDRINUSE from stale gateway on host (not caused by PR)

Security review (specialist): No vulnerabilities found. Verified: no approval bypass, no sandbox bypass, no silent fallback, TOCTOU mitigated by defense-in-depth at MxcCommandRunner.RunAsync:146, settings race mitigated by re-reading at execution time, prompt serialization sound, immutable execution payload with defensive copies.

Behavioral test coverage for the V2 flag matrix (exercises real runners, not fake shells):

  • V2 on + sandbox enabled/available → typed unavailable before evaluation; neither handler, sandbox executor, nor host fallback invoked
  • V2 on + sandbox unavailable + fallback allowed → approved argv executes on host with argv/env/cwd/timeout intact
  • V2 on + sandbox unavailable + strict fallback blocking → denies without executing
  • V2 on + sandbox disabled → approved argv executes on host
  • Legacy path byte-for-byte unchanged when V2 handler is null
  • Handler exceptions → typed deny, no fallback
  • NullHandler → typed unavailable (fail-safe)
  • Prompt invariants: Allow plain → InternalError; prompt throws → UserDenied; prompt serialization enforced

Real Behavior Proof

  • Environment tested: Windows 11 Pro, isolated tray instance (run-app-local.ps1 -NoBuild -AllowNonMain -DataDir <temp>), MCP mode only (EnableMcpServer=true, EnableNodeMode=false), sandbox disabled so the host runner executes. Driven via winnode --command system.run --params '{"command":["ping","-n","1","127.0.0.1"]}'.
  • PR head or commit tested: 04c87c6
  • Exact steps or command run: four states, restarting the app between settings changes.

1. Flag off (default) → legacy path, executes:

{ "exitCode": 0, "timedOut": false, "success": true, ... }
[2026-07-13 22:36:59.797] [INFO] [system.run] corr=528ed8db path=legacy decision=legacy reason=legacy

2. Flag on, no exec-approvals.json → typed deny, nothing executes (fail-closed first run):

exec-approvals-v2: SecurityDeny (security=deny)
[2026-07-13 23:09:35.501] [INFO] [EXEC-APPROVALS] new path enabled (prompt UI not wired; fallback-only)
[2026-07-13 23:47:09.735] [INFO] [system.run] corr=410e63d8 path=v2
[2026-07-13 23:47:09.743] [WARN] [EXEC-APPROVALS] [410e63d8] path=new canonical="ping -n 1 <redacted>" decision=deny reason=security=deny fallbackUsed=False promptAttempted=False

3. Flag on, store {"version":1,"defaults":{"security":"full","ask":"off"}} → allow, executes the approved argv:

{ "exitCode": 0, "timedOut": false, "success": true, "durationMs": 39, ... }
[2026-07-13 23:55:38.920] [INFO] [system.run] corr=b4db9822 path=v2
[2026-07-13 23:55:38.941] [INFO] [EXEC-APPROVALS] [b4db9822] path=new canonical="ping -n 1 <redacted>" decision=allow reason=approved fallbackUsed=false promptAttempted=false
[2026-07-13 23:55:38.994] [INFO] [system.run] corr=b4db9822 path=v2 executed exit=0 timedOut=False

4. Flag back off + restart → legacy resumes:

[2026-07-14 00:24:10.363] [INFO] [system.run] corr=87a63c40 path=legacy decision=legacy reason=legacy

Current-head proof of the sandbox gate (commit 83a8b8a). New path enabled and sandbox enabled, on this MXC-capable host (probe reports supported=True, tier appcontainer-dacl). Isolated tray in MCP mode, driven via winnode --command system.run --params '{"command":["ping","-n","1","127.0.0.1"]}'.

winnode response — typed unavailable, non-zero, nothing executed:

exec-approvals-v2: Unavailable (sandboxed system.run cannot execute the approved command form yet; keep the sandbox on and disable the new approvals path, or turn the sandbox off, to run commands)

Redacted tray log for the same request:

[INFO] [mxc] system.run runner = MxcCommandRunner (executor=mxc-direct-appc; sandboxEnabled=True)
[INFO] [EXEC-APPROVALS] new path enabled (prompt UI not wired; fallback-only)
[DEBUG] [MCP] tools/call system.run
[INFO] [system.run] corr=6571bc78 path=v2
[INFO] [mxc] availability: supported=True outcome=Supported tier=appcontainer-dacl
[INFO] [system.run] corr=6571bc78 decision=Unavailable reason=sandboxed system.run cannot execute the approved command form yet; ...

The gate fires before evaluation, returns the typed unavailable, and there is no executed exit= line: the command never ran, and the sandbox was not bypassed.

  • Evidence after fix: outputs and redacted runtime log lines above, captured from the PR head build.
  • Observed result: flag off is byte-for-byte legacy; flag on denies by default with full decision logging and executes only what the pipeline approves.
  • Screenshot or artifact links verified? N/A
  • Not verified or blocked: none remaining. Update (2026-07-17): the gateway/MXC proof was re-run against the sandbox-gate commit 83a8b8a and both proofs pass again (RealGateway_SystemRun_ExecutesThroughWindowsNodeMxcSandbox and RealGateway_SystemRun_BlocksWritesToTrayDataDirectoryInMxcSandbox, 2/2, ~5 min). The earlier .\scripts\validate-mxc-e2e.ps1 failure (systemctl not available; systemd user services are required on Linux) was environmental — Docker Desktop's WSL integration stalling the user systemd session in freshly provisioned distros — and clears with Docker Desktop stopped. The harness provisions a throwaway WSL distro, installs a real gateway with defaultAction=deny plus a scoped allowlist for the proof commands, and cleans up after itself. TRX (OpenClaw.E2ETests.Mxc.trx) and full redacted console/harness logs are available on request.

Update (2026-07-20 merge validation): After merging current main (93b645c9), local validate-mxc-e2e.ps1 failed with EADDRINUSE on port 61112 (stale gateway process from prior E2E run on this host). This is an infrastructure issue unrelated to the PR code — the test script's gateway provisioning collided with an already-occupied port. The code path is unchanged; the earlier 83a8b8a proof and the 2026-07-17 clean E2E run remain valid evidence.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? Yes
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: with the flag on, system.run routes through the new approvals pipeline instead of the legacy policy. The pipeline is stricter, not looser: no store file means deny-everything; any pipeline failure produces a typed deny (never a silent fallback to legacy); and on allow, the executed command is the pipeline's validated argv with sanitized environment, passed to the process without a shell re-parsing it. With the flag off (the default), the execution surface is unchanged.

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? Yes
  • Migration needed? No
  • If yes, list the exact upgrade steps: the new ExecApprovalsNewPathEnabled setting is optional and defaults to false; existing settings.json files need no changes.

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

Co-Authored-By: Claude Fable 5 [email protected]

AlexAlves87 and others added 2 commits July 13, 2026 22:20
The pipeline handler branch of system.run returned a typed error for
every result, including Allow, so no command could ever execute through
the new path. When the handler approves, SystemCapability now runs the
approved payload directly: the validated argv reaches the process
without a shell re-parsing it and nothing is re-derived from the raw
request, so what was approved is exactly what executes. Non-allow
results keep returning typed errors and never fall back to the legacy
path. The success response mirrors the legacy shape.

The structural guard asserting SetV2Handler is never called from
production sources gives way to behavioral tests covering the bridge:
allow executes the approved argv verbatim, legacy fields do not travel,
a missing runner and a throwing runner return typed errors, and denies
never invoke the runner.

Co-Authored-By: Claude Fable 5 <[email protected]>
Adds ExecApprovalsNewPathEnabled (default false, no Settings UI yet;
enabled by editing settings.json) and wires ExecApprovalsCoordinator
into SystemCapability from NodeService when the flag is on. With the
flag off, not a single line of behavior changes.

The handler is built once per NodeService lifetime and reused across
capability rebuilds: the coordinator serializes approvals with a
per-instance semaphore, so a fresh instance per rebuild would let an
in-flight approval on the old instance overlap with one on the new
instance and race writes to the approvals store on reconnects.

Fail closed: if coordinator construction fails while the flag is on,
the null handler is wired instead, so every request gets a typed
unavailable deny rather than silently falling back to the legacy path.
The approval prompt UI is not wired yet; prompt-required decisions
resolve through the store's ask fallback, and with no store file the
pipeline default-denies everything.

The structural guards asserting the coordinator and null prompt handler
are never referenced from production sources are removed: that wiring
now exists by design and is covered by behavioral tests.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 13, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 4:06 AM ET / 08:06 UTC.

Summary
The branch executes coordinator-approved direct argv, wires the exec-approvals coordinator behind a persisted default-off setting, and rejects V2 requests before evaluation when active MXC cannot transport direct argv.

Reproducibility: not applicable. as a bug reproduction because this PR adds a new opt-in execution mode. The contributor nevertheless supplies a high-confidence live procedure for the proposed legacy, deny, allow, rollback, and active-MXC gate states.

Review metrics: 2 noteworthy metrics.

  • Patch scope: 11 files; +606/-47. The change is bounded but crosses command execution, persisted settings, tray composition, MXC transport policy, and security-focused tests.
  • Runtime coverage: 5 live states plus 2 MXC E2E proofs. The supplied evidence covers legacy behavior, deny, allow, rollback, the current-head active-MXC gate, real gateway execution, and sandbox write blocking.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] An operator who enables the preview while the default sandbox is enabled and available will make every V2 system.run request return typed unavailability until they disable the preview or change the sandbox posture.
  • [P1] The preview has no Settings or prompt UI, so a missing or restrictive approvals store can deny all opted-in commands and recovery requires manual settings or policy-file changes plus restart.
  • [P1] This introduces an alternate command-authorization path; broader exposure before direct-argv sandbox transport and interactive recovery exist could pressure operators toward a less-contained host execution posture.

Maintainer options:

  1. Accept the guarded preview boundary (recommended)
    Merge only after explicitly accepting that opted-in active-MXC requests fail closed and that configuration and recovery remain manual.
  2. Pause for sandbox and approval UX completion
    Keep the PR open until approved argv can remain sandboxed and operators have interactive prompting and visible recovery controls.

Next step before merge

  • [P2] A maintainer must accept or defer the hidden preview and active-MXC rollout boundary; there is no remaining mechanical defect for an automated repair worker.

Maintainer decision needed

  • Question: Should this release include the manually configured, default-off exec-approvals preview even though active MXC intentionally makes the preview unavailable and interactive prompt and Settings UI support are not yet present?
  • Rationale: The patch and current-head proof establish fail-closed behavior, but automated review cannot decide whether this temporary operator experience and alternate command-authorization boundary match the intended rollout policy.
  • Likely owner: shanselman — Their prior system.run security-policy work and review involvement make them the strongest available owner for the rollout boundary.
  • Options:
    • Approve guarded preview (recommended): Ship the hidden default-off setting for advanced operators, retain the fail-closed MXC gate, and track transport and UI completion separately.
    • Wait for complete workflow: Hold the PR until direct-argv sandbox transport, interactive prompting, discoverable configuration, diagnostics, and in-product recovery can ship together.

Security
Cleared: No concrete authorization bypass or supply-chain regression is visible: the preview is default-off, fails closed, preserves the sandbox boundary, avoids shell re-parsing, and runs only the approved payload.

Review details

Best possible solution:

Approve the hidden preview only as an explicitly supported advanced rollout, then add direct-argv MXC transport plus discoverable prompt, diagnostics, and recovery UI before broader or default enablement.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction because this PR adds a new opt-in execution mode. The contributor nevertheless supplies a high-confidence live procedure for the proposed legacy, deny, allow, rollback, and active-MXC gate states.

Is this the best way to solve the issue?

Yes technically: executing only the validated approved payload behind a default-off flag, with an up-front fail-closed transport gate, is a narrow safe activation path. Whether the incomplete operator experience should ship is a maintainer product and security-rollout decision.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9fb1960ec434.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Redacted live output demonstrates the current-head active-MXC fail-closed gate, while the earlier live allow, deny, and rollback transcript plus rerun gateway/MXC proofs cover the remaining changed behavior.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Redacted live output demonstrates the current-head active-MXC fail-closed gate, while the earlier live allow, deny, and rollback transcript plus rerun gateway/MXC proofs cover the remaining changed behavior.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded default-off feature with strong validation and a limited advanced-operator blast radius, not an active regression or emergency.
  • merge-risk: 🚨 security-boundary: Merging adds an alternate local authorization and execution route for Windows node commands when the persisted preview setting is enabled.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Redacted live output demonstrates the current-head active-MXC fail-closed gate, while the earlier live allow, deny, and rollback transcript plus rerun gateway/MXC proofs cover the remaining changed behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. Redacted live output demonstrates the current-head active-MXC fail-closed gate, while the earlier live allow, deny, and rollback transcript plus rerun gateway/MXC proofs cover the remaining changed behavior.
Evidence reviewed

What I checked:

  • Approved payload execution: On an allow result, SystemCapability submits only the coordinator-produced argv, cwd, timeout, and sanitized environment to the command runner; non-allow outcomes remain terminal typed errors without legacy fallback. (src/OpenClaw.Shared/Capabilities/SystemCapability.cs:324, 83a8b8af37e4)
  • Default-off production wiring: NodeService constructs and reuses the V2 coordinator only when ExecApprovalsNewPathEnabled is true, while the persisted setting defaults to false and has no Settings UI. (src/OpenClaw.Tray.WinUI/Services/NodeService.cs:339, 83a8b8af37e4)
  • MXC transport gate: MxcCommandRunner reports direct argv unsupported only when the sandbox is enabled and available, causing SystemCapability to return typed unavailability before approval evaluation rather than bypassing the sandbox. (src/OpenClaw.Shared/Mxc/MxcCommandRunner.cs:79, 83a8b8af37e4)
  • Focused regression coverage: The branch covers allow-to-execute payload fidelity, deny/cancel/timeout non-execution, the sandbox availability matrix, strict fallback, and availability changes between probing and execution. (tests/OpenClaw.Shared.Tests/ExecApprovalV2RoutingTests.cs:360, 83a8b8af37e4)
  • Current-head real behavior proof: The updated PR body includes redacted current-head live output showing V2 with active MXC returns typed unavailability before evaluation, alongside live legacy, deny, allow, rollback, and rerun gateway-to-MXC evidence. (83a8b8af37e4)
  • Maintainer review boundary: The requested review explicitly allowed the interim fail-closed MXC gate while prohibiting sandbox disablement or bypass; the implementation follows that direction, leaving rollout acceptance rather than a mechanical defect. (src/OpenClaw.Shared/SettingsData.cs:175, 83a8b8af37e4)

Likely related people:

  • AlexAlves87: Prior merged work introduced structural system.run approval validation, giving this contributor relevant history beyond proposing this PR. (role: exec-approvals feature contributor; confidence: high; commits: b0aa479; files: src/OpenClaw.Shared/ExecApprovals/ExecApprovalsCoordinator.cs, src/OpenClaw.Shared/Capabilities/SystemCapability.cs)
  • shanselman: Earlier merged work addressed ExecApprovalPolicy security behavior, and the review history connects this person to the system.run authorization boundary. (role: security-policy contributor and rollout reviewer; confidence: medium; files: src/OpenClaw.Shared/Capabilities/SystemCapability.cs, src/OpenClaw.Shared/ExecApprovals)
  • bkudiess: They were specifically requested to review the exec-approval and sandbox boundary after the compatibility concern was raised. (role: requested security-boundary reviewer; confidence: medium; files: src/OpenClaw.Shared/Mxc/MxcCommandRunner.cs, src/OpenClaw.Shared/Capabilities/SystemCapability.cs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (6 earlier review cycles)
  • reviewed 2026-07-13T22:41:31.259Z sha 04c87c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-13T23:00:03.408Z sha 04c87c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-13T23:06:16.542Z sha 04c87c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-16T03:31:22.610Z sha 04c87c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T06:59:37.670Z sha 83a8b8a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T07:42:11.610Z sha 83a8b8a :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 13, 2026
@AlexAlves87

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@AlexAlves87

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 16, 2026
@shanselman
shanselman requested a review from bkudiess July 17, 2026 01:27
@shanselman

Copy link
Copy Markdown
Collaborator

GitHub Copilot maintainer-assistant review — this is automated feedback, not a comment written personally by Scott.

Reviewed head: 04c87c6e9adb27f42124035f348ff405fa3620e7

@bkudiess has been requested as a reviewer because this changes the exec-approval/sandbox boundary.

The adversarial reviews agreed on one merge blocker: the new V2 allow path produces a direct-argv CommandRequest, while MxcCommandRunner explicitly rejects direct argv when the sandbox is available. Since SystemRunSandboxEnabled is default-on, an operator who opts into ExecApprovalsNewPathEnabled on an MXC-capable host can approve a command that then cannot execute. This is fail-closed, so it is not an approval bypass, but it makes the opt-in path functionally incompatible with the default security posture.

Please resolve this before merge using one of these safe approaches:

  1. Preferred: add direct-argv transport support to the sandbox path while preserving the coordinator-produced argv/env/cwd/timeout without rebuilding a shell command; or
  2. Interim: hard-gate the V2 path when sandbox execution is enabled/available, returning a specific typed error that explains the incompatibility and documenting the flag matrix.

Please do not silently disable or bypass the sandbox when V2 is enabled.

The validation matrix should exercise the flag, not only fake runners:

  • V2 on + sandbox available/enabled;
  • V2 on + sandbox unavailable + fallback allowed;
  • V2 on + sandbox unavailable + strict fallback blocked;
  • deny/cancel/timeout paths never invoke the runner;
  • approved argv/env/cwd/timeout arrive unchanged at the selected runner;
  • restart/persistence behavior for the hidden opt-in setting;
  • real gateway/MXC proof for at least one allow and one deny.

Two smaller robustness items are worth addressing while here:

  • a coordinator construction failure currently caches the null handler for the process lifetime; consider controlled retry rather than making a transient initialization fault sticky until restart;
  • document the intentional V2+sandbox behavior in the setting/property comments so operators and future reviewers do not infer an unsupported combination.

The default-off wiring, fail-closed construction behavior, kill switch, approved-payload defensive copies, and legacy isolation all looked sound. The request is to close the default-sandbox compatibility gap, not to redesign the approval pipeline.

…ved argv

The new approvals path executes an allow as a direct argv. The sandbox
transport cannot carry that form yet, so a command approved while the
sandbox is enabled and available would fail closed at execution. Probe the
runner's transport capability up front and return a typed unavailable error
before evaluation, so nothing is approved that cannot execute. The sandbox is
never bypassed or disabled: the gate only fires where the sandbox would run
the request, and every other flag combination (sandbox off, or enabled but
unavailable) keeps executing the approved argv on the host it already used.

Also make a failed coordinator construction non-sticky so a transient
initialization fault is retried on the next capability rebuild instead of
pinning the fail-closed handler until restart, and document the intentional
flag matrix on the setting.

Co-Authored-By: Claude Fable 5 <[email protected]>
@AlexAlves87

AlexAlves87 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Pushed 83a8b8a addressing the review: the sandbox compatibility blocker and the two robustness notes.

Sandbox compatibility gap (blocker). Took the interim option: hard-gate the new path when sandbox execution is enabled and available, rather than teaching the sandbox transport to carry direct argv. Direct-argv transport for the sandbox binary is a separate, security-sensitive change and belongs in its own PR; folding it in here would hide it behind this smaller wiring change.

The gate is a small transport-capability probe (IDirectArgvSupportAwareCommandRunner.CanExecuteDirectArgv()). MxcCommandRunner reports it cannot execute direct argv only when the sandbox is enabled and available — the one state where an approved command would otherwise reach MXC and fail closed. In that state SystemCapability returns a typed unavailable error before evaluation, so nothing is approved that cannot execute. The sandbox is never disabled or bypassed: every other combination (sandbox off, or enabled but unavailable) keeps executing the approved argv on the host runner it already used, and strict fallback blocking keeps denying with its own explicit result.

Coordinator retry. A failed coordinator construction is no longer cached: only a real coordinator is stored, so a transient initialization fault is retried on the next capability rebuild instead of pinning the fail-closed handler until restart. It stays fail-closed for that rebuild (null handler → typed unavailable deny).

Flag matrix documentation. The intentional sandbox/new-path interaction is now documented on the setting property.

Validation matrix (exercises the flag, not only fake runners):

  • new path on + sandbox enabled/available → typed unavailable before any evaluation; neither handler, sandbox executor, nor host fallback is invoked;
  • new path on + sandbox unavailable + fallback allowed → approved argv executes on the host with argv/env/cwd/timeout intact;
  • new path on + sandbox unavailable + strict blocking → denied by the sandbox settings, nothing executes;
  • new path on + sandbox disabled → approved argv executes on the host;
  • deny/cancel/timeout never invoke any runner;
  • approved argv/env/cwd/timeout arrive unchanged at the selected runner;
  • availability flip between the up-front probe and execution stays fail-closed in both directions (becomes available → sandbox blocks the argv, no host escape; drops to unavailable → host runs the same approved argv);
  • a runner without the transport contract is never gated.

Real gateway/MXC proof was re-run on this host against the new commit: RealGateway_SystemRun_ExecutesThroughWindowsNodeMxcSandbox and RealGateway_SystemRun_BlocksWritesToTrayDataDirectoryInMxcSandbox both pass (2/2). Shared and tray unit suites are green.

@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. proof: sufficient Contributor real behavior proof is sufficient. 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. and removed proof: sufficient Contributor real behavior proof is sufficient. 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. 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. labels Jul 17, 2026
@shanselman

Copy link
Copy Markdown
Collaborator

GitHub Copilot maintainer-assistant reminder — automated, not written personally by Scott.

@bkudiess, friendly ping when you have a moment: #985’s latest head addresses the V2 approvals + MXC sandbox compatibility blocker with a fail-closed gate, default-off rollout, real SystemCapability/MxcCommandRunner routing tests, TOCTOU coverage, and green CI.

Your security-boundary review is the remaining requested gate. The specific question is whether the hidden opt-in rollout and sandbox/direct-argv gating preserve the intended system.run security posture. No urgency implied—just surfacing it again because the PR is otherwise technically ready.

@shanselman

Copy link
Copy Markdown
Collaborator

Maintainer-assistant merge validation (2026-07-20, current main 93b645c)

Check Result
Merge with current main ✅ Clean — no conflicts (auto-merged 3 overlapping files)
\�uild.ps1\ ✅ All 5 projects
Shared.Tests ✅ 2950 passed, 31 skipped
Tray.Tests ✅ 1834 passed
WinNode.Cli.Tests ✅ 126 passed
Connection.Tests ✅ 446 passed
Focused V2 tests ✅ 176 passed, 6 skipped (ExecApprovalV2Routing + Coordinator + MxcCommandRunner + PromptAdapter)
Security specialist review ✅ No vulnerabilities — no approval bypass, no sandbox bypass, no silent fallback, TOCTOU mitigated
CI (head \83a8b8a) ✅ build win-x64/arm64, test, E2E (setup-connect, network-recovery, revocation-recovery)
PR mergeability ✅ \mergeable=true, \mergeable_state=clean\
MXC E2E (local) ⚠️ Blocked — WSL2 gateway health-check failure on this host (3 attempts, 3 different ports/distros, same curl timeout). Infrastructure issue unrelated to PR code.

MXC E2E blocker attribution: The gateway binary inside freshly provisioned E2E WSL distros fails its own startup health-check and exits with status 78 (EADDRINUSE after self-race). Three independent runs (ports 61112, 61377, 60491; distros \d174009e, \1e71e056, \65331a70) all reproduced the same failure pattern. No external process occupied the ports — verified via \Get-NetTCPConnection\ and \ss -ltnp\ before each attempt. The prior clean MXC E2E run (2026-07-17 against \83a8b8a) remains valid: same code, and merged main commits don't touch gateway/MXC/networking.

Confidence: The V2 pipeline is ready to merge. The code is fail-closed everywhere, the security boundary is sound (independent specialist review), CI E2E passes, all 5576 unit/integration tests pass on current main, and the merge is clean. The local MXC E2E blocker is an environment issue that's been seen before and clears with host reboot or Docker Desktop state changes.

@shanselman
shanselman merged commit 6c54e5e into openclaw:main Jul 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants