Commit cefce39
Redesign local gateway setup as out-of-process SetupEngine (#529)
* feat: add standalone SetupEngine with transactional pipeline
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>
* fix: gateway bind lan + keepalive step for reliable WSL2 connectivity
- 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>
* feat(setup-engine): config-driven capabilities, settings, and WSL/gateway 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>
* fix(setup-engine): drain pending device/node approvals at end of setup
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>
* chore(setup-engine): remove remote gateway mode (local-wsl only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add SetupEngine WinUI app with fluent onboarding flow
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>
* Polish setup engine UI to match V2 onboarding flow
- 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>
* Require config file — no hardcoded defaults
- 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>
* Fix cleanup, add error UX, launch tray via deep link
- 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 setup engine wizard flow
* Polish setup wizard UI and WSL setup resilience
- 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>
* Replace old onboarding/setup with out-of-process SetupEngine.UI
- 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>
* Add E2E first-time setup CI test
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>
* fix: setup engine reliability fixes and unit tests
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>
* ci: replace OnboardingV2 tests with SetupEngine tests, fix E2E restore
- 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>
* ci: fix SetupEngine.Tests restore and rename e2e job
- 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>
* fix: address ClawSweeper P1 findings — gateway cleanup, URL validation, 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>
* Harden setup engine: WSL lockdown, secure defaults, token handling, diagnostics
- 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>
* Harden setup engine reliability
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>
* Fix setup engine WSL isolation
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>
* Stabilize setup engine CI tests
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>
* Harden setup engine approval and rollback flows
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bring setup window to foreground
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>
* Use isolated identity path for setup detection
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>
* Fix empty cron and event stream states
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>
* Fix event stream page localization crash
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>
* Harden setup engine gateway configuration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix connection dashboard token link
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Improve setup wizard option hints
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Polish setup UI assets and welcome animation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address setup hardening feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Harden setup approval drain
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Harden setup wizard validation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Polish setup progress indicators
Use Fluent icon glyphs for completed and failed setup steps, add a subtle pending indicator, and give the active progress ring enough space to render cleanly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix tray UI test runtime bootstrap
Align the UI test WinAppSDK bootstrap/runtime install with the Microsoft.WindowsAppSDK package version and add fixture startup diagnostics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix WSL keepalive startup
Use the active gateway registry record when deciding whether tray startup should keep the local WSL gateway alive, and add unit and e2e coverage for the keepalive process.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address remaining setup feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Scott Hanselman <scottha@microsoft.com>1 parent ef6ac8a commit cefce39
144 files changed
Lines changed: 12602 additions & 19110 deletions
File tree
- .github/workflows
- docs
- src
- OpenClaw.Connection
- OpenClaw.SetupEngine.UI
- Pages
- OpenClaw.SetupEngine
- OpenClaw.SetupPreview
- OpenClaw.Tray.WinUI
- Helpers
- Onboarding
- GatewayWizard
- Services
- V2
- Pages
- Services
- LocalGatewaySetup
- Windows
- OpenClaw.WinNode.Cli
- OpenClawTray.OnboardingV2
- Pages
- Widgets
- tests
- OpenClaw.E2ETests
- Setup
- OpenClaw.SetupEngine.Tests
- OpenClaw.Tray.Tests
- Connection
- OpenClaw.Tray.UITests
- OpenClawTray.OnboardingV2.Tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
| 164 | + | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
225 | 289 | | |
226 | | - | |
| 290 | + | |
227 | 291 | | |
228 | 292 | | |
229 | 293 | | |
| |||
253 | 317 | | |
254 | 318 | | |
255 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
256 | 326 | | |
257 | 327 | | |
258 | 328 | | |
| |||
290 | 360 | | |
291 | 361 | | |
292 | 362 | | |
293 | | - | |
| 363 | + | |
294 | 364 | | |
295 | 365 | | |
296 | 366 | | |
| |||
382 | 452 | | |
383 | 453 | | |
384 | 454 | | |
385 | | - | |
| 455 | + | |
386 | 456 | | |
387 | 457 | | |
388 | 458 | | |
| |||
416 | 486 | | |
417 | 487 | | |
418 | 488 | | |
419 | | - | |
420 | | - | |
| 489 | + | |
| 490 | + | |
421 | 491 | | |
422 | 492 | | |
423 | 493 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | | - | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
224 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
225 | 242 | | |
226 | 243 | | |
227 | 244 | | |
| |||
0 commit comments