Repository navigation
fix(ui): model sign-in leaves a blank tab when the Gateway stops responding - #160954
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: needs maintainer review before merge. Reviewed September 29, 2026, 3:39 AM ET / 07:39 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch closes a reserved provider sign-in tab when the Gateway stops responding, adds clearer timeout and reconnect messages, and covers those flows with browser and unit tests. Merge readiness✅ Ready for maintainer review This remains a useful Control UI fix absent from current main. The latest revision addresses the prior lost-session feedback, and the supplied browser evidence supports the changed behavior. Priority: P1 Review scores
Verification
How this fits togetherControl UI Model Setup asks the Gateway to start a provider sign-in wizard and reserves a browser tab for the URL returned later. Gateway responses and connection changes determine the tab, dialog, and recovery state. flowchart LR
A[User starts provider sign-in] --> B[Control UI reserves tab]
B --> C[Gateway wizard request]
C --> D{Response or outage?}
D -->|Sign-in URL| E[Browser sign-in link]
D -->|No response| F[Close tab and show recovery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +19, Tests +100. Total +119 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep tab cleanup in the existing wizard runner and use the established reconnect and Check again states for accurate recovery. Do we have a high-confidence way to reproduce the issue? Yes. Reserve a sign-in tab, then withhold the Gateway start response or disconnect after wizard admission; current-main source retains the blank tab, and the supplied before screenshot shows the symptom. I did not execute the tests in this read-only review. Is this the best way to solve the issue? Yes. The patch changes the existing wizard's tab lifecycle and uses its current dialog and recovery paths, with no competing state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 54b1b1b63e21. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
Landed in b933d41. Bug: if the Gateway stopped responding while model sign-in was starting, the Control UI left the reserved sign-in tab open on a blank Fix: a suspended sign-in now closes the reserved tab and shows "The Gateway is not responding. Waiting for it to reconnect." When the Gateway comes back, the resumed step offers Open sign-in. If a restart lost the session, the dialog falls back to the existing Check again recovery. If the Gateway never answers the start request, the 30 s deadline now shows a clear message in place of the raw timeout text. Proof: the new mock-Gateway E2E ( |
…onding (openclaw#160954) ## What Problem This Solves Fixes: Model sign-in (OAuth / device code) leaves the user on a blank `about:blank` tab with no feedback when the Gateway stops responding before it returns the sign-in URL (seen live during a Gateway restart while signing in to OpenRouter). ## User Impact If the Gateway stops responding before the sign-in page is ready, the Control UI now closes the blank tab and explains what happened: - **Connection lost after sign-in started (Model Setup):** the tab closes and the dialog says the Gateway is not responding and is waiting for it to reconnect. The notice is shown only for a disconnected sign-in, not for connected roster refreshes or local-model prepare/activate. When the Gateway comes back with the sign-in session, the resumed step offers the sign-in URL through the dialog's existing **Open sign-in** link. If a Gateway restart lost the session, the notice is replaced by the existing "no longer has this setup session … choose Check again" recovery. - **Gateway never answers the start request (30 s deadline, every model/MCP setup dialog):** the tab closes and Details shows "The Gateway is not responding. Check that it is running, then try again." instead of `gateway request timed out after 30000ms: <method>`. The tab is still opened synchronously on click, so the popup-blocker workaround is unchanged. ## Why This Change Was Made The tab is reserved while the click still counts as user activation, then navigated once the Gateway sends the URL. On Model Setup, losing the connection suspends an admitted wizard so it can resume later, but suspending left the reserved tab open. It stayed blank until the Gateway reconnected, which could take minutes during a slow restart or never happen if the Gateway was stuck. A suspended wizard can't receive a URL, so `suspend()` now closes the tab, and the page shows a notice only when the Gateway connection is actually lost during sign-in. `resume()` clears the notice. A Gateway that keeps the socket open without replying is also bounded. The start request has a 30 s deadline, and after admission the client's tick watchdog (2 × 30 s tick interval) closes the socket, which suspends the wizard as above. I didn't add an "Opening sign-in…" message to the reserved tab. Writing into it depends on cross-context document access, and closing the tab already resolves the reported failure. ## Evidence Mock-Gateway E2E: the start is admitted, `wizard.next` is held, and the Gateway then goes offline (the new socket never completes its handshake). Screenshots taken 10 s later: Before (origin/main `115ca1833fd`): the reserved tab is still open on `about:blank` and the dialog only says "Starting provider sign-in…".  After: the tab is closed and the dialog shows the Gateway-not-responding notice.  - New `ui/src/e2e/model-sign-in-unresponsive-gateway.e2e.test.ts`: 1. The start is never answered: after 30 s the tab closes and the clear error appears. 2. The connection drops after admission: the tab closes and the notice appears. After reconnect, the resumed step shows **Open sign-in** with the provider URL and the notice is cleared. Both tests fail on origin/main (tab stays open or raw timeout text) and pass on this branch. The suite runs in about 2.8 s (1.1 s + 1.7 s). - `wizard-runner.test.ts`: the start-deadline case now expects the clear message. On origin/main the 5 deadline cases fail with the raw timeout text. - `model-setup-activation.test.ts`: the lost-session reconnect case (Gateway returns `WIZARD_NOT_FOUND` after reconnecting) now asserts the notice shows while disconnected and is replaced by the Check again recovery. - Passing: `ui/src/pages/model-setup/` + `wizard-login-controller` unit tests (313), `model-setup-reconnect` / `model-provider-login` E2E (15 total with the new file), `pnpm tsgo:ui`, `pnpm tsgo:test:ui`, `pnpm ui:i18n:baseline` (no baseline change), oxfmt. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: Model sign-in (OAuth / device code) leaves the user on a blank
about:blanktab with no feedback when the Gateway stops responding before it returns the sign-in URL (seen live during a Gateway restart while signing in to OpenRouter).User Impact
If the Gateway stops responding before the sign-in page is ready, the Control UI now closes the blank tab and explains what happened:
gateway request timed out after 30000ms: <method>.The tab is still opened synchronously on click, so the popup-blocker workaround is unchanged.
Why This Change Was Made
The tab is reserved while the click still counts as user activation, then navigated once the Gateway sends the URL. On Model Setup, losing the connection suspends an admitted wizard so it can resume later, but suspending left the reserved tab open. It stayed blank until the Gateway reconnected, which could take minutes during a slow restart or never happen if the Gateway was stuck. A suspended wizard can't receive a URL, so
suspend()now closes the tab, and the page shows a notice only when the Gateway connection is actually lost during sign-in.resume()clears the notice.A Gateway that keeps the socket open without replying is also bounded. The start request has a 30 s deadline, and after admission the client's tick watchdog (2 × 30 s tick interval) closes the socket, which suspends the wizard as above.
I didn't add an "Opening sign-in…" message to the reserved tab. Writing into it depends on cross-context document access, and closing the tab already resolves the reported failure.
Evidence
Mock-Gateway E2E: the start is admitted,
wizard.nextis held, and the Gateway then goes offline (the new socket never completes its handshake). Screenshots taken 10 s later:Before (origin/main
4d4d99d6250): the reserved tab is still open onabout:blankand the dialog only says "Starting provider sign-in…".After: the tab is closed and the dialog shows the Gateway-not-responding notice.
ui/src/e2e/model-sign-in-unresponsive-gateway.e2e.test.ts:Both tests fail on origin/main (tab stays open or raw timeout text) and pass on this branch. The suite runs in about 2.8 s (1.1 s + 1.7 s).
wizard-runner.test.ts: the start-deadline case now expects the clear message. On origin/main the 5 deadline cases fail with the raw timeout text.model-setup-activation.test.ts: the lost-session reconnect case (Gateway returnsWIZARD_NOT_FOUNDafter reconnecting) now asserts the notice shows while disconnected and is replaced by the Check again recovery.ui/src/pages/model-setup/+wizard-login-controllerunit tests (313),model-setup-reconnect/model-provider-loginE2E (15 total with the new file),pnpm tsgo:ui,pnpm tsgo:test:ui,pnpm ui:i18n:baseline(no baseline change), oxfmt.