[Repo Assist] fix: guard bootstrap prompt against already-configured workspaces#734
Conversation
Root cause: OnboardingChatBootstrapper.BootstrapAsync() only checked the HasInjectedFirstRunBootstrap flag, which could be unset (false) even when the user already had a configured gateway (e.g. fresh app install over an existing workspace, settings migration, or flag reset). This caused the first-run ritual prompt to fire against an already-configured workspace, risking unintended rewrites of SOUL.md, AGENTS.md, and other workspace files. Fix: Add an optional GatewayRegistry parameter to BootstrapAsync(). Before sending the bootstrap message, check SetupExistingGatewayClassifier .HasAnyExistingGatewayConnection(). If an existing gateway configuration is detected, silently mark the gate as consumed and return true without sending the prompt. ChatPage.xaml.cs now passes app.Registry to BootstrapAsync() to enable this guard. Tests: 4 new unit tests cover the existing-gateway-skip path (SharedGatewayToken, BootstrapToken), the empty-registry first-run path, and the no-registry path (backward compatibility). All 996 tray tests pass. Closes #729 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: found issues before merge. Reviewed June 9, 2026, 9:52 PM ET / 01:52 UTC. Summary Reproducibility: Do we have a high-confidence way to reproduce the issue? Source inspection gives a high-confidence path: current main only checks HasInjectedFirstRunBootstrap before sending, while the PR guard would return early for setup-created registry credentials. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Refine the guard so it skips only when existing workspace state is proven, while preserving the first-run bootstrap for normal setup-created gateway records and covering both paths in tests. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Source inspection gives a high-confidence path: current main only checks HasInjectedFirstRunBootstrap before sending, while the PR guard would return early for setup-created registry credentials. Is this the best way to solve the issue? Is this the best way to solve the issue? No; using any gateway credential as non-first-run evidence conflates established workspaces with the documented fresh setup-code pairing path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 0e61fa287afb. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes an issue where the first-run bootstrap ritual prompt could be injected into the chat even when the user already had a configured workspace with OpenClaw files (SOUL.md, AGENTS.md, etc.).
Closes #729
Root Cause
OnboardingChatBootstrapper.BootstrapAsync()only checked theHasInjectedFirstRunBootstrapflag before sending the first-run prompt. This flag could befalseeven on an established workspace if:In those cases, the bootstrap prompt would fire and ask the agent to start the first-run ritual, potentially rewriting
SOUL.mdand other workspace personality/config files.Fix
Added an optional
GatewayRegistryparameter toBootstrapAsync(). Before sending the bootstrap message, the method now callsSetupExistingGatewayClassifier.HasAnyExistingGatewayConnection(). If an existing gateway configuration is found (shared token, bootstrap token, or device token in any registry record), the gate is silently consumed (MarkBootstrapped()is called) without sending the prompt.ChatPage.xaml.csnow passesapp.RegistrytoBootstrapAsync()to enable this guard in the live UI path.The change is backward-compatible: callers that don't pass a registry (existing tests, other call sites) get the old behavior unchanged.
Files Changed
src/OpenClaw.Tray.WinUI/Services/OnboardingChatBootstrapper.cs— addedGatewayRegistry?param and existing-gateway guardsrc/OpenClaw.Tray.WinUI/Pages/ChatPage.xaml.cs— passesapp.RegistrytoBootstrapAsynctests/OpenClaw.Tray.Tests/OnboardingChatBootstrapperTests.cs— 4 new tests covering the skip path (SharedGatewayToken, BootstrapToken), empty-registry first-run, and no-registry backward compatTest Status
All existing tray tests pass. 4 new tests were added for the guard behavior.
The 8 pre-existing failures in
OpenClaw.Shared.Tests(MxcPolicyBuilderTests,ExecApprovalV2NormalizationTests,McpHttpServerTests) are unrelated to this change and pre-date it (Windows-specific sandbox/path features not available in the Linux CI environment).Add this agentic workflows to your repo
To install this agentic workflow, run