Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused preview automation bug fix that adds optional thread-focus metadata and a narrowly scoped host-selection preference, while preserving existing assignments and older-client compatibility. The behavior is covered by a regression test and does not change product defaults or static-analysis configuration. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughPreview hosts now report their active thread ID. The broker stores that ID and uses it to prefer a host showing the requested thread when selecting a host for a new session. ChangesPreview host routing
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant AppRoot
participant PreviewAutomationHosts
participant PreviewAutomationBroker
participant MCPCaller
AppRoot->>PreviewAutomationHosts: Pass routeThreadRef
PreviewAutomationHosts->>PreviewAutomationBroker: Report activeThreadId
MCPCaller->>PreviewAutomationBroker: Invoke request for thread
PreviewAutomationBroker->>PreviewAutomationBroker: Rank matching activeThreadId
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The thread-aware routing change is ready to merge after normal checks; navigating away from a thread does not leave stale host preference behind. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to A thread-aware routing preference should keep new tabs with the window showing their thread. The main remaining risk is that a delayed focus update could steer a new session to the wrong desktop and leave it pinned there. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Fixes #13771.
What Changed
Each desktop window now adds the thread it is showing to its preview host focus report, as an optional
activeThreadId. When no host owns the target tab, the broker ranks hosts showing the requested thread ahead of focus order. The field is optional, so older clients connect as before and rank lower.PreviewAutomationHostssits outside the router, soAppRootreads the routed thread withuseRouterState({ router })and passes it down. Each environment's host reports it only for its own environment.Why
#13064 routes a new session to the client that owns or shows the tab. When no tab exists yet, it falls back to the most recently focused window. With two machines connected, that is often the other machine, because the user just clicked into it. The tab then opens on a machine that is not showing the thread, with its own network and browser profile, and the session stays pinned there.
Validation
vp test runfor the broker andPreviewAutomationHoststests: 43 passed.tsc --noEmitis clean forapps/server,apps/webandpackages/contracts. Targeted lint shows one existing React refs warning inPreviewAutomationHosts.tsxthat this PR does not touch.preview_openwent to the VM because it was the last focused window. With it, a freshpreview_openopened on the desktop showing the thread. The desktop was probably focused at that moment, so the unit test is what covers the ranking.Surfaces: desktop only, since preview hosts run in Electron. Web and mobile are unchanged. No UI change.
Checklist
Model: Claude Opus 5.5 in Claude Code, running in T3 Code.
Summary by CodeRabbit