-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Control UI webchat flashes credentials gate on tab re-focus due to immediate connected=false render #72500
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Every time the browser tab loses and regains focus, the webchat briefly flashes the full credentials/login gate before reconnecting and restoring the normal chat UI. On fast connections this lasts ~300–800ms; on slower connections (Pi-class hardware) it is more visible.
Steps to reproduce
Expected behavior
Switching back to a previously authenticated tab should show a brief "reconnecting..." indicator overlaid on the existing chat content, or no transition at all if reconnection is fast. The full credentials gate should only appear when the user has never connected or when auth explicitly fails (401/403).
Actual behavior
The credentials gate appears on every reconnect cycle because `app-render.ts` renders `renderLoginGate()` unconditionally whenever `state.connected === false`:
```typescript
// app-render.ts:666
if (!state.connected) {
return html`${renderLoginGate(state)} ${renderGatewayUrlConfirmation(state)}`;
}
```
And `app-gateway.ts` sets `connected = false` immediately on any WebSocket close — including expected transient browser-initiated closes when the tab goes to background — with no debounce or "reconnecting" intermediate state:
```typescript
// app-gateway.ts:266 — set at start of every connectGateway() call
host.connected = false;
// app-gateway.ts:347 — set in onClose handler
host.connected = false; // immediately triggers full re-render to credentials gate
```
There is no distinction between "never authenticated" and "temporarily disconnected from a known-good session." Both states render the same credentials gate.
Root cause
The app has two render states — connected (show chat) or not connected (show credentials gate) — with no intermediate "reconnecting" state. Browser tab visibility changes trigger WebSocket closes, which set `connected = false`, which immediately re-renders the full credentials gate. A debounce of even 1–2 seconds on the `connected = false` transition would eliminate the flash for normal tab switches.
Suggested fix
OpenClaw version
2026.4.24 (cbcfdf6)
Operating system
Raspberry Pi 5 (Linux 6.12 arm64) — also reproducible on any OS with the webchat UI
Install method
npm global
Screenshot
The attached screenshot shows the credentials gate that appears during the flash (captured from a fresh headless session to demonstrate the state):