Skip to content

Redesign local gateway setup as out-of-process SetupEngine#529

Draft
ranjeshj wants to merge 26 commits into
openclaw:masterfrom
ranjeshj:user/ranjeshj/setupenginefortest2
Draft

Redesign local gateway setup as out-of-process SetupEngine#529
ranjeshj wants to merge 26 commits into
openclaw:masterfrom
ranjeshj:user/ranjeshj/setupenginefortest2

Conversation

@ranjeshj
Copy link
Copy Markdown
Contributor

@ranjeshj ranjeshj commented May 23, 2026

Redesign local gateway setup as out-of-process SetupEngine

Problem

The previous onboarding/setup flow was tightly coupled to the tray app, making it hard to test, debug, and maintain. The in-process LocalGatewaySetup class was ~4000 lines with mixed concerns (WSL management, gateway config, UI state, approval flows).

Solution

Replace the monolithic in-process setup with a standalone SetupEngine — a config-driven, transactional pipeline that runs as a separate process (SetupEngine.UI). The tray app launches it and receives results via deep-link protocol.

Architecture

  • OpenClaw.SetupEngine — CLI/library with 17 pipeline steps, transaction journal for rollback, retry executor, and structured logging
  • OpenClaw.SetupEngine.UI — WinUI3 app with fluent wizard flow (Welcome → Capabilities → Permissions → Progress → Complete)
  • Config-drivendefault-config.json defines capabilities, WSL distro settings, gateway config; no hardcoded defaults
  • Transactional — journal tracks completed steps; rollback undoes in reverse order on failure

Key changes

New projects:

  • src/OpenClaw.SetupEngine/ — pipeline engine (SetupPipeline, SetupSteps, CommandRunner, RetryExecutor, TransactionJournal)
  • src/OpenClaw.SetupEngine.UI/ — WinUI wizard (6 pages, launched by tray)
  • tests/OpenClaw.SetupEngine.Tests/ — 66 unit tests
  • tests/OpenClaw.E2ETests/ — end-to-end setup test via MCP

Removed (~10,400 lines):

  • src/OpenClawTray.OnboardingV2/ — old V2 onboarding app
  • src/OpenClaw.Tray.WinUI/Onboarding/ — old in-process wizard, services, flow controller
  • src/OpenClaw.Tray.WinUI/Services/LocalGatewaySetup/ — monolithic setup (~5,800 lines)
  • tests/OpenClawTray.OnboardingV2.Tests/ — empty placeholder project
  • Related tray tests (~4,600 lines of tests for removed code)

Modified:

  • src/OpenClaw.Tray.WinUI/App.xaml.cs — launch SetupEngine.UI instead of in-process onboarding
  • src/OpenClaw.Tray.WinUI/Services/StartupSetupState.cs — detect setup-state from SetupEngine
  • .github/workflows/ci.yml — add SetupEngine tests, E2E job, replace OnboardingV2

Reliability hardening (Hanselman dual-model review)

Adversarial review with Claude Opus + GPT Codex identified 18 issues; 12 fixed:

  • HIGH consensus: RetryExecutor exception handling, CommandRunner Win32Exception, shell injection in ExtraConfig
  • LOW consensus: CancellationToken in finally, journal IOException, stale state cleanup, null token fallback, event handler leak, VHD delete retry, keepalive redirect, cleanup on cancel

Test coverage

Suite Tests
SetupEngine unit 66
Shared 1,936
Tray 791
E2E (setup+connect) 1
Total 2,794

E2E validated 5 consecutive runs, avg 153s, no flakiness.

@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

Codex review: needs real behavior proof before merge. Reviewed May 24, 2026, 8:16 PM ET / 00:16 UTC.

Summary
The PR replaces the tray-hosted local WSL gateway onboarding/setup flow with standalone SetupEngine and SetupEngine.UI projects, rewires tray launch/uninstall/build/CI paths, and removes the old onboarding/local setup implementation.

Reproducibility: yes. for the review findings by source inspection: PR head still uses --page connection, hard-codes replacement setup UI text, and interpolates partially sanitized ExtraConfig keys into bash. I did not run the Windows/WSL setup flow in this read-only review.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until 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:

  • Add redacted real Windows/WSL proof for fresh setup, tray reconnect, and uninstall behavior.
  • Fix the Advanced setup route and localization regressions.
  • Harden ExtraConfig key handling and add focused tests for unsafe keys.

Proof guidance:
Needs real behavior proof before merge: No inspectable after-fix proof is attached; the contributor should add redacted terminal output, logs, screenshots, recordings, or linked artifacts for setup/reconnect/uninstall, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.

Mantis proof suggestion
A visible desktop proof would materially help review because the PR replaces the setup wizard and tray handoff flow. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify SetupEngine.UI Advanced setup opens the tray Connections page and a successful local setup reaches the Complete page with the tray reconnecting.

Risk before merge

  • Existing users can lose the setup escape hatch because Advanced setup still uses an unsupported --page connection argument instead of a supported tray route.
  • Replacing localized onboarding with hard-coded English SetupEngine.UI strings regresses supported non-English locales unless the new surface is wired to resources.
  • The setup engine runs shell commands and writes gateway credentials/settings, so ExtraConfig key validation and upgrade proof need maintainer attention before merge.
  • The PR replaces a large local setup, uninstall, registry, credential, and keepalive path; green unit tests alone do not prove fresh-install and upgrade behavior on real Windows/WSL hosts.

Maintainer options:

  1. Fix blockers before merge (recommended)
    Repair the Advanced setup route, localize the replacement setup UI, validate ExtraConfig keys safely, and then re-post real Windows/WSL proof for fresh install, reconnect, and uninstall.
  2. Accept as an architecture cutover
    Maintainers may intentionally accept the large setup replacement only after explicitly owning the upgrade behavior and packaging/runtime proof gaps.
  3. Pause for a narrower replacement
    If the setup rewrite remains difficult to prove, pause this branch and land smaller setup-engine slices that preserve the current tray/onboarding contracts.

Next step before merge
Contributor real behavior proof and maintainer architecture/upgrade review are required; automation cannot prove the contributor's Windows setup or decide the setup replacement policy.

Security
Needs attention: The diff is security-sensitive because SetupEngine executes configurable WSL shell commands and one config-key path is not safely constrained.

Review findings

  • [P1] Use a supported route for Advanced setup — src/OpenClaw.SetupEngine.UI/Pages/WelcomePage.xaml.cs:77
  • [P2] Localize the replacement setup UI — src/OpenClaw.SetupEngine.UI/Pages/WelcomePage.xaml:15-21
  • [P2] Validate ExtraConfig keys before shelling out — src/OpenClaw.SetupEngine/SetupSteps.cs:786-787
Review details

Best possible solution:

Keep the PR open, fix the line-level blockers, then require maintainer architecture review plus redacted fresh-install, reconnect, and uninstall proof before merge.

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

Yes for the review findings by source inspection: PR head still uses --page connection, hard-codes replacement setup UI text, and interpolates partially sanitized ExtraConfig keys into bash. I did not run the Windows/WSL setup flow in this read-only review.

Is this the best way to solve the issue?

No. The out-of-process SetupEngine direction may be viable, but this branch needs the supported tray route, localization parity, shell hardening, and real upgrade/fresh-install proof before it is the maintainable replacement.

Full review comments:

  • [P1] Use a supported route for Advanced setup — src/OpenClaw.SetupEngine.UI/Pages/WelcomePage.xaml.cs:77
    Advanced setup starts the tray with --page connection, but the tray only forwards and handles startup args that are openclaw:// deep links. If a tray instance is already running, no navigation is forwarded; if it is not running, the new instance also ignores this arg, so users trying to choose an existing or remote gateway do not reach Connections.
    Confidence: 0.93
  • [P2] Localize the replacement setup UI — src/OpenClaw.SetupEngine.UI/Pages/WelcomePage.xaml:15-21
    This new SetupEngine.UI page hard-codes user-visible English text while replacing the localized onboarding flow. The current onboarding contract requires setup strings to come from the resource pipeline, so supported locales regress unless these strings are moved to resources or an equivalent localization bridge.
    Confidence: 0.9
  • [P2] Validate ExtraConfig keys before shelling out — src/OpenClaw.SetupEngine/SetupSteps.cs:786-787
    Only a few metacharacters are stripped from ExtraConfig keys before interpolating the key into a bash command. Keys containing command substitution, backticks, whitespace, or newlines can still execute or split unexpectedly; restrict keys to a safe config-key pattern or avoid shell interpolation for both key and value.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.88

Codex review notes: model gpt-5.5, reasoning high; reviewed against ef6ac8acbab2.

Label changes

Label changes:

  • add merge-risk: 🚨 security-boundary: The setup engine executes configurable shell commands inside WSL and currently leaves config keys insufficiently validated.
  • remove merge-risk: 🚨 message-delivery: Current PR review merge-risk labels are merge-risk: 🚨 compatibility, merge-risk: 🚨 auth-provider, merge-risk: 🚨 security-boundary.

Label justifications:

  • P1: The PR replaces the core local gateway setup and pairing workflow and still has blockers that can break real user setup paths.
  • merge-risk: 🚨 compatibility: Merging this would replace onboarding, uninstall, settings, keepalive, and packaging behavior for existing local gateway users.
  • merge-risk: 🚨 auth-provider: The diff changes gateway registry records, shared/bootstrap/device-token pairing, and local gateway signature handling.
  • merge-risk: 🚨 security-boundary: The setup engine executes configurable shell commands inside WSL and currently leaves config keys insufficiently validated.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No inspectable after-fix proof is attached; the contributor should add redacted terminal output, logs, screenshots, recordings, or linked artifacts for setup/reconnect/uninstall, then update the PR body to trigger re-review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

Security concerns:

  • [medium] ExtraConfig key injection surface — src/OpenClaw.SetupEngine/SetupSteps.cs:786
    ExtraConfig values are shell-quoted, but keys are interpolated into bash after only removing quotes, semicolons, pipes, and ampersands; command substitution and whitespace remain possible. Validate keys with a strict pattern or avoid shell composition.
    Confidence: 0.84

What I checked:

Likely related people:

  • shanselman: Current-main blame/log route the existing Advanced setup handling, onboarding localization docs, and recent connection-manager changes through Scott Hanselman-authored or merged commits. (role: recent area contributor and merger; confidence: high; commits: c499c294b764, 45dccec60c51; files: src/OpenClaw.Tray.WinUI/Onboarding/OnboardingWindow.cs, docs/ONBOARDING_WIZARD.md, src/OpenClaw.Connection/GatewayConnectionManager.cs)
  • Mike Harsh: Recent current-main commits added easy setup diagnostics, WSL keepalive, and V2 wizard fixes in the local setup/onboarding area this PR replaces. (role: recent local setup contributor; confidence: high; commits: 8446ea552779, 4baf01d768c0, 679f21cea559; files: src/OpenClaw.Tray.WinUI/Services/LocalGatewaySetup/LocalGatewaySetup.cs)
  • ranjeshj: Beyond authoring this PR, Ranjesh has prior merged current-main history in the node pairing and connection area affected by the SetupEngine replacement. (role: adjacent connection and pairing contributor; confidence: medium; commits: 7747e6075052; files: src/OpenClaw.Connection/GatewayConnectionManager.cs, tests/OpenClaw.Tray.Tests)
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.

ranjeshj and others added 14 commits May 23, 2026 10:22
New headless setup engine that installs WSL, configures OpenClaw gateway,
pairs operator/node connections, and verifies end-to-end connectivity.

- Transactional pipeline with retry, rollback, and crash-recovery journal
- Structured JSONL logging with secret redaction
- v2 signature fix for local gateways in GatewayConnectionManager
- All 15 steps working E2E in headless mode

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Configure gateway with bind=lan (0.0.0.0) instead of loopback to avoid
  unreliable WSL2 localhost port forwarding
- Add StartKeepaliveStep (step 16) to keep distro alive after setup
  completes, ensuring tray connects instantly on launch
- Add default-config.json and design doc

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eway config

- Expand SetupConfig with nested WslConfig, GatewayConfig, CapabilitiesConfig,
  TraySettingsConfig, and PairingConfig — zero hardcoded values
- Register node capabilities (stub INodeCapability) before ConnectAsync so
  gateway stores caps/commands from hello message
- Write settings.json after node pairing (EnableNodeMode=true + cap toggles)
  using merge logic that preserves existing user settings
- Make WSL wsl.conf generation config-driven (user, systemd, interop, etc.)
- Make gateway config-driven (bind mode, auth, health timeout, extra config)
- Write keepalive marker file to prevent tray duplicate keepalive
- Add fully commented default-config.json with all configurable properties

Verified: clean build (0 errors/0 warnings), full E2E run in 118s,
tray auto-connects with capabilities registered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds DrainPendingApprovalsAsync to VerifyEndToEndStep that iteratively
approves any remaining pending device or node pairing requests. This
ensures the tray launches with zero 'Pairing approval pending' badges.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Standalone unpackaged WinUI app (no FunctionalUI dependency) with:
- Welcome page with lobster icon, info card, V2 text strings
- Capabilities page with 2-column grid, icons, descriptions, toggles
- Progress page with step groups, badges (spinner/check/error), log viewer
- Complete page with success/error state, launch tray button

Features:
- Mica backdrop + extended title bar
- DPI-aware window sizing (720x700 logical)
- UAC manifest (asInvoker) to avoid elevation prompt
- --headless bypass for automation
- Config-driven defaults from SetupConfig

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Welcome: flex layout, full V2 text, 'Install new WSL Gateway' button,
  confirmation dialog, 'Advanced setup' link (opens tray connection page)
- Title bar: lobster icon + 'OpenClaw Setup' text, 36px height
- Permissions page: 5 rows (notifications, camera, mic, location, screen),
  live status checks, 'Open Settings' buttons, 'Refresh status'
- Complete page: party popper, amber Node Mode banner, startup toggle,
  'Finish' button with tray launch + optional registry startup entry
- Window height increased to 820px for better step row spacing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove all hardcoded defaults from SetupConfig (DistroName, GatewayPort, BaseDistro, etc.)
- Both UI and headless exe now require a config file to run
- UI auto-loads bundled default-config.json from AppContext.BaseDirectory
- Headless Program.cs exits with error if no config found
- Added Content Include in csproj to bundle default-config.json with exe

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- CleanupStaleDistroStep: wsl --shutdown + delete orphaned VHD directory
- CompletePage: show error message + 'View full log' link on failure
- CompletePage: kill old tray, launch via openclaw://chat protocol
- Update SETUP_ENGINE_REDESIGN.md to reflect current implementation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- add interactive gateway wizard rendering for SetupEngine UI
- make wizard messages render links and device codes inline
- refine progress/log layout and setup failure visuals
- fix wizard retry/skip behavior and credential precedence
- harden WSL cleanup, base distro reuse, and missing WSL handling

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add RollbackAsync to 6 SetupEngine steps for --uninstall support
- Add UninstallAsync to SetupPipeline (reverse rollback execution)
- Add --uninstall, --confirm-destructive, --json-output CLI flags
- Replace ShowOnboardingAsync with out-of-process SetupEngine.UI launch
- Rewrite CliUninstallHandler and SettingsPage uninstall to use SetupEngine
- Delete LocalGatewaySetup (4000+ lines), Onboarding, OnboardingV2 projects
- Extract GatewayConnectorInterfaces and WslCommandRunner from deleted code
- Fix StartupSetupState to scan per-gateway dirs for device tokens
- Simplify WSL keepalive to direct wsl process spawn
- Add SetupEngine to build.ps1 with post-build copy to WinUI output
- Set production defaults: DistroName=OpenClawGateway, GatewayPort=18789

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Create tests/OpenClaw.E2ETests/ project with end-to-end tests that exercise
the full setup pipeline headless via SetupEngine CLI, spawn the tray app,
and verify operator+node connectivity through MCP app.status/app.nodes calls.

- E2ESetupFixture: runs Program.Main() headless, patches settings for MCP,
  spawns tray process, polls connection status, cleans up via uninstall
- SetupAndConnectTests: verifies connected state and node capabilities
- McpClient: JSON-RPC client for MCP HTTP server verification
- CI workflow: parallel e2e job with test artifact upload for debugging
- SetupEngine.csproj: add RuntimeIdentifiers for RID-specific test builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hanselman adversarial review (Opus + Codex) identified 18 issues.
Fixed 12 reliability bugs across the setup engine:

HIGH consensus (both models):
- RetryExecutor: wrap action() in try/catch to prevent pipeline crashes
- CommandRunner: catch Win32Exception on process.Start()
- ConfigureGatewayStep: shell-escape ExtraConfig values

Verified LOW consensus:
- TryResetReloadModeAsync: use CancellationToken.None in finally
- TransactionJournal: catch IOException on writes
- CleanupStaleGatewayStep: delete setup-state.json from both AppData and LocalAppData
- AutoApprove: fall back to BootstrapToken when SharedGatewayToken is null
- TrayArtifactCleanup: protect DeleteFileIfExists with try/catch
- StartKeepaliveStep: remove unused stdout/stderr redirect
- PairOperatorStep: unsubscribe DeviceTokenReceived handler
- Program: run TrayArtifactCleanup on Cancelled outcome
- CleanupStaleDistroStep: retry VHD directory deletion with backoff

Added 66 unit tests in new OpenClaw.SetupEngine.Tests project:
- RetryExecutorTests (11), SetupPipelineTests (14),
  TransactionJournalTests (9), SetupLoggerTests (7),
  SetupConfigTests (18), SetupContextTests (7)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ranjeshj ranjeshj force-pushed the user/ranjeshj/setupenginefortest2 branch from ceace09 to 328419f Compare May 23, 2026 17:24
@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. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels May 23, 2026
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

- Replace OnboardingV2.Tests build/run steps with SetupEngine.Tests (66 unit tests)
- Remove empty OnClawTray.OnboardingV2.Tests project (superseded by SetupEngine)
- Drop --no-restore from E2E build step to fix RID-mismatch NETSDK1004

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ranjeshj ranjeshj changed the title fix: setup engine reliability fixes and unit tests Redesign local gateway setup as out-of-process SetupEngine May 23, 2026
ranjeshj and others added 5 commits May 23, 2026 12:26
- Add -r win-x64 to SetupEngine.Tests build (allows implicit restore for RID-specific deps)
- Add -r win-x64 to SetupEngine.Tests run step
- Rename e2e job to e2etests for clarity

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n, release packaging

- CleanupStaleGatewayStep: preserve SSH-tunneled and non-local gateway
  records instead of deleting by URL match alone
- InstallCliStep: validate HTTPS scheme, shell-quote URL, add
  --proto '=https' --tlsv1.2 to curl
- ci.yml: publish SetupEngine.UI into release package
- Add 8 unit tests covering gateway preservation and URL validation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…iagnostics

- Default gateway bind from 'lan' (0.0.0.0) to 'loopback' (127.0.0.1)
- Add ValidateWslLockdownStep: verify user, dirs, ownership after configure
- Replace --token argv with OPENCLAW_GATEWAY_TOKEN env var (9 call sites)
- Add ExistingConfigDetector for dynamic replacement dialog on WelcomePage
- Remove unimplemented OperatorScopes/NodeScopes/CliScopes from PairingConfig
- Add port conflict detection (ss -tlnp) and improved failure diagnostics
- Add RedactTokens helper for log sanitization
- Default SkipPermissions to false, add fallback tray exe path
- Fix docs drift: step count, default claims
- Add UI step group mappings for validate-wsl-lockdown and run-wizard
- 279 new lines of unit tests (lockdown, bind validation, token redaction, etc.)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add setup run locking, append-only recovery journals, atomic persistence, bounded command output and rollback handling, UI cancellation/error guards, wizard loop bounds, isolated local data support, and expanded token redaction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ensure setup runs privileged WSL configuration as root so imported base distros with non-root defaults still configure correctly. Align local AppData override handling across SetupEngine, tray setup detection, keepalive, and e2e isolation, and accept numeric setup-state phases written by the new engine.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman
Copy link
Copy Markdown
Contributor

Pushed a follow-up fix commit: 6e826df.

What changed:

  • Force the privileged WSL configuration step to run as root, so setup works when the exported base distro defaults to a non-root user.
  • Align SetupEngine/tray local AppData override handling (OPENCLAW_TRAY_LOCALAPPDATA_DIR, with the older direct-folder alias still supported).
  • Make tray setup detection accept numeric setup-state.json phases written by SetupEngine.
  • Make WSL keepalive read setup-state from the same resolved local-data path.
  • Isolate E2E AppData, identity, and LocalAppData roots so WSL artifacts and setup-state do not touch the real user profile.

Local validation on ARM64:

  • ./build.ps1 passed
  • Shared tests passed: 1936 passed, 29 skipped
  • Tray tests passed: 793 passed
  • SetupEngine tests passed: 110 passed
  • Full WSL E2E passed: 2 passed, tray connected, uninstall completed
  • WinUI and SetupEngine.UI debug builds passed for both win-x64 and win-arm64

Serialize SetupEngine tests that mutate process-wide environment variables and make the E2E fixture wait until app.nodes reports an online node with capabilities before allowing tests to proceed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 Merging this PR could drop, duplicate, misroute, suppress, or wrongly target messages. and removed merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels May 24, 2026
ranjeshj and others added 5 commits May 24, 2026 16:33
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Focus SetupEngine.UI when launched from the tray and briefly make the setup window topmost so user-initiated setup actions are visible. Reuse the tray icon for the setup app so both companion surfaces share branding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prefer OPENCLAW_TRAY_DATA_DIR for tray identity checks in isolated runs so startup setup detection sees the per-gateway device tokens written by SetupEngine and does not relaunch setup after a successful install.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mark cron loading complete when the gateway returns an empty jobs list, and place the Event Stream empty state in the main content row so the page does not look blank when no agent events have arrived yet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove an invalid x:Uid from the Event Stream clear-button TextBlock. The matching resource includes a Content property, which TextBlock does not support, causing AgentEventsPage to throw during XAML load and making navigation appear to do nothing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. and removed merge-risk: 🚨 message-delivery 🚨 Merging this PR could drop, duplicate, misroute, suppress, or wrongly target messages. labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants