Repository navigation
fix(clients): allow portable provider handoffs after detach - #24641
juliusmarminge wants to merge 5 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thread ref Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…offs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This focused client-runtime fix removes only an obsolete native-reference prerequisite for completed detached threads while retaining source-thread, session-capability, and active-run guards. It adds regression coverage without changing schemas, server adapters, product defaults, or static-analysis configuration. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Update handoff eligibility and tests packages/client-runtime/src/state/threadWorkflows.ts, packages/client-runtime/src/state/threadWorkflows.test.ts |
A matching active provider thread can qualify for handoff without a native thread reference. Tests cover the absence of provider threads and verify that a ready attached session qualifies only when it supports provider switching via handoff. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#24579: Changes server delivery of portable context handoffs, which this PR enables the client to start when the source session is detached.
- pingdotgg/t3code#23971: Changes project and worktree handoffs around provider session replacement; this PR addresses client eligibility for a later provider handoff.
- pingdotgg/t3code#24545: Changes run finalization for successful worktree handoffs; this PR addresses client eligibility in the detached handoff flow.
Suggested reviewers: yash-singh1, macroscopeapp
Merge Risk: 
Minimal · up to 271e7
-
No concrete current-head defect or merge-blocking risk was established.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "fix(clients): allow portable provider handoffs after detach" follows conventional commit format and matches the main change. The raw summary shows that threadSupportsProviderHandoff no longer requires a non-null nativeThreadRef on the active provider thread, and the PR objectives confirm this removes the native-thread-reference prerequisite for switching providers on a detached thread. The title names the affected area (clients), the behavior (portable provider handoffs), and the condition (after detach). It is concise and specific, and it does not use vague terms.
Full details: Description check
-
Explanation
The description follows the repository template sections: Problem, Change, Scope and approval, and Verification. The Problem section states the bug and expected behavior. The Change section explains the fix and the components it touches. The Scope and approval section links the original work in
#19687, explains the takeover, and states why the change is focused. The Verification section gives specific tests, results, and manual checks, and it notes what was not checked, including mobile and native desktop shells. The description is long and includes some process detail, such as model names and review rounds, that does not affect the template requirements. The required information is present. The Scope and approval section does not link a maintainer approval comment for the direction, which the template asks for when the change is not a very small obvious fix. This is a gap, but the section otherwise addresses scope.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Problem
A detached thread could not switch providers when the outgoing provider had never returned a native thread reference, even though the server could hand off its saved history.
Change
Allow the existing portable handoff once there is no live session or active run. Keep negotiated session capabilities and the active-run guard authoritative. Web, desktop and mobile consume the shared helper; no server or adapter behavior changes.
Scope and approval
This is a focused fix to the existing provider-switch workflow. Retains the work by @FabioLukas123 in #19687, with the pinned main revision merged and original commits preserved. It adds no providers, model IDs or wire fields.
Verification
Root selected Fixture Handoff Target and sent through the real app pipeline to a copied repository Codex mock peer. The transport record contains thread creation, the exact prior-history marker
T3_19687_CONTEXT_MARKERinthread/inject_items, and a completed subsequent turn. This proves history reached the target transport; it makes no claim about external model comprehension.No external model or network call was made by the mock. Native desktop/mobile shells were not independently exercised. An identical temporary startup-recovery bypass preserved synthetic control rows on both variants; it was removed, the isolated database/settings restored, and the test server stopped.
Current-head CI runs after this update; earlier checks cover the original head only.
Implementation: Claude Fable 5.1. Test assessment and independent review: Claude Opus 5.5. Independent review and coordination: GPT-6.1 Sol, through Claude Code and Codex in T3 Code.
Takeover
Credit to @FabioLukas123 for identifying the detached-session regression in #19687.
Rebuilt on the pinned main revision: remove only the native-reference prerequisite; keep the source provider-thread association so saved history is handed off rather than silently omitted.
The original description above is preserved as historical context; verification below describes this replacement at 271e7b6f11.
Evidence
Before 952921f39a, after 271e7b6f11. Baseline/delivery matrix, completed controls/routes matrix.
Verification log