Repository navigation
fix(native chat): retain transcript while reconnecting (STA-3333) - #12495
Conversation
A manual retry closes the client and opens a fresh one, so the chat session hook saw a new client under an unchanged identity, dropped its settled read, and handed out an empty list — the transcript collapsed to a full-screen spinner until the swapped client's snapshot landed. Hold the last settled list per identity (captured post-commit) and keep rendering it while the re-read is in flight. `transcriptLoading` still gates consumers that decide from an empty transcript, so the launch-draft seed is unaffected. The held list is keyed by a new `sourceIdentity` (host/workspace) in addition to agent/session/transcript, so it can never serve another source's messages. Refs STA-3333.
📝 WalkthroughWalkthroughThe native chat controller now creates a shared host/worktree 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…rame The re-subscribe lands a commit after the first render of the swap, so a regression that cleared the held list there left frame 0 green and still blanked the transcript. Verified: clearing the cache in the subscribe cleanup now fails this test, where before only the view-toggle test caught it.
The cache this PR adds keeps the previous list rendered while a swapped client re-reads. useMobileNativeChatPrompts was the one consumer reading `messages` without honouring `transcriptLoading`, so an ask answered on the terminal resurrected as a live, tappable card during that window. Gating on `transcriptLoading` is exactly base behaviour: `setRead` only ever stores 'ready'/'error', so status==='loading' implied an empty list before this PR. The live `askFromStatus` path is untouched.
Emulator QA — A/B on a real iOS Simulator (STA-3333 / #12495)Ran Rig
Result
Same device, same mock, same tap sequence, same 15s stall — only the hook module differed.
Desktop smoke (
|
|
Final QA evidence for PR head Electron smoke on final head — passed CDP-only validation with an isolated profile rendered the app normally. Interactive snapshot succeeded; renderer console and page errors were empty. iOS manual reconnect — passed Dedicated iPhone 17 Pro simulator with an isolated four-message transcript and 15-second delays on both Disconnected state retained all four messages and gated the composer: After the mock restarted, manual reconnect was tapped at 18:50:24Z. AX at +3s—definitively inside the 15-second replacement-client read—showed ALPHA/BRAVO/CHARLIE/DELTA exactly once at their original frames. The held screenshot was captured at +4s: Post-settle AX at +28s showed the same four messages exactly once at identical frames, with no duplicate or scroll jump: The held and post-settle PNGs are bit-for-bit identical (SHA-256 Final validation: root focused 35/35, full mobile 3,207 passed/3 skipped, root/mobile typechecks, targeted format/lint, max-lines, reliability, and changed-code quality all passed. A fresh same-model review of the final pushed head returned |
…ablyai#12495) * fix(mobile): keep the cached transcript visible while reconnecting A manual retry closes the client and opens a fresh one, so the chat session hook saw a new client under an unchanged identity, dropped its settled read, and handed out an empty list — the transcript collapsed to a full-screen spinner until the swapped client's snapshot landed. Hold the last settled list per identity (captured post-commit) and keep rendering it while the re-read is in flight. `transcriptLoading` still gates consumers that decide from an empty transcript, so the launch-draft seed is unaffected. The held list is keyed by a new `sourceIdentity` (host/workspace) in addition to agent/session/transcript, so it can never serve another source's messages. Refs STA-3333. * test(mobile): assert the whole reconnect window, not just its first frame The re-subscribe lands a commit after the first render of the swap, so a regression that cleared the held list there left frame 0 green and still blanked the transcript. Verified: clearing the cache in the subscribe cleanup now fails this test, where before only the view-toggle test caught it. * fix(mobile): don't derive a tappable ask card from the held transcript The cache this PR adds keeps the previous list rendered while a swapped client re-reads. useMobileNativeChatPrompts was the one consumer reading `messages` without honouring `transcriptLoading`, so an ask answered on the terminal resurrected as a live, tappable card during that window. Gating on `transcriptLoading` is exactly base behaviour: `setRead` only ever stores 'ready'/'error', so status==='loading' implied an empty list before this PR. The live `askFromStatus` path is untouched. * chore: keep merge formatting scoped






Summary
Manual reconnect no longer blanks an already-settled native-chat transcript while the replacement client reloads the same conversation.
mainbehavior for mobile replay/pagination fencing, session options, prompt dismissal, and sticky-status gating.main.Refs STA-3333.
Performance and safety
The cache is hook-local, one-entry, and identity-bounded. It adds no polling, global state, unbounded growth, broad scans, or message copying. SSH-backed runtimes and folder workspaces use the same opaque identity inputs as local git worktrees.
Testing
CLEANwithout edits.Screenshots
See the final QA evidence comment on this PR. Attachments are hosted outside the branch diff.