Repository navigation
fix(ui): stale tabs restore terminals without owners - #123660
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 3:57 PM ET / 19:57 UTC. ClawSweeper reviewWhat this changesThe PR adds exact Control UI build IDs to the Gateway handshake and fences stale same-origin tabs before they restore terminal state. Merge readinessKeep open: the current head still has the two P1 compatibility blockers identified in the prior review, so it can fence release UIs permanently and cannot connect to strict older Gateways. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI connects to the Gateway and restores connected features such as terminal panels after the hello response. The new build identity is meant to stop an old browser bundle from draining connected state after a Gateway deployment. flowchart LR
A[Open Control UI tab] --> B[Gateway connection]
B --> C[Hello build identity]
C --> D{UI artifact matches?}
D -->|yes| E[Restore connected state]
D -->|no| F[Reload and fence terminal]
F --> G[Visible refresh action]
E --> H[Owned terminal request]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +206, Tests +445, Other +14. Total +665 across 32 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Generate one workflow-owned artifact ID and pass it to every UI build and build-info invocation, then retry exactly once without buildId when an older strict Gateway rejects the additive client field; prove both release workflows and the old-server connection. Do we have a high-confidence way to reproduce the issue? Yes: source establishes two high-confidence failure paths—two release commands derive different timestamped identities, and an older closed client schema rejects the newly unconditional buildId field. Is this the best way to solve the issue? No: exact artifact comparison is the right owner boundary, but the current branch lacks both a shared release identity and the required legacy-Gateway downgrade path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 36c440aa2b1e. LabelsLabel justifications:
EvidenceWhat 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 (9 earlier review cycles; latest 8 shown)
|
f47eeda to
eb51831
Compare
|
Merged via squash.
|
* fix(ui): fence stale same-version clients by build * test(ui): satisfy build identity lint guards * fix(ui): complete build identity fencing * chore: leave release notes to release prep * test(ui): align build identity fixtures * fix(ui): fence reconnects on pending worker * test(ui): stabilize cross-platform update proof * test(ui): satisfy service worker lint * test(ui): preserve offline socket cohorts
What Problem This Solves
Fixes an issue where already-open Control UI tabs could reconnect after a same-version Gateway deployment and restore a terminal with stale JavaScript that omitted its selected agent owner. The Gateway correctly rejected that ownerless
terminal.openrequest, leaving service-worker-less browser contexts and native WebViews with a failed terminal.Live evidence on deployed
ee6c2cb50df086e83575753313fd5131afe186b6showed a Control UI reconnect at2026-08-14T11:55:47.067Z, followed by an ownerlessterminal.openrejection at11:55:48.510Z.Why This Change Was Made
Control UI clients and the Gateway now exchange a bounded, exact build ID generated from the shared immutable build manifest. A same-origin bundled UI whose identity differs stays outside connected-only state drains, disables terminal availability, and performs one guarded reload; if that reload already ran, the existing refresh card remains visible and actionable.
Legacy Gateways retain package-version fallback. Separately hosted UIs skip comparison by origin, while configured same-origin UI roots explicitly advertise that they are independently built. The Gateway still never infers a missing terminal owner.
The mocked browser transport now closes and opens the Gateway socket cohort present at each offline/online transition. Synchronous replacement sockets survive offline and recover later. Private source-Vite suites explicitly pass HMR through the existing native WebSocket seam, so connectivity tests do not reload their own harness.
Production delta: +175/-13 lines (net +162), justified by the end-to-end artifact identity, reconnect admission boundary, and lifecycle-owned pending-worker fence. Tests and test support: +519/-16 lines (net +503).
User Impact
Operators can leave Control UI tabs and native terminal views open across same-version deployments. Stale bundled documents refresh before any terminal or other connected-only work drains, configured/custom roots remain independent, and a failed automatic refresh presents a visible recovery action instead of an ownerless terminal error.
Evidence
ff4a6a98f0b0a5487ec09e15a7d70555a9f8d047passed all required checks: run 31835068360.--help), 368.8/425 MB (plugins list), 414.5/450 MB (status), and 348.8/500 MB (gateway status). Built-artifact checks passed 1,244 tests plus the TUI PTY lane.git diff --checkpassed.ff4a6a98f0b0a5487ec09e15a7d70555a9f8d047: no accepted/actionable findings (0.94 confidence); final-patch review was also clean (0.99).cbx_19e93504e0aa,run_2821fa968692).terminal.opencalls escape; 4/4 passed (run).