Skip to content

Fix startup setup check for per-gateway node tokens - #375

Merged
shanselman merged 1 commit into
masterfrom
fix/per-gateway-node-token-startup
May 14, 2026
Merged

shanselman merged 1 commit into
masterfrom
fix/per-gateway-node-token-startup

Conversation

@shanselman

Copy link
Copy Markdown
Collaborator

Summary

  • fixes node-mode startup setup detection when the node device token is stored only under gateways/<gateway-id>/device-key-ed25519.json
  • reuses the per-gateway identity scan for both operator and node token roles
  • adds regression coverage for the startup gate and existing-config guard

Repro evidence

After #340, clicking Keep my setup closed the onboarding window, but a full exit + relaunch still reopened setup for a local node-mode profile with:

  • EnableNodeMode=true
  • root identity missing NodeDeviceToken
  • per-gateway identity containing NodeDeviceToken

Sanitized log evidence from the broken run:

[OnboardingState] Dismiss invoked (user chose to keep existing setup)
[OnboardingWindow] Dismissed by user (keep-existing-setup) — closing without completing
...
[OnboardingWindow] OnWizardComplete skipping chat launch; route=SetupWarning, setupStillRequired=True

After this fix and x64 rebuild, relaunch no longer opens onboarding; the post-launch log only shows normal gateway/node connection:

Connecting to last successful gateway during startup: ws://localhost:18789 (identity.DeviceToken)
Connecting to node: ws://localhost:18789
[HANDSHAKE]   isBootstrap=False, hasNodeDeviceToken=True
Node registered successfully! ID: c340a12b10f1dacb

Validation

  • ./build.ps1
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore — 1548 passed, 28 skipped
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore — 1180 passed

Node-mode startup was still checking only the legacy root identity file for node device tokens. Modern local setup can persist the node token under gateways/<gateway-id>/device-key-ed25519.json, so startup kept reopening onboarding after Keep my setup.

Reuse the per-gateway identity scan for all token roles and add regression coverage for per-gateway node tokens in both the startup gate and existing-config guard.

Co-authored-by: Copilot <[email protected]>
indierawk2k2 pushed a commit to indierawk2k2/openclaw-windows-node that referenced this pull request May 14, 2026
…+ wire V2 dismiss

Our V2 branch was cut at a03c454 (before PR openclaw#340 landed in master). PR
openclaw#340 fixed two real bugs in the legacy onboarding flow: "Keep my setup"
didn't actually dismiss the wizard, and ExistingConfigGuard only scanned
the legacy root identity dir for operator tokens (per-gateway tokens
under gateways/<id>/device-key-ed25519.json were missed). PR openclaw#375
(Scott's, still open) extends the per-gateway scan symmetrically to the
node-token role, fixing a startup-relaunch-reopens-onboarding bug for
local node-mode profiles whose node token lives only per-gateway.

This commit:

1. Merges origin/master to absorb PR openclaw#340's three commits (Dismissed
   event/method on OnboardingState, OnboardingWindow.OnOnboardingDismissed
   handler, SetupWarningPage CancelReplace -> Props.Dismiss, removed
   default-to-Advanced in returning-user path, HasAnyOperatorDeviceToken
   per-gateway scan, StartupSetupState rewrite). Auto-resolved a single
   conflict in OnboardingWindow.cs via the ORT strategy.

2. Applies PR openclaw#375's symmetric per-gateway scan locally:
   - Refactored OnboardingExistingConfigGuard.HasAnyOperatorDeviceToken
     to delegate to a new HasAnyDeviceTokenForRole(dataPath, role).
   - GetSummary now uses HasAnyDeviceTokenForRole for the node side too,
     not just operator (the asymmetric defect that PR openclaw#375 catches).
   - StartupSetupState.HasStoredNodeDeviceToken now delegates to the
     guard's per-gateway-aware helper so the startup auto-launch
     decision and the in-wizard guard agree.

3. Wires V2 equivalents of PR openclaw#340's Dismiss machinery so the V2
   redesigned UI gets the same fix, not just the legacy UI:
   - OnboardingV2State adds Dismissed event + idempotent Dismiss()
     method (matches legacy OnboardingState.Dismiss semantics: log,
     fire once).
   - V2 WelcomePage's "Keep my setup" handler now calls Props.Dismiss()
     instead of just toggling setConfirmingReplace(false). Mirrors
     legacy SetupWarningPage CancelReplace post-PR-openclaw#340.
   - OnboardingV2Bridge surfaces a Dismissed event (subscribes to V2
     state, forwards to host).
   - OnboardingWindow's V2 mount now subscribes to bridge.Dismissed and
     reuses the existing _dismissedWithoutCompletion flag + Close
     pattern from PR openclaw#340's OnOnboardingDismissed so OnClosed skips
     TryCompleteOnboarding the same way for both legacy and V2 dismiss
     paths.

Validation:
  build.ps1 -> all 4 projects green
  Shared.Tests -> 1548 passed / 28 skipped / 0 failed
  Tray.Tests -> 1178 passed / 0 failed (was 1164 -- +14 from PR openclaw#340's
  OnboardingExistingConfigGuardTests + OnboardingStateTests +
  StartupSetupStateTests new coverage we just absorbed)

Co-authored-by: Copilot <[email protected]>
@shanselman
shanselman merged commit 0d9106b into master May 14, 2026
22 checks passed
@shanselman
shanselman deleted the fix/per-gateway-node-token-startup branch May 14, 2026 20:01
indierawk2k2 pushed a commit to indierawk2k2/openclaw-windows-node that referenced this pull request May 15, 2026
…+ wire V2 dismiss

Our V2 branch was cut at a03c454 (before PR openclaw#340 landed in master). PR
didn't actually dismiss the wizard, and ExistingConfigGuard only scanned
the legacy root identity dir for operator tokens (per-gateway tokens
under gateways/<id>/device-key-ed25519.json were missed). PR openclaw#375
(Scott's, still open) extends the per-gateway scan symmetrically to the
node-token role, fixing a startup-relaunch-reopens-onboarding bug for
local node-mode profiles whose node token lives only per-gateway.

This commit:

1. Merges origin/master to absorb PR openclaw#340's three commits (Dismissed
   event/method on OnboardingState, OnboardingWindow.OnOnboardingDismissed
   handler, SetupWarningPage CancelReplace -> Props.Dismiss, removed
   default-to-Advanced in returning-user path, HasAnyOperatorDeviceToken
   per-gateway scan, StartupSetupState rewrite). Auto-resolved a single
   conflict in OnboardingWindow.cs via the ORT strategy.

2. Applies PR openclaw#375's symmetric per-gateway scan locally:
   - Refactored OnboardingExistingConfigGuard.HasAnyOperatorDeviceToken
     to delegate to a new HasAnyDeviceTokenForRole(dataPath, role).
   - GetSummary now uses HasAnyDeviceTokenForRole for the node side too,
     not just operator (the asymmetric defect that PR openclaw#375 catches).
   - StartupSetupState.HasStoredNodeDeviceToken now delegates to the
     guard's per-gateway-aware helper so the startup auto-launch
     decision and the in-wizard guard agree.

3. Wires V2 equivalents of PR openclaw#340's Dismiss machinery so the V2
   redesigned UI gets the same fix, not just the legacy UI:
   - OnboardingV2State adds Dismissed event + idempotent Dismiss()
     method (matches legacy OnboardingState.Dismiss semantics: log,
     fire once).
   - V2 WelcomePage's "Keep my setup" handler now calls Props.Dismiss()
     instead of just toggling setConfirmingReplace(false). Mirrors
     legacy SetupWarningPage CancelReplace post-PR-openclaw#340.
   - OnboardingV2Bridge surfaces a Dismissed event (subscribes to V2
     state, forwards to host).
   - OnboardingWindow's V2 mount now subscribes to bridge.Dismissed and
     reuses the existing _dismissedWithoutCompletion flag + Close
     pattern from PR openclaw#340's OnOnboardingDismissed so OnClosed skips
     TryCompleteOnboarding the same way for both legacy and V2 dismiss
     paths.

Validation:
  build.ps1 -> all 4 projects green
  Shared.Tests -> 1548 passed / 28 skipped / 0 failed
  Tray.Tests -> 1178 passed / 0 failed (was 1164 -- +14 from PR openclaw#340's
  OnboardingExistingConfigGuardTests + OnboardingStateTests +
  StartupSetupStateTests new coverage we just absorbed)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant