Skip to content

fix: allow Gateway setup under AllSigned - #2370

Merged
bkudiess merged 3 commits into
openclaw:mainfrom
shanselman:fix-allsigned-gateway-cleanup
Nov 25, 2026
Merged

bkudiess merged 3 commits into
openclaw:mainfrom
shanselman:fix-allsigned-gateway-cleanup

Conversation

@shanselman

Copy link
Copy Markdown
Collaborator

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 789cae8bce57681649d5afe405899fb714908c8f

Dimension Assessment Rationale
Change confidence 8/10 ↑ Build and all three required suites pass; final independent review found no blocking findings.
↓ No AllSigned-GPO host or interactive UI proof; a stale-receipt edge remains under repeated reconciliation failure.
Diagnosis confidence 9/10 ↑ Issue #2361 reports AllSigned GPO blocking setup; source confirms the cleanup-script policy probe is the setup blocker.
↓ No live reproduction on a managed AllSigned host.
Evidence fit 8/10 ↑ Change targets policy-blocked cleanup during Gateway setup and gives route-specific manual-removal guidance.
↓ The reported environment and visible warning were not reproduced live.

Closes #2361

What Problem This Solves

On machines managed by an AllSigned Group Policy, unsigned cleanup scripts cannot run, so Gateway setup can fail even though the Gateway itself is available. This blocks users who need to keep strict PowerShell policy from completing setup.

User Impact

Users can complete setup without weakening PowerShell policy. If automatic Gateway cleanup is unavailable, Companion gives route-specific instructions for removing the WSL or Store Gateway manually.

Why This Change Was Made

Only policy/probe failures and the explicit cleanup-task-unavailable result are treated as optional; ownership and other registration failures still fail setup. Preservation intent is stored separately, bound to the exact prior ownership record, and checked by the worker under its lock. No machine policy is changed and no unsigned cleanup script is run to bypass AllSigned.

Evidence

The local build and all required test suites passed. Focused Windows PowerShell tests verify the worker stays gated after a failed preservation write, recovery only disowns the matching owner record, and task disarm does not remove a task while ownership exists. Final independent rubber-duck review found no blocking issues. It noted a non-blocking edge where a stale cleanup receipt could match a later same-name Gateway if reconciliation repeatedly fails.

Required proof pools

  • windows-clean-installer-upgrade: Not verified; no installer/MSIX upgrade run.
  • windows-wsl-gateway-e2e: Not verified; no WSL Gateway E2E run.
  • windows-winui-interactive: Not verified; no interactive UI screenshot or capture.

Validation

  • .\build.ps1 - passed.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore - 5,972 passed, 29 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore - 6,949 passed, 0 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore - 2,674 passed, 4 skipped, 0 failed.
  • git diff --check - passed.

Real Behavior Proof

Not verified / blocked: this host is not configured with AllSigned GPO, and no active setup UI capture was collected. The worker tests execute Windows PowerShell 5.1 against an isolated profile and verify the preservation gate, but they do not prove the full AllSigned-managed setup flow.

Continue setup when PowerShell policy blocks only automatic Gateway cleanup, and provide route-specific manual removal guidance.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codex review: blocked before merge.

What this changes

This PR lets Gateway setup continue when automatic cleanup is blocked and adds manual-removal guidance and preservation recovery.

Example: A packaged Companion installation creates OpenClawGateway while MachinePolicy is AllSigned.

  • Before: The unsigned cleanup script fails registration, causing setup to fail and roll back the distro.
  • After: Setup skips automatic cleanup registration and displays instructions for manually removing the Gateway.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The direction is useful and authorized, but test-only evidence does not establish the changed setup behavior and a concrete ownership-file parsing defect remains.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users with enforced AllSigned policy cannot finish local Gateway setup because optional unsigned cleanup registration fails.
Reason: The report establishes a concrete onboarding failure, and the maintainer-authored PR approves continuing with manual cleanup guidance.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open for repair: its maintainer-approved direction addresses a source-confirmed setup blocker that remains on main.

Reviewed head: 789cae8bce57681649d5afe405899fb714908c8f

Before merge

  • Accept the BOM in PowerShell-created ownership records (P2) - The production Windows PowerShell 5.1 worker writes owned.json with Set-Content -Encoding UTF8, which includes EF BB BF. Both new preservation methods read those raw bytes and reach this byte-span deserializer, which rejects the BOM as invalid JSON. When an existing packaged installation under blocked policy enters Preserve and continue after a reconciliation failure, its valid ownership file is therefore rejected and App's startup error handler exits Companion. The new fixtures use BOM-free File.WriteAllText data and miss this case. Strip the BOM only for parsing, or use BOM-aware decoding, while retaining the original bytes for the ownership fingerprint; cover a file produced in the shipped encoding.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Accept the BOM in PowerShell-created ownership records — src/OpenClaw.SetupEngine/GatewayPackageCleanup.cs:467-468

Tests

  • Low-value test tests/OpenClaw.Tray.Tests/NativeGatewaySetupUxContractTests.cs: Remove the new exact C# assignment-string assertions: they pin implementation spelling without proving warning visibility; retain independently useful XAML and localization checks.
  • Missing end-to-end proof: No current-head packaged AllSigned setup and visible-warning result or latest-stable upgrade/recovery result is supplied, and no failing-base/passing-head regression receipt is shown.
Agent review details

How this fits together

GatewayPackageCleanup coordinates packaged Companion cleanup registration, persisted ownership, and startup reconciliation; setup pages consume its result and display warnings.

flowchart TD
    A[Companion startup or setup] --> B[GatewayPackageCleanup]
    B --> C[PowerShell policy probe]
    C --> D[Cleanup registration or manual removal]
    B --> E[Ownership and preservation files]
    E --> F[Cleanup worker and reconciliation]
    D --> G[Setup warning UI]
Loading

Technical review

Best possible solution:

Keep policy-aware cleanup in the existing owner, accept PowerShell-produced ownership files without changing their fingerprint, and preserve explicit recovery and ownership checks.

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

The linked report provides the enforced-policy trigger, failing command, rollback logs, and matching screenshot; current main retains the responsible registration path, although this review ran no reproduction.

Is this the best way to solve the issue?

Making optional cleanup unavailable without weakening organizational policy is an approved, focused solution, but the new preservation reader must honor the existing producer format.

Full review comments:

  • [P2] Accept the BOM in PowerShell-created ownership records — src/OpenClaw.SetupEngine/GatewayPackageCleanup.cs:467-468
    The production Windows PowerShell 5.1 worker writes owned.json with Set-Content -Encoding UTF8, which includes EF BB BF. Both new preservation methods read those raw bytes and reach this byte-span deserializer, which rejects the BOM as invalid JSON. When an existing packaged installation under blocked policy enters Preserve and continue after a reconciliation failure, its valid ownership file is therefore rejected and App's startup error handler exits Companion. The new fixtures use BOM-free File.WriteAllText data and miss this case. Strip the BOM only for parsing, or use BOM-aware decoding, while retaining the original bytes for the ownership fingerprint; cover a file produced in the shipped encoding.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 17cadf79dbea.

Provenance checked

  • Mandatory cleanup registration and startup preservation changes intended behavior with a stated reason (62752f4: Retire verified Companion-owned Gateways after MSIX uninstall and reconcile removed connection state before reconnecting, while offering explicit preservation.)
  • Cleanup deployment and process execution keeps the original intent (ef1df54: Use a windowless, signed cleanup host to avoid recurring console flashes while preserving current-user cleanup semantics.)
  • WSL creation and rollback authority keeps the original intent (431bd8f: Prevent failed setup from unregistering a pre-existing distro or inheriting cleanup authority from a prior execution.)
  • Setup presentation keeps the original intent (d8e458d: Restyle the existing setup flow while preserving page behavior and accessible warning announcements.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --filter FullyQualifiedName~GatewayPackageCleanupTests
  • ./build.ps1
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore

What I checked:

Likely related people:

  • Joel: Raw commit 62752f4 adds src/OpenClaw.SetupEngine/GatewayPackageCleanup.ps1:140 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 62752f44cda2; files: src/OpenClaw.SetupEngine/GatewayPackageCleanup.ps1)
  • Paul Campbell: Raw commit ef1df54 adds src/OpenClaw.SetupEngine/GatewayPackageCleanup.cs:89 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ef1df54dfe95; files: src/OpenClaw.SetupEngine/GatewayPackageCleanup.cs)
  • Scott Hanselman: Raw commit 787db18 adds src/OpenClaw.SetupEngine/CreateWslInstanceStep.cs:57 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 787db18f3874; files: src/OpenClaw.SetupEngine/CreateWslInstanceStep.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Change size Production +516/-34; tests +291/-1; documentation +20/-6 Most production growth implements cleanup-policy and preservation recovery, making compatibility with existing ownership files a central review concern.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Existing PowerShell-generated owned.json files cannot be consumed by the new preservation reader, so recovery can prevent an upgraded Companion from starting.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • merge-risk: 🚨 compatibility: Existing PowerShell-generated owned.json files cannot be consumed by the new preservation reader, so recovery can prevent an upgraded Companion from starting.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 24, 2026, 7:23 PM ET / November 25, 2026, 00:23 UTC.

…-registration fallback docs

Windows PowerShell 5.1 writes owned.json with a UTF-8 BOM. Skip one
optional BOM when parsing the ownership record, while keeping the
SHA-256 ownership fingerprint over the original file bytes.

Document that a Task Scheduler registration failure also lets setup
continue, and that a retry needs owned.json and a permitting policy.

Co-authored-by: Copilot App <[email protected]>
@bkudiess
bkudiess merged commit dc45914 into openclaw:main Nov 25, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't set up OpenClaw with "AllSigned" GPO.

2 participants