Repository navigation
fix(ui): resume first-run model setup after a page reload - #160774
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 8:49 PM ET / September 29, 2026, 00:49 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Control UI stores a wizard identity with the first-run activation receipt, resumes the pending provider question after a reload, and retires local wizard work after cancellation, with docs and regression coverage. Merge readiness⛔ Blocked before merge - 2 items remain Current main still locks first-run Model Setup after a reload. This PR is a viable, well-proven fix with no identified code defect; its captured PR body needs current-head validation details before merge. Priority: P0 Review scores
Verification
How this fits togetherThe Control UI starts provider setup on the Gateway and keeps a browser receipt while activation is unresolved. After a reload, it uses that receipt to recover the Gateway's current question or preserves the recovery guard when the outcome is uncertain. flowchart LR
A[First-run provider choice] --> B[Gateway setup wizard]
B --> C[Browser activation receipt]
C --> D[Page reload]
D --> E[Read current wizard step]
E --> F{Wizard available?}
F -->|Yes| G[Resume question]
F -->|No| H[Recovery guard]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +74, Tests +171, Docs +2. Total +247 across 10 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: A reload should resume only the exact authenticated Gateway wizard, while old receipts and missing or uncertain sessions retain the no-replay recovery guard. Do we have a high-confidence way to reproduce the issue? Yes. Current main's receipt path enters the unresolved guard after a reload with no model, matching the inspected before screenshot and reported real-Gateway reproduction; this read-only review did not execute current main. Is this the best way to solve the issue? Yes. Reusing the existing Gateway wizard avoids replaying setup writes, and the guarded fallback remains for missing sessions and uncertain outcomes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 54d5733c2845. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Retain auth-bound wizard identity in the browser activation receipt and resume the existing Gateway wizard after reload without replaying start or answers. Confirmed cancellation releases provider choices; missing sessions and uncertain writes retain the recovery guard. Gateway restart persistence is unchanged. Validation: failing baseline recreation regression, 305 model-setup tests, five fresh real Gateway/Chromium recovery-to-chat runs against a local stub, and check-changed. Recovery restores the provider URL question in under one second. No provider credentials or input drafts are persisted in the receipt.
When another page clears the exact pending activation receipt, close its local wizard and invalidate the page mutation generation. This releases provider choices after route return or cross-tab cancellation without sending another cancel, clearing a replacement receipt, or discarding the current wizard's definitive rejection. Fixes the lifecycle regression in 5a23d5b. Preserve the replacement-tab receipt invariant. Its fixture now reports WIZARD_NOT_FOUND before expiry and explicit retry: a running wizard correctly resumes its input, so expecting Check again for that fixture was superseded. Assert the resume is read-only and the replacement receipt is distinct. Cover cancellation during a pending resume and reject its late read after the replacement wizard starts. The existing after-return test and the new pending-resume case both fail before this production fix. Blacksmith Testbox proof at the exact source bytes: - All model-setup E2Es: 42 passed (77.92s command wall; cancel file 7.87s). node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/model-setup*.e2e.test.ts --maxWorkers=1 - pnpm test ui/src/pages/model-setup --maxWorkers=1: 305 passed (12.36s). - UI typecheck, targeted oxlint/format and UI i18n checks pass. - pnpm build passes (379.91s). Real Gateway + Chromium reproduces the cross-tab lockout before the fix; both tabs release after the fix. Five fresh reloads restore the original question in 877-919ms without replay. All six flows finish synthetic-provider setup, chat and reload. Recovery has no console/page/network errors; later chat reports the existing optional avatar/workspace-icon 404s. - check-changed runs, but the pinned-base gate hits the existing environment budget overrun (477 versus 476), also reproduced with this patch removed. Production +6 lines wires the existing cleanup owner; tests +47/-4. Refs #160774.
5a23d5b to
402d284
Compare
|
Merged via squash.
|
…60774) * fix(ui): resume interrupted first-run provider setup Retain auth-bound wizard identity in the browser activation receipt and resume the existing Gateway wizard after reload without replaying start or answers. Confirmed cancellation releases provider choices; missing sessions and uncertain writes retain the recovery guard. Gateway restart persistence is unchanged. Validation: failing baseline recreation regression, 305 model-setup tests, five fresh real Gateway/Chromium recovery-to-chat runs against a local stub, and check-changed. Recovery restores the provider URL question in under one second. No provider credentials or input drafts are persisted in the receipt. * fix(ui): retire cancelled setup recovery work When another page clears the exact pending activation receipt, close its local wizard and invalidate the page mutation generation. This releases provider choices after route return or cross-tab cancellation without sending another cancel, clearing a replacement receipt, or discarding the current wizard's definitive rejection. Fixes the lifecycle regression in 5a23d5b. Preserve the replacement-tab receipt invariant. Its fixture now reports WIZARD_NOT_FOUND before expiry and explicit retry: a running wizard correctly resumes its input, so expecting Check again for that fixture was superseded. Assert the resume is read-only and the replacement receipt is distinct. Cover cancellation during a pending resume and reject its late read after the replacement wizard starts. The existing after-return test and the new pending-resume case both fail before this production fix. Blacksmith Testbox proof at the exact source bytes: - All model-setup E2Es: 42 passed (77.92s command wall; cancel file 7.87s). node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/model-setup*.e2e.test.ts --maxWorkers=1 - pnpm test ui/src/pages/model-setup --maxWorkers=1: 305 passed (12.36s). - UI typecheck, targeted oxlint/format and UI i18n checks pass. - pnpm build passes (379.91s). Real Gateway + Chromium reproduces the cross-tab lockout before the fix; both tabs release after the fix. Five fresh reloads restore the original question in 877-919ms without replay. All six flows finish synthetic-provider setup, chat and reload. Recovery has no console/page/network errors; later chat reports the existing optional avatar/workspace-icon 404s. - check-changed runs, but the pinned-base gate hits the existing environment budget overrun (477 versus 476), also reproduced with this patch removed. Production +6 lines wires the existing cleanup owner; tests +47/-4. Refs openclaw#160774. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
In the Control UI first-run Model Setup, suppose a user starts a provider (for example, a custom OpenAI-compatible endpoint) and reloads the page while typing its URL. The page then locks. It shows "The previous setup attempt may still be running… check again after <time 25 minutes later>", every provider choice is disabled, and Check again changes nothing. A reload on the most common first-run page left new users stuck for about 25 minutes, with zero provider requests.
Why This Change Was Made
ui/src/pages/model-setup/first-run-setup.tsstores a browser activation receipt before the model is known. The recovery guard is deliberate: it stops a second setup from racing one that may still be writing. However, since 319df1e the receipt did not record which Gateway wizard it belonged to. After a reload, the UI therefore could not tell "the wizard is still waiting for input" apart from "the outcome is unknown", and it fell back to the full lockout.The receipt (
first-run-activation-receipt.ts) now keeps the wizard's identity, bound to the same auth and connection context. The identity is validated before it is used, and no credentials or input drafts are stored.FirstRunSetupresumes that existing Gateway wizard viawizard-runner.ts, without replayingwizard.startor any earlier answers. The user lands back on the pending question.User Impact
Reloading during first-run model setup brings you back to the same step in under a second (for example, API Base URL). Cancelling frees the provider list at once, instead of after a 25-minute wait.
Evidence
model-setup-first-run-recovery.test.ts): recreates the pre-fix lockout and fails before the fix. It also covers restoration, missing sessions, cancellation outcomes, and receipt tampering. 305 model-setup tests pass.node scripts/check-changed.mjspasses. Codex autoreview is scoped-clean on the final head.src/gateway/server-wizard-sessions.ts), and the guard still applies. Fixing that needs Gateway-owned durable wizard settlement, which is a persistence decision. The design notes are in the lane evidence.