Repository navigation
fix(ui): recover expired sessions after reconnect - #149582
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 15, 2026, 11:46 PM ET / September 16, 2026, 03:46 UTC (Revision 4). ClawSweeper reviewWhat this changesThe Control UI checks established conversation links after reconnect, shows recovery actions for confirmed missing sessions, and adds documentation and regression coverage. Merge readiness✅ Ready for maintainer review This PR remains useful: current main recovers interrupted loads but does not verify already-open conversations after reconnect. The pinned patch has no actionable correctness findings, and the earlier merged recovery PR does not supersede it. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI router turns conversation URLs and Gateway connection events into chat views. Gateway session resolution determines whether an established conversation remains available or should show recovery actions. flowchart TD
A[Open conversation link] --> B[Control UI router]
C[Gateway reconnects] --> B
B --> D[Resolve established session key]
D --> E{Current result}
E -->|Session exists or lookup fails| F[Keep conversation and draft]
E -->|Session confirmed missing| G[Show session recovery actions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +125, Tests +444, Docs +6. Total +575 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep session existence with the Gateway resolver and use the existing missing-session view while preserving surviving conversations, drafts, and explicit creation routes. Do we have a high-confidence way to reproduce the issue? Yes: keep an incognito conversation open while its Gateway restarts and removes it. Current-main routing lacks the existence check, and the supplied investigation and browser regression demonstrate the symptom; this review did not execute it. Is this the best way to solve the issue? Yes: extending the existing router lifecycle and exact-session resolver is a focused repair that avoids a second state owner and preserves creation-route behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d8d7d53d58b0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Merged via squash.
|
* fix(ui): revalidate established sessions after reconnect * chore(ui): document session route data invariants * test(ui): declare canonical progress widget sessions * fix(ui): avoid duplicate session discovery on first connection
What Problem This Solves
Fixes an open incognito conversation turning into an empty, usable chat when a Gateway restart removes the session.
User Impact
The existing conversation now shows Session not found, with actions to open the main session or view sessions, after the Gateway confirms that it no longer exists. Ordinary disconnects preserve the conversation and unsent draft; omission from a filtered session list does not count as deletion. Home and explicit session-creation URLs keep their existing behavior.
Why This Change Was Made
The router already recovers interrupted session loads, but a successfully loaded route survived reconnect without checking whether its session still existed. Recovery now uses the existing exact-session resolver and rejects replies from a retired connection or navigation. Explicit revalidation keeps the established session key and its recorded connection/profile scope, skips retained resolution shortcuts, and treats interrupted discovery as retryable rather than absence.
Evidence
Final real-profile after replay is pending: access to the QA Chrome tab was revoked, and restoration has been requested. Exact-head hosted CI passes; no real-profile live-after claim is made.
Desktop before:

Desktop after:

Mobile before and after
Before:

After:

CI follow-up
The first CI run found two undocumented type assertions at the router's erased-data boundary. Both now document their verified invariant: only the chat/dashboard loader produces these matched results. The exact assertion-safety ratchet, formatting, whitespace checks, and fresh independent review pass. This follow-up changes comments only; the runtime and browser evidence above remains applicable. The final integrated head passes hosted CI.
CI fixture correction
The reconnect verification exposed two progress-widget fixtures that supplied session-list responses without canonical session records. CI correctly navigated to Session not found before reaching either liveness assertion. The unchanged branch reproduces both failures in the original ten-case order; the pre-change baseline passes all ten. Declaring only the existing session keys through the mock Gateway’s canonical sessions input restores all ten passes, without supplying run state or changing product code, assertions, or timeouts. The UI E2E typecheck and fresh independent review pass. The earlier desktop SSH failure remains unexplained; the final integrated head passes its hosted real-Gateway lane.
First-connection resolution repair
The next CI run reproduced a redundant lookup on first connection: the pending startup route was classified as an interrupted established session, so it ran a second exact-session lookup after the loader had already resolved it. Recovery now distinguishes first connection from reconnect, and the loader carries a private cache-source fact so cached data that commits after the first hello is still verified. No second cache or resolution owner was added.
The original registered-router regression and unchanged real-Gateway performance test both fail before this correction. The corrected candidate passes 103 focused cases plus the unchanged real-Gateway performance case and all three reconnect browser cases; each measured desktop/narrow phase has exactly one connection and one resolution. All three affected UI type lanes, scoped typed lint, formatting, and fresh independent P2 review pass. Current head
0aee8999720e98ef8264540265af71878f4e8837passed all 91 checks in CI 35050457882.