Skip to content

fix(gateway): support native Windows exec approvals#101669

Merged
steipete merged 3 commits into
mainfrom
codex/replay-88163-windows-approvals
Jul 7, 2026
Merged

fix(gateway): support native Windows exec approvals#101669
steipete merged 3 commits into
mainfrom
codex/replay-88163-windows-approvals

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The released Windows companion returns a host-native exec-approval policy from system.execApprovals.get and accepts that policy on system.execApprovals.set. OpenClaw's dedicated exec.approvals.node.* path assumed every node used the OpenClaw approvals-file shape, so Windows policy reads, writes, and Control UI rendering were incorrect.

Closes the surviving approvals slice of #88163.

Why This Change Was Made

  • add a node-specific protocol snapshot that accepts either the existing file-backed shape or the shipped Windows-native shape without weakening the existing gateway snapshot contract
  • validate node snapshots at the Gateway boundary before CLI or Control UI consumes them
  • relay native writes without translating them into an approvals file, require the current hash, and require an explicit full rule list because the Windows setter replaces all rules
  • expose native policy get/set in the CLI; keep Control UI native policies read-only
  • preserve generated Swift protocol models and document the two policy shapes

The remaining #88163 changes are intentionally excluded: loopback auth, command exposure, raw invoke blocking, build tooling, and pairing behavior have either landed independently or changed architecture on current main.

User Impact

Windows companion nodes can be inspected with openclaw approvals get --node ... and updated with openclaw approvals set --node .... Concurrent writes are hash-guarded. Control UI displays the native policy without offering the incompatible approvals-file editor. Existing file-backed gateway, macOS, and headless-node behavior remains unchanged.

Evidence

  • released Windows contract inspected at openclaw-windows-node v0.6.12: get and constraints, hash-guarded replacement set, and canonical rules/actions
  • Blacksmith Testbox run 28866599783: focused protocol, Gateway, CLI, and UI suite; 45 tests passed across four Vitest shards
  • Blacksmith Testbox: tsgo:core, tsgo:core:test, tsgo:test:packages, and tsgo:test:ui passed
  • protocol and Swift generators rerun; generated Swift output byte-stable
  • oxfmt --check on all touched TypeScript/Markdown and git diff --check passed
  • exact-current autoreview completed before commit

Proof gap: no active Windows Crabbox/pond lease was available for a fresh native Windows run. This change is therefore proved against the released companion source contract plus exact Gateway/CLI/UI integration tests, not a new physical Windows session.

@steipete
steipete requested a review from a team as a code owner July 7, 2026 12:53
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Jul 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e2551a0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +89
shells: Type.Optional(Type.Array(NonEmptyString)),
description: Type.Optional(Type.String()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow null native rule metadata from Windows nodes

When a Windows native rule has no shell filter or description, the released companion's rule model represents those as nullable Shells/Description and system.execApprovals.get copies them into shells/description for each returned rule. This validator only accepts arrays/strings, so ordinary Windows policies with rules like hostname can be rejected at the gateway as “node returned invalid exec approvals payload” instead of rendering in the CLI/UI. Please allow or normalize null for these optional native fields before validating.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 9:23 AM ET / 13:23 UTC.

Summary
The PR adds native Windows exec approval snapshot and write support across the gateway protocol, gateway handlers, CLI, Control UI, generated Swift models, tests, and docs.

PR surface: Source +466, Tests +385, Docs +18, Other +54. Total +923 across 16 files.

Reproducibility: yes. source-reproducible: the released Windows companion returns nullable shells/description fields for ordinary rules, while the PR schema only accepts arrays/strings before the gateway forwards data to CLI/UI consumers. I did not run a live Windows companion session in this review.

Review metrics: 1 noteworthy metric.

  • Gateway protocol approval shapes: 1 node snapshot schema added, 1 node set payload widened. These are compatibility-sensitive protocol surfaces consumed by the gateway, CLI, Control UI, generated Swift models, and companion nodes.

Stored data model
Persistent data-model change detected: unknown-data-model-change: packages/gateway-protocol/src/schema/exec-approvals.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🧂 unranked krab
Result: blocked until stronger real behavior proof is added.

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

Rank-up moves:

  • Accept or normalize null native rule metadata and cover it in protocol, gateway, CLI, and UI tests.
  • [P1] Add current-head Windows companion proof for approvals get and set using redacted terminal output or logs.
  • [P1] Re-run the focused gateway protocol, gateway handler, CLI, and UI approval tests after the fix.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes source-contract inspection, CI/Testbox results, and an explicit proof gap, but no current-head native Windows companion run showing the real get/set behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Current head can still reject released Windows native policy snapshots when a rule has null shells or description, returning "node returned invalid exec approvals payload" instead of rendering approvals in the CLI or Control UI.
  • [P1] The PR changes a compatibility-sensitive gateway protocol and remote exec approval write path; green CI does not replace current-head native Windows proof for the actual companion behavior.

Maintainer options:

  1. Fix nullable Windows metadata before merge (recommended)
    Allow or normalize null shells and description on native rules, then add regression coverage using the released Windows payload shape.
  2. Require native Windows proof
    Hold merge until a current-head Windows companion run shows approvals get and set through the CLI or gateway with redacted terminal/log output.
  3. Accept source-contract-only proof
    Maintainers could intentionally merge with source-contract and Testbox proof only, but that leaves the native Windows runtime path unproven on this head.

Next step before merge

  • [P1] The remaining blockers require contributor or maintainer follow-up because real Windows proof is missing and automation cannot provide the contributor's native setup evidence.

Security
Cleared: No concrete security or supply-chain regression was found; the native write path remains base-hash guarded and the Windows companion remains the policy validation authority.

Review findings

  • [P1] Accept nullable native rule metadata — packages/gateway-protocol/src/schema/exec-approvals.ts:88-89
Review details

Best possible solution:

Keep the native/file-backed split, but normalize or accept null optional native rule metadata at the protocol boundary, cover that exact Windows payload in protocol/gateway/CLI/UI tests, and add current-head Windows get/set proof before merge.

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

Yes, source-reproducible: the released Windows companion returns nullable shells/description fields for ordinary rules, while the PR schema only accepts arrays/strings before the gateway forwards data to CLI/UI consumers. I did not run a live Windows companion session in this review.

Is this the best way to solve the issue?

No, not yet: the owner-boundary choice is good, but the patch must accept or normalize the released Windows null metadata shape before it is the best fix.

Full review comments:

  • [P1] Accept nullable native rule metadata — packages/gateway-protocol/src/schema/exec-approvals.ts:88-89
    The released Windows companion builds each native rule with shells = r.Shells and description = r.Description, and those properties are nullable when a rule applies to all shells or has no description. This schema rejects explicit null for both fields, so an ordinary Windows policy can fail gateway validation as node returned invalid exec approvals payload before the CLI or Control UI can display it. Please accept or normalize null optional metadata and add a fixture that includes it.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a bounded Windows node approvals interoperability fix with a concrete blocker, not a whole-runtime outage.
  • add merge-risk: 🚨 compatibility: The PR changes gateway protocol validation and node approval payload shapes that existing node hosts and generated clients must parse consistently.
  • add merge-risk: 🚨 security-boundary: The PR changes remote exec approval policy reads and writes, which are part of the command execution approval boundary.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes source-contract inspection, CI/Testbox results, and an explicit proof gap, but no current-head native Windows companion run showing the real get/set behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded Windows node approvals interoperability fix with a concrete blocker, not a whole-runtime outage.
  • merge-risk: 🚨 compatibility: The PR changes gateway protocol validation and node approval payload shapes that existing node hosts and generated clients must parse consistently.
  • merge-risk: 🚨 security-boundary: The PR changes remote exec approval policy reads and writes, which are part of the command execution approval boundary.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes source-contract inspection, CI/Testbox results, and an explicit proof gap, but no current-head native Windows companion run showing the real get/set behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +466, Tests +385, Docs +18, Other +54. Total +923 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 8 510 44 +466
Tests 5 388 3 +385
Docs 2 21 3 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 1 56 2 +54
Total 16 975 52 +923

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the original exec approvals tooling commit 3686bde and the recent merged node exec approvals command advertisement PR that touched the same gateway handler. (role: introduced behavior and recent area contributor; confidence: high; commits: 3686bde783fd, 865b8dbd5350; files: src/cli/exec-approvals-cli.ts, src/gateway/server-methods/exec-approvals.ts, docs/cli/approvals.md)
  • vincentkoc: Vincent Koc owns the broader Windows node pairing and approvals PR and merged a recent exec approvals gateway persistence fix in the same server-methods area. (role: adjacent owner; confidence: medium; commits: 568c7c729aeb, 9cdcb9c1acf3; files: src/gateway/server-methods/exec-approvals.ts, packages/gateway-protocol/src/schema/exec-approvals.ts, ui/src/lib/nodes/index.ts)
  • Takhoffman: Tak Hoffman authored and merged the local exec-policy CLI/docs work that established the approvals CLI and documentation surface this PR extends. (role: feature origin contributor; confidence: medium; commits: fe0cd124ef26, 90e86157af12; files: docs/cli/approvals.md, docs/tools/exec-approvals.md, src/infra/exec-approvals.ts)
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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 7, 2026
@steipete
steipete force-pushed the codex/replay-88163-windows-approvals branch from 732f41c to ce5656d Compare July 7, 2026 13:38
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for ce5656d5ca907f5b5cb6a3f8c29797678e1e13b5:

Known proof gap: no active Windows Crabbox/pond lease was available. The transport fix is therefore proved against released Windows source plus exact protocol/Gateway/CLI/UI integration tests, not a fresh physical Windows session.

@steipete
steipete merged commit a7faec8 into main Jul 7, 2026
102 checks passed
@steipete
steipete deleted the codex/replay-88163-windows-approvals branch July 7, 2026 13:51
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 8, 2026
* fix(gateway): support native Windows exec approvals

Co-authored-by: Vincent Koc <[email protected]>

* chore: defer changelog entry to release

* test: use tracked approvals temp directories

---------

Co-authored-by: Vincent Koc <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* fix(gateway): support native Windows exec approvals

Co-authored-by: Vincent Koc <[email protected]>

* chore: defer changelog entry to release

* test: use tracked approvals temp directories

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL 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.

1 participant