Repository navigation
fix(ui): stale tabs keep dispatching after gateway updates - #123882
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
5a62f4b to
318c8a0
Compare
|
Codex review: needs changes before merge. Reviewed August 14, 2026, 7:46 PM ET / 23:46 UTC. ClawSweeper reviewWhat this changesThe PR rejects stale same-origin bundled Control UI documents before Gateway registration or RPC dispatch, then gives the browser reload and recovery guidance. Merge readinessKeep this maintainer-authored PR open, but it remains incorrect: its fail-closed admission rejects the documented source-install build sequence because the final standalone UI build receives a different build identity. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI opens a WebSocket to Gateway. Gateway admission decides whether that browser may register a session and issue RPCs; the UI then renders connection or recovery state. flowchart LR
A[Bundled Control UI] --> B[Gateway WebSocket connect]
B --> C[Build identity admission]
C -->|matches| D[Register session]
D --> E[Allow RPC dispatch]
C -->|stale or missing| F[Reload-required rejection]
F --> G[Browser recovery guidance]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +151, Tests +452. Total +603 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Make public build paths use one canonical build lifecycle, or explicitly propagate one immutable identity into every required build command, then keep the Gateway’s pre-registration admission boundary. Do we have a high-confidence way to reproduce the issue? Yes, from source: run the documented source-install build sequence, then connect its same-origin Control UI to the produced Gateway; the separately rebuilt UI lacks build-all’s timestamp identity and is rejected by this PR. Is this the best way to solve the issue? No. Server-owned pre-registration admission is the right boundary, but it must first preserve the documented build lifecycle rather than rejecting a freshly built source install. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ed106bdc7b16. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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)
|
|
Merged via squash.
|
|
Post-deploy verification:
The repeated legacy retry cadence is under separate investigation; the admission boundary is holding on every attempt. |
…123882) * fix(ui): reject stale bundled clients at connect * chore: keep release notes out of runtime fix * fix(ui): preserve stale-build admission invariants
What Problem This Solves
Fixes an issue where already-open bundled Control UI tabs could reconnect after a same-version Gateway deployment and continue dispatching connected-state RPCs before stale JavaScript reloaded. Documents predating exact build identity were fully admitted because the Gateway only logged
clientBuild=legacy; onclaw.steipete.dev, three such sessions persisted through the next deployment and each restored an ownerless terminal.Why This Change Was Made
The Gateway now owns bundled same-origin Control UI build admission. A missing or mismatched immutable build ID receives a structured reload-required rejection carrying the exact Gateway build before client registration, presence, hello, or RPC dispatch. Configured roots, separately hosted/remote UIs, local development, non-Control-UI clients, and runtimes without an exact build remain exempt.
Build-aware browsers reload once per target build and retain the existing visible Server updated / Refresh page recovery action when automatic recovery has already run. To preserve the shipped upgrade contract in the opposite direction, a current UI retries an older closed-schema Gateway exactly once without the additive client build field. The documented standalone
pnpm ui:buildpath also reuses a matching runtime identity, so rebuilding the bundled UI cannot make it reject itself.Production delta: +294/-60 lines (net +234), justified by the server-owned admission boundary, structured recovery contract, bounded old-Gateway compatibility path, and canonical build-identity ownership. Tests: +571 lines.
User Impact
Stale bundled documents can no longer start terminal sessions, subscriptions, or other RPC work after a Gateway update. Current browsers recover automatically; older documents fail closed until reloaded; custom and development Control UIs continue to connect independently.
Evidence
9f125bcee01709288e1bf91f890cda8f1f6cf374: threeclientBuild=legacysockets remained connected for more than 16 minutes, drained normal startup RPCs, and each emitted an ownerlessterminal.open; the previous legacy cohort persisted about 24 minutes until deployment disconnect.tbx_01m018rnh7z70dvqg8z4g63m12(run): 293 focused protocol/Gateway/browser-client/UI/build-wrapper assertions passed, including a real raw WebSocket rejection with zero registration, presence, or RPC dispatch.b6a902558fcfcd6bcdc26c3ecb6b80ee49352baa. The stale browser reloads exactly once, persists the target-build guard, shows visible recovery guidance after the guarded retry, and emits zeroterminal.opencalls.oxfmt,oxlint, andgit diff --checkpassed.b6a902558fcfcd6bcdc26c3ecb6b80ee49352baa: focused Testbox and Chromium proof passed; final dirty-bundle autoreview was clean with no accepted/actionable findings (0.98 confidence).