Skip to content

fix(ui): resume first-run model setup after a page reload - #160774

Merged
steipete merged 2 commits into
mainfrom
fix/uionb-setup-lockout
Sep 29, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/uionb-setup-lockout

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.ts stores 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.

  • After a reload, FirstRunSetup resumes that existing Gateway wizard via wizard-runner.ts, without replaying wizard.start or any earlier answers. The user lands back on the pending question.
  • A confirmed cancellation releases the provider choices immediately.
  • A missing session or an uncertain write keeps the existing recovery guard. The safety property is unchanged, and the Gateway, protocol, and persistence are untouched.

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

  • Regression test (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.
  • Real isolated Gateway plus Chromium on a Blacksmith Testbox, with a local stub provider, 5 of 5 fresh runs:
    • Reload during URL entry restores API Base URL in 896–947 ms.
    • A confirmed Cancel re-enables the provider choices in 95–126 ms.
    • There is no replay of start or answers, and no provider requests during recovery.
    • Continuing configures the stub model, a chat gets its reply, and the reply survives a chat reload.
    • There were zero page exceptions or failed requests in the recovery flows.
Before: reload locks provider setup for about 25 minutes After: reload resumes the pending step
before after
  • node scripts/check-changed.mjs passes. Codex autoreview is scoped-clean on the final head.
  • Known limitation, not changed here: a Gateway restart (not a browser reload) loses the process-local wizard (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.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 28, 2026 22:50
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 8:49 PM ET / September 29, 2026, 00:49 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 402d284ef36e691a2a1afe1f91917d5ee3943be8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The fix has strong browser and real-Gateway evidence; the PR body's current-head validation and test-cost record still need reconciliation.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The changed Control UI receipt and wizard runner are supported by inspected before/after screenshots of the lockout and restored question, plus reported real isolated Gateway and Chromium recovery-to-chat runs. The optional receipt field preserves older stored receipts and their guarded behavior, supporting existing-state compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The changed Control UI receipt and wizard runner are supported by inspected before/after screenshots of the lockout and restored question, plus reported real isolated Gateway and Chromium recovery-to-chat runs. The optional receipt field preserves older stored receipts and their guarded behavior, supporting existing-state compatibility.
Evidence reviewed 7 items Current main retains the lockout: With a pending receipt but no configured model, first-run startup shows the unresolved state instead of resuming a wizard.
PR recovery path: The introduced branch restores an existing wizard only when an authenticated receipt contains its identity; otherwise it retains the unresolved guard.
Receipt binding and compatibility: The optional wizard identity is included in the receipt's authentication-bound integrity value. Receipts without it remain readable, and the existing guarded path remains covered by recovery tests.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - The captured PR body claims check-changed passed on the final head, while the latest commit reports an inherited environment-budget failure; it also lacks the per-file one-worker wall times and CI seconds required for changed tests.
  • Complete next step (P2) - Reconcile the PR body with current-head validation and add per-file single-worker wall times and CI seconds for materially changed tests.
Agent review details

Security

None.

PR surface

Source +74, Tests +171, Docs +2. Total +247 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 88 14 +74
Tests 4 177 6 +171
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 267 20 +247

Review metrics

Metric Value Why it matters
Production and test growth production +74 net lines; tests +171 net lines Production growth is concentrated in receipt-bound recovery and cancellation lifecycle code, with larger regression coverage for those behaviors.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    A reload should resume only the exact authenticated Gateway wizard, while old receipts and missing or uncertain sessions retain the no-replay recovery guard.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P0: A page reload can strand a first-time user in provider setup for about 25 minutes with no immediate in-product recovery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed Control UI receipt and wizard runner are supported by inspected before/after screenshots of the lockout and restored question, plus reported real isolated Gateway and Chromium recovery-to-chat runs. The optional receipt field preserves older stored receipts and their guarded behavior, supporting existing-state compatibility.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Control UI receipt and wizard runner are supported by inspected before/after screenshots of the lockout and restored question, plus reported real isolated Gateway and Chromium recovery-to-chat runs. The optional receipt field preserves older stored receipts and their guarded behavior, supporting existing-state compatibility.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed Control UI receipt and wizard runner are supported by inspected before/after screenshots of the lockout and restored question, plus reported real isolated Gateway and Chromium recovery-to-chat runs. The optional receipt field preserves older stored receipts and their guarded behavior, supporting existing-state compatibility.

Evidence

What I checked:

  • Current main retains the lockout: With a pending receipt but no configured model, first-run startup shows the unresolved state instead of resuming a wizard. (ui/src/pages/model-setup/first-run-setup.ts:299, 54d5733c2845)
  • PR recovery path: The introduced branch restores an existing wizard only when an authenticated receipt contains its identity; otherwise it retains the unresolved guard. (ui/src/pages/model-setup/first-run-setup.ts:307, 402d284ef36e)
  • Receipt binding and compatibility: The optional wizard identity is included in the receipt's authentication-bound integrity value. Receipts without it remain readable, and the existing guarded path remains covered by recovery tests. (ui/src/pages/model-setup/first-run-activation-receipt.ts:138, 402d284ef36e)
  • Gateway authorization boundary: The final wizard read and cancellation methods require current operator-admin scope; a stored wizard ID alone does not grant access. (src/gateway/methods/core-descriptors.ts:121, 402d284ef36e)
  • Inspected visual proof: The prepared before screenshot shows provider setup locked behind the recovery wait; the after screenshot shows the restored API Base URL question. Both downloaded images were inspected from the supplied media manifest.
  • Current-head validation report: The latest commit reports real Gateway and Chromium reload-to-chat runs, 42 model-setup browser E2Es, 305 model-setup tests, and an inherited check-changed environment-budget failure. The captured PR body still says check-changed passes and does not provide per-file wall times or CI seconds. (402d284ef36e)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Update the PR body with each materially changed test file's single-worker wall time, CI seconds when available, and the current-head check-changed result.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T22:59:08.118Z sha 5a23d5b :: needs changes before merge. :: none

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.
@steipete
steipete force-pushed the fix/uionb-setup-lockout branch from 5a23d5b to 402d284 Compare September 29, 2026 00:41
@steipete
steipete merged commit 4e87ff7 into main Sep 29, 2026
84 checks passed
@steipete
steipete deleted the fix/uionb-setup-lockout branch September 29, 2026 01:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant