perf: read persisted remote tails before the web connection
A cold remote chat now asks this Mac's daemon for its persisted peer snapshot on a chat.tail.get memory miss. Both native bridge handlers forward asynchronously without waiting for the page's web connection; shared web retains the peer, generation and capture time until live attach reconciles it. The existing bounded Rust snapshot store remains the owner of persistence.
Leo (2026-11-03): "the text shows up right on click but the actual thing loads a second later"; "you should be able to simply see the text rendered instantly wherever it is"; "even for remote things it should be fast". This supersedes the memory-only cache design of #23131; design: leo-workspace design/chat-transcript.md (settled rule).
Prior art: #32652 is the separate mobile/classic tailer; #32808 and #32813 provide older-room/reveal behavior, preserved here. Builds on #25474/#25475 peer snapshots and #32735 early cached draw. Prior-art initially NOT CHECKED (broker auth unavailable), then re-run before push; merged changes inspected in the shared history.
The native forwarding, shared-web provenance and lifecycle fence ship together because their correctness depends on one another. Most added lines are the cold-open/click benchmark and regressions; disk erasure remains separate in #33207.
Validation at 599d6c5d86dcea45025f91c9328d5d22b55a1dd4: 77 focused web tests passed; removing snapshot adaptation makes the provenance regression fail. Formatting, lint and types passed. ChatTailCacheTests passed all 12 tests on a fleet Mac, including queued reply → sign-out → later sign-in → old reply discarded; CmuxNext compile passed. Independent Opus SHIP. The broader web check reports a design-token failure in unchanged cloudStart.css; all eight routed webview verdicts passed at this head. Native-ready rendering is separate work. Direct RemoteAcpmuxWire capture is follow-up #33158; surviving old-page writes after a later sign-in are fix-forward #33239.
Scene: agent-pane.peer-copy/cold-long-chat-connecting.
Changelog
Fixed: cold remote chats can show their cached tail before reconnecting.
Observed / Not run
Observed: focused browser tests, native cache tests, and the synthetic browser comparison below. Not run: native click-to-final-frame measurement against a GCP peer.
Performance
| Metric | Before | After | Delta | Harness/run |
|---|---|---|---|---|
| Cold remote click → first tail paint (median, 3 rounds) | 2066.8 ms | 135.3 ms | −1931.5 ms (−93.5%) | run 41595248603, chat-switch.bench.ts, same-head synthetic tail absent/present, 300 turns, 2 s attach |
| Reconcile max scrollTop drift | 0 px | 0 px | 0 px | Same run/harness |
| Reconcile max scrollHeight drift | 0 px | 0 px | 0 px | Same run/harness |
| Click → reconciled paint | 2080.9 ms | 2031.7 ms | −49.2 ms | Same run/harness |
These are browser-harness measurements of the host-tail availability seam, not native bridge or fleet-Mac click timings. Remote GCP native capture and cold-local final-frame evidence remain follow-up #33240. The banner probe is false for this reachable slow peer because existing App.tsx only renders PeerCopyBanner for offline peers; provenance is retained and tested separately.
Sign-out increments the native cache lifecycle generation before any await, drops an in-flight reply from an earlier lifecycle, and refuses page reposts until the next sign-in. No existing Rust policy FFI carries this lifecycle; the single boundary generation comparison stays in the native forwarding plumbing rather than introducing an FFI for one integer. The queued-reply regression also covers signing back in before the old reply arrives.
No new product polling or render loop. The benchmark observers and delayed replies stop after reconciliation or its bounded timeout and are cleaned up on teardown. The optional native read has a 200 ms deadline and closes its socket on success, failure, cancellation or timeout. Existing page cache bounds and 250 ms read budget remain. Risk: early stale provenance must never merge with a recreated remote session; the regression exercises that boundary.
🤖 Generated with Codex
Agent session: agent session