fix(web): keep legacy thread routes stable during reconnect #10604
main fromrefs/pull/10604/head·opened View on GitHubOpening a valid thread deep link during legacy connection synchronization can redirect to an unrelated thread when cached or HTTP shell data is mistaken for authoritative state. Routes now wait for live shell authority before deciding a thread is missing. Already available thread detail or a local draft stays visible while shell synchronization is pending.
Legacy servers receive a full socket snapshot request because their cursor replay has no completion signal. Marker-capable servers retain cursor replay and completion markers. Same-session subscriptions reuse the available snapshot; a new session refreshes it. The shared synchronization behavior also serves mobile, whose missing-thread route policy remains separate.
Verified after integrating upstream main 35be904, using Node24.13.1:
- 21 focused route/shell synchronization tests passed and were independently repeated.
- Four regression cases fail before the repair and pass afterward: cached/synchronizing shell combined with available detail/draft.
- Web and client-runtime typechecks and targeted lint/format passed; repair checks repeated for the changed route helper/tests.
- Fresh independent GPT-6.1 Sol review covered all five contribution files and found no actionable findings after the repair.
Current browser/mobile/relay proof is still missing for the integrated candidate, particularly delayed shell versus available detail, valid/missing deep links, offline rendering and reconnect. The historical captures below predate the new available-detail repair and current integration; they do not establish those checks.
Historical Linux Chromium before/after evidence
The following is the original capture record, retained with its original revisions and verification limits.
Same Linux Chromium web scenario at base 09e8de9c655ae85410bf6b00446f272a01da81c7 and candidate a325b17ed3e398a88ce10de7744008c064debf7e: an isolated fixture retains the HTTP shell response from before the target thread was created, omits the completion-marker capability, and holds live shell/target-detail delivery until the initial route is observed. Delivery then resumes. Both clients use the same exact-base backend; Chromium local-network permission is scoped to that isolated origin.
Before: the valid deep link redirects to an unrelated New thread and remains there after live delivery resumes.

Full before recording · Full before screenshot
After: the requested Reconnect target conversation stays selected and opens after the live snapshot arrives.

Full after recording · Full after screenshot
The GIFs use the same sidebar crop and 12 fps sampling, with labels added above the captured frame. No temporal cuts or speed changes. Full recordings provide context. Files were anonymously downloaded again, hash-verified, decoded, and inspected by sampled frames; interactive browser playback was not inspected. Raw recordings, receipts, and capture script · Media receipt.
Original fix: GPT-5.6 Sol in the Codex harness. Current integration and repair: GPT-6 Astra; independent review: GPT-6.1 Sol, both in the Codex harness via T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
All clear
Posted via Macroscope — Effect Service ConventionsApprovability#
Verdict: Approved at
1cd6689Macroscope's review found this PR approvable — The PR narrowly corrects deep-link and reconnect handling by distinguishing cached data from live shell authority and using the existing socket snapshot protocol for legacy servers. Its production changes are localized, backward-compatible at the protocol level, and accompanied by focused route and synchronization regression tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
5b855a82-bb05-425b-b80c-59923fa2b297📥 Commits
Reviewing files that changed from the base of the PR and between 9bf1e91ed7308f7ca448e9abb4902a1d3ba2c924 and 1cd6689fe10a17d7d122efc9008c3a75c4ad59a4.
📒 Files selected for processing (2)
apps/web/src/threadRoutes.test.tsapps/web/src/threadRoutes.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough#
Shell synchronization now handles sessions without completion markers by requesting a complete socket snapshot after an HTTP snapshot. Thread routes treat only
liveshell status as authoritative and keep available details or drafts ready during incomplete bootstrap.Changes#
Snapshot authority
Layer / File(s) Summary Legacy shell synchronization
packages/client-runtime/src/state/shell.ts,packages/client-runtime/src/state/shell-sync.test.tsResumption checks completion-marker support and snapshot session state. Sessions without markers remain synchronizing after an HTTP snapshot and request a complete socket snapshot. Regression tests cover the transition to live and resubscription behavior. Thread-route authority
apps/web/src/threadRoutes.ts,apps/web/src/components/ThreadRouteView.tsx,apps/web/src/threadRoutes.test.tsAdded isThreadRouteSnapshotAuthoritative. Thread bootstrap is complete only when shell status islive. Existing details and drafts render as ready during incomplete bootstrap. Tests cover snapshot authority and render states.Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)#
sequenceDiagram participant Shell as Shell synchronization participant HTTP as HTTP snapshot participant Socket as Socket snapshot Shell->>HTTP: Load snapshot when session has none HTTP-->>Shell: Apply snapshot Shell->>Socket: Request complete snapshot Socket-->>Shell: Apply snapshot and become liveMerge Risk: ⚪ Minimal · up to
1cd66Legacy sessions wait for a full socket snapshot before missing threads are treated as authoritative, while available details and drafts remain visible. No concrete merge-blocking risk is established.
Architecture Summary#
Architecture risk: 🔵 Low · up to
1cd66The change affects 2 systems.
Changed systems:
apps/web,packages/client-runtimeArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
- observed — apps/web (ui) was modified; 3 changed files map to changed impact.
- observed — packages/client-runtime (library) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in packages/client-runtime/src/state/shell-sync.test.ts: Extended the local session helper with an optional completion-marker setting; disabled markers produce an empty initial configuration while preserving the existing default.
- observed — Modified behavior in packages/client-runtime/src/state/shell-sync.test.ts: Added regression coverage for legacy sessions without completion markers, including synchronizing state after the HTTP snapshot, transition to live on a socket snapshot, snapshot replacement, and avoidance of additional HTTP loader calls during resubscription.
- observed — Modified behavior in apps/web/src/components/ThreadRouteView.tsx: Imports
isThreadRouteSnapshotAuthoritativefor determining whether the thread-route snapshot is authoritative. - observed — Modified behavior in apps/web/src/components/ThreadRouteView.tsx:
bootstrapCompletenow uses the shell status authority check instead of treating any present snapshot as complete.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: stabilizing legacy thread routes during reconnect. Description check ✅ Passed The description clearly covers the problem, implementation, cross-client impact, focused verification, test results, and known verification limits. It is detailed and directly related to the pull requ… - Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Friendly review nudge @juliusmarminge @maria-rcks — this is mergeable and hasn't had a maintainer pass yet. Independent bot/agent reviews have run with findings triaged in-commit (see receipts in earlier comments). Full queue context and status: #10688.
Heads-up on the
Release Smokefailure on the latest head: it's unrelated to this diff. The smoke job deletespnpm-lock.yamland re-resolves the workspace;expo-audiois ranged~57.0.4and npm now serves57.0.5, so the declaredexpo-audio@57.0.4patch comes back unused andvp install --lockfile-onlyexits withERR_PNPM_UNUSED_PATCH. Needs a patch bump or a version pin on main — every PR will hit this until then.macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Note
This comment is posted by Julius' dot
Closing for missing verification of the current loading transition. The PR says its screenshots and recordings predate the change that makes an available thread or draft ready before shell bootstrap completes. The focused tests cover the decision logic, but the changed client transition is still unshown. The verification rule requires evidence of that behavior. Add before/after screenshots and a short recording of the current integrated client through this ordering, with the environment and observed results, then request reconsideration.
juliusmarminge closed this
Follow-up on the closing note: the missing verification is now provided in the focused replacement #14697. GitHub wouldn't let me reopen this PR.
- The behavior is now a triaged bug, #14689. The maintainer triage set the intended behavior: stay on the link while the shell is cached or synchronizing, show content that has already loaded, and redirect a missing or deleted thread only once the shell is live.
- #14697 is narrower than this PR. It keeps only the route change (3 files on current
main) and drops the legacy shell resubscription change, which the fix doesn't need. - It includes before/after recordings of the #14689 scenario (stale cache, thread created elsewhere, link opened, then a reconnect) on
mainb33eda1and on the fix, with the environment, the focused test results, and what wasn't checked.
Could you assess #14697 for review in place of this PR?
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed
All clear
Posted via Macroscope — Effect Service Conventions