Skip to content

fix(ui): model sign-in leaves a blank tab when the Gateway stops responding - #160954

Merged
obviyus merged 5 commits into
mainfrom
fix/ui-signin-blank-tab
Sep 29, 2026
Merged

obviyus merged 5 commits into
mainfrom
fix/ui-signin-blank-tab

Conversation

@obviyus

@obviyus obviyus commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

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 4d4d99d6250): the reserved tab is still open on about:blank and the dialog only says "Starting provider sign-in…".

Before: blank sign-in tab stays open

After: the tab is closed and the dialog shows the Gateway-not-responding notice.

After: tab closed, notice shown

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

@clawsweeper

clawsweeper Bot commented Sep 29, 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.

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 3:39 AM ET / 07:39 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: 0ca3e889b2bf2e1d6bc8fc06e9463dcdfd2f23b0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused UI changes, browser evidence, and recovery coverage now support a normal good review rating.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.
Evidence reviewed 8 items Introduced tab cleanup and timeout message: The PR head closes the reserved window on wizard suspension and replaces the raw start deadline error with a user-facing message.
Current main still has the reported behavior: On fetched main, suspension does not close the reserved window, and the start deadline still emits the raw Gateway timeout text.
Lost-session feedback addressed: The latest head uses a reconnect notice while disconnected; the added test checks that a lost wizard replaces it with the established Check again recovery. This resolves the concrete concern in the previous ClawSweeper review.
Findings None None.
Security None None.

How this fits together

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

Before merge

None.

Agent review details

Security

None.

PR surface

Source +19, Tests +100. Total +119 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 30 11 +19
Tests 3 113 13 +100
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 143 24 +119

Review metrics

Metric Value Why it matters
New browser regression runtime about 2.8 s reported The PR body reports two outage scenarios within the repository's under-five-second per-file test target.

Technical review

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: An unresponsive Gateway disrupts the user-facing provider sign-in flow and leaves a blank tab without useful feedback on current main.
  • 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 actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The actual Control UI sign-in flow was exercised in a browser against an injected mock-Gateway outage. Inspected before and after screenshots show the blank tab state changing to a closed-tab state with a reconnect notice; the supplied browser test asserts closure, timeout feedback, and the recovered sign-in link. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

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

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 (2 earlier review cycles)
  • reviewed 2026-09-29T04:34:05.852Z sha f75f92b :: needs changes before merge. :: [P2] Avoid promising sign-in survives a Gateway restart
  • reviewed 2026-09-29T07:20:20.948Z sha 64f5903 :: needs changes before merge. :: [P2] Avoid promising sign-in survives a Gateway restart

@obviyus
obviyus marked this pull request as ready for review September 29, 2026 07:12
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@obviyus
obviyus merged commit b933d41 into main Sep 29, 2026
103 checks passed
@obviyus
obviyus deleted the fix/ui-signin-blank-tab branch September 29, 2026 07:41
@obviyus

obviyus commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

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 about:blank page and gave no feedback.

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 (model-sign-in-unresponsive-gateway) covers both paths, the lost-session reconnect is covered in model-setup-activation.test.ts, and there are before/after screenshots in the PR body. Model-setup unit tests and the reconnect/login E2E suites pass on the merged head.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…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…".

![Before: blank sign-in tab stays open](https://github.com/user-attachments/assets/16b48a71-3475-4f5f-a376-b83ecbcd46b3)

After: the tab is closed and the dialog shows the Gateway-not-responding notice.

![After: tab closed, notice shown](https://github.com/user-attachments/assets/b16bb136-1e0d-44b9-8112-17a141b4f793)

- 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]>
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 P1 High-priority user-facing bug, regression, or broken workflow. 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: S 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