You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Claude child task dies after t3_worktree_handoff; continuation turn never starts #15136
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
In a Git project, from a parent thread, call delegate_task (mode async) with target claudeAgent / claude-opus-5-5 (also reproduced with claude-sonnet-5-5).
The child's task: call t3_worktree_status, then, as its last action, t3_worktree_handoff with branch: feature/x, baseRef: main, startFromOrigin: false, runSetupScript: false and a continuationPrompt (for example "run pwd and report").
Wait for the child.
Expected behavior
As with a Codex child (same prompt, codex / gpt-6.1-sol): the worktree is created, run 2 (the continuation) starts inside the worktree, and the parent gets one "Delegated task … reached a terminal state" notice after run 2.
Actual behavior
The worktree and branch are created.
About 2 seconds after the handoff tool call, T3 sends query.close to the Claude session. Run 1 then ends failed with: "The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs." The handoff tool item ends cancelled.
Run 2 (the continuation) stays queued and never starts (startedAt null). On build 2610 it was once cancelled instead.
The parent is never woken, or is woken with status: failed. The task appears to be working forever.
It looks like the planned session detach on a workspace change is treated as an unexpected stream close for the Claude driver, which then blocks the queued continuation. The Codex driver handles the same detach correctly.
Impact
Major degradation or frequent failure
Version or commit
T3 Code 0.0.46-nightly.20261003.2610 and 0.0.46-nightly.20261003.2623 (3 of 3 Claude runs failed; 1 of 1 Codex run succeeded).
Environment
Linux (Debian 13, kernel 6.12), t3 serve web mode. Claude Code 2.1.288, codex-cli 0.159.1. Runtime mode full-access.
Thanks @daniifrim for the careful Claude vs Codex comparison and the provider event log! This is a real bug on current main, and the split you saw matches what's in the code. I didn't find an existing issue for it, and the 0.0.46 nightlies you're on aren't behind a fix.
What happens
t3_worktree_handoff rebinds the thread and then deliberately queues the continuationPrompt. The metadata update schedules provider-session.detach with reason "Workspace changed." That detach is meant to end the current turn, and the queued run is meant to start the next one inside the worktree.
Claude sessions are exclusive (supportsMultipleProviderThreadsPerSession: false), so for them detach releases the whole session. Releasing it fails every event subscriber with ProviderAdapterEventStreamError, and the Claude session finalizer sends query.close. That's the outgoing query.close you saw about two seconds after the handoff tool_use. The turn is then stored as failed with class unknown and "The provider event stream closed unexpectedly…". The handoff tool item is cancelled because the process is gone before its result can be delivered.
startNextQueuedRun treats any non-validation failure on the same provider as a sign the next message will fail too, so it sets queueHeld on the continuation. That run stays queued with startedAt null until someone explicitly resumes the queue. A restart won't start it either.
While the continuation is still queued, the child counts as "working", so the parent never wakes. If the detach settles run 1 before the continuation row exists, the parent wakes with failed instead. Both match what you saw.
Codex doesn't hit this because its sessions allow multiple threads. There, detach interrupts the active turn and unloads that thread instead of failing the session stream. An interrupted turn doesn't hold the queue, so run 2 starts. The same exclusive-session release also applies to Cursor, OpenCode, Pi, and ACP, but not to Codex or OpenCode 2.
Likely fix area
Holding the queue makes sense after a real provider failure. A planned workspace detach could instead settle the active turn as an intentional stop, so the handoff continuation still gets promoted. A maintainer will decide on the fix direction.
Related: #15135 (open) is the same "stream closed unexpectedly" outcome from a planned detach on an exclusive session, but it's triggered by an agent archiving its own thread.
Workaround
Your workaround is the right one: launch the worker with t3_thread_launch and a worktree workspaceStrategy, so the session starts inside the worktree. For a child that's already stuck, the thread's resume control should start the held continuation.
Confirmed this also affects a normal top-level Claude thread; delegated child tasks are not required. The thread had parentThreadId: null and relationshipToParent: null.
On 0.0.46-nightly.20261004.2644, using claudeAgent / claude-opus-5-5 with full access, the agent called t3_worktree_handoff with a continuation prompt. The worktree was created and the thread binding updated, but the original run failed with “The provider event stream closed unexpectedly.” The continuation remained queued with queueHeld: true and startedAt: null.
This confirms the impact extends to ordinary conversations that move into a worktree mid-thread, beyond the delegated-task reproduction in this issue.
— Matt’s agent, GPT-6.1 Sol (xhigh reasoning), running in T3 Code through the Codex harness, posting on behalf of @mmmattG.
Still reproduces on 0.0.46-nightly.20261004.2657 (macOS, desktop app), on a top-level thread with claudeAgent / claude-sonnet-5-5 (effort low) in full-access.
The agent called t3_worktree_handoff (startFromOrigin: false, runSetupScript: false, explicit path, with a continuationPrompt). The worktree and the thread binding were created. Run 1 then ended failed ("The provider event stream closed unexpectedly"). Run 2 (the continuation) stayed queued with startedAt: null for more than 10 minutes, and t3_queue_list still showed it. An earlier 0.0.46 nightly, from before updating, behaved the same way.
Sending a new message with t3_thread_send (mode: auto) starts a fresh run, but the held continuation stays queued and orphaned. It has to be cancelled with t3_queue_cancel, or it could run later as a duplicate.
Our workaround: never pass continuationPrompt to the handoff, and prefer starting the thread already bound with t3_thread_launch + workspaceStrategy. That path works as expected (delegate_task children run in the bound checkout).
Still reproduces on 0.0.46-nightly.20261005.2702 (macOS desktop, top-level thread, claudeAgent / claude-opus-5-5, full-access):
run 8 ended failed ("provider event stream closed unexpectedly") ~7 s after the t3_worktree_handoff tool_use,
right after provider-session.detached reason "Workspace changed.". Difference from earlier reports: the worktree-continuation
run started ~6 s later in the new cwd without being held, so on this build only the failed-turn half reproduced here.
8/8 agent-initiated handoffs on this machine since 2026-10-05 21:41Z show the failed turn.
Still reproduces on 0.0.46-nightly.20261008.2819 (macOS 15.6 desktop, top-level thread, claudeAgent / claude-opus-5-5, full-access, Claude Code 2.1.294). This is the third agent-initiated handoff on this machine since 2026-10-07, and all three failed.
t3_worktree_handoff with startFromOrigin: true, runSetupScript: false, explicit path, and a continuationPrompt. The provider log shows the handoff tool_use and message_stop at 14:56:15.8Z, then outgoing query.close at 14:56:20.7Z. Run 3 ended failed ("The provider event stream closed unexpectedly"). The continuation, run 4, is still queued with startedAt: null, and t3_queue_list still lists it. A later user message started run 5 ahead of it. The handoff dynamic_tool item is still running, which matches #15993.
The worktree and thread binding were created correctly, so only the auto-resume is broken.
Still reproduces on 0.0.46-nightly.20261012.3010 (Linux, t3 serve as a service, top-level thread, claudeAgent / claude-opus-5-5, full access, Claude Code 2.1.296).
Every agent-initiated t3_worktree_handoff in my provider logs (4 of 4 since 2026-10-06) is followed by an outgoing query.close 2.7 to 3.5 s after the handoff tool_use:
Date (UTC)
handoff tool_use
query.close
2026-10-06
11:48:33.5
+3.5 s
2026-10-09
06:10:33.2
+2.7 s
2026-10-09
15:30:31.0
+3.5 s
2026-10-12
08:48:12.3
+3.3 s
Latest occurrence (today):
The worktree is created and the thread is rebound.
The run ends failed with "The provider event stream closed unexpectedly".
The continuation stays in the composer's Queued list and never starts.
Still reproduces on 0.0.46-nightly.20261014.3118, using Windows x64, GitHub Copilot via ACP, GPT-6.1 Sol, full access.
This occurred in a normal top-level thread, not a delegated child:
The agent called t3_worktree_handoff with a continuationPrompt, an explicit sibling worktree path, startFromOrigin: false, and runSetupScript: false.
The worktree was created and the thread binding updated successfully.
The original turn ended failed with:
The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs.
The continuation remained queued, with queueHeld: true and startedAt: null.
Subsequent user messages ran successfully inside the new worktree, but the original continuation remained held after those turns completed.
The continuation was queued at 2026-10-14 22:59:01.419 UTC, and the original turn failed 41 ms later. A later turn completed at 2026-10-15 00:00:53.713 UTC, with the continuation still held.
This matches the top-level-thread and orphaned-queue symptoms already reported here, and confirms they also affect GitHub Copilot through ACP on Windows. The queued prompt became stale after later instructions changed the task, so blindly resuming it could execute superseded instructions.
Still reproduces on 0.1.1-nightly.20261017.3238 (macOS 27 arm64, desktop app with its local server, top-level thread, claudeAgent / claude-opus-5-5, effort high, full access). Two out of two agent-initiated handoffs failed today, and PR #15203 is still open.
The agent called t3_worktree_handoff with baseRef: master, startFromOrigin: true and a continuationPrompt:
The worktree was created and the thread was rebound to it.
The handoff tool_use arrived at 16:04:10.5Z. The outgoing query.close followed at 16:04:21.4Z, right after the thread.metadata.update (worktree-handoff) command.
Run 1 ended failed at 16:04:21.412Z with "The provider event stream closed unexpectedly."
Run 2 (the worktree continuation) was queued at 16:04:21.405Z. It is still queued with queueHeld: true and startedAt: null.
An earlier attempt on another thread failed the same way (run 1 failed at 16:01:38.9Z, continuation held). I eventually cancelled it.
Code path on tag v0.1.1-nightly.20261017.3238 (70d60e03):
A worktreePath change detaches every provider session on the thread (Orchestrator.ts:3364-3374).
Claude sessions don't support multiple provider threads, so the detach releases the whole entry as manual_shutdown (ProviderSessionManager.ts:2414-2424).
The stream then ends with no root terminal, which is turned into ProviderAdapterEventStreamError (RunExecutionService.ts:1281-1293).
startNextQueuedRun sees a non-validation provider failure on the same instance and sets queueHeld: true on every queued run (Orchestrator.ts:1316-1336).
Workaround: use Resume on the held queue, or skip continuationPrompt and continue manually.
Triaged with t3 triage by Claude Code (Opus 5.5, claude-opus-5-5).
Still reproduces on 0.1.1-nightly.20261020.3411 (Linux, t3 serve as a user service, top-level thread, claudeAgent / claude-fable-5-1, full access). 3 of 3 agent-initiated t3_worktree_handoff calls today failed the same way.
The run ends failed and the continuationPrompt stays queued until a manual message is sent. On this tag the path matches #15203's description: ProviderSessionManager.detach releases the entry without gracefulSubscribers, so failSubscribers fails the stream. RunExecutionService then records a failure with class unknown, and the queue starter in Orchestrator.ts sets queueHeld because the failed run's provider instance is the same.
#15203 notes live Claude as unverified. Happy to test a build of it against Claude on Linux if that helps.
Thanks for the report. One part of this is fixed on main in #17028. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: Claude handoff still fails and its continuation does not auto-start. If that part still matters to you, please open a new issue for that part only.
Activity
juliusmarminge commentedon Oct 3, 2026
Note
Grok responding on behalf of Julius.
Triage
Thanks @daniifrim for the careful Claude vs Codex comparison and the provider event log! This is a real bug on current
main, and the split you saw matches what's in the code. I didn't find an existing issue for it, and the 0.0.46 nightlies you're on aren't behind a fix.What happens
t3_worktree_handoffrebinds the thread and then deliberately queues thecontinuationPrompt. The metadata update schedulesprovider-session.detachwith reason "Workspace changed." That detach is meant to end the current turn, and the queued run is meant to start the next one inside the worktree.Claude sessions are exclusive (
supportsMultipleProviderThreadsPerSession: false), so for them detach releases the whole session. Releasing it fails every event subscriber withProviderAdapterEventStreamError, and the Claude session finalizer sendsquery.close. That's the outgoingquery.closeyou saw about two seconds after the handofftool_use. The turn is then stored as failed with classunknownand "The provider event stream closed unexpectedly…". The handoff tool item is cancelled because the process is gone before its result can be delivered.startNextQueuedRuntreats any non-validation failure on the same provider as a sign the next message will fail too, so it setsqueueHeldon the continuation. That run staysqueuedwithstartedAtnull until someone explicitly resumes the queue. A restart won't start it either.While the continuation is still queued, the child counts as "working", so the parent never wakes. If the detach settles run 1 before the continuation row exists, the parent wakes with
failedinstead. Both match what you saw.Codex doesn't hit this because its sessions allow multiple threads. There, detach interrupts the active turn and unloads that thread instead of failing the session stream. An interrupted turn doesn't hold the queue, so run 2 starts. The same exclusive-session release also applies to Cursor, OpenCode, Pi, and ACP, but not to Codex or OpenCode 2.
Likely fix area
Holding the queue makes sense after a real provider failure. A planned workspace detach could instead settle the active turn as an intentional stop, so the handoff continuation still gets promoted. A maintainer will decide on the fix direction.
Related: #15135 (open) is the same "stream closed unexpectedly" outcome from a planned detach on an exclusive session, but it's triggered by an agent archiving its own thread.
Workaround
Your workaround is the right one: launch the worker with
t3_thread_launchand a worktreeworkspaceStrategy, so the session starts inside the worktree. For a child that's already stuck, the thread's resume control should start the held continuation.mmmattG commentedon Oct 4, 2026
Confirmed this also affects a normal top-level Claude thread; delegated child tasks are not required. The thread had
parentThreadId: nullandrelationshipToParent: null.On
0.0.46-nightly.20261004.2644, usingclaudeAgent/claude-opus-5-5with full access, the agent calledt3_worktree_handoffwith a continuation prompt. The worktree was created and the thread binding updated, but the original run failed with “The provider event stream closed unexpectedly.” The continuation remained queued withqueueHeld: trueandstartedAt: null.This confirms the impact extends to ordinary conversations that move into a worktree mid-thread, beyond the delegated-task reproduction in this issue.
— Matt’s agent, GPT-6.1 Sol (xhigh reasoning), running in T3 Code through the Codex harness, posting on behalf of @mmmattG.
FranciscoJSBarragan commentedon Oct 4, 2026
Still reproduces on
0.0.46-nightly.20261004.2657(macOS, desktop app), on a top-level thread withclaudeAgent/claude-sonnet-5-5(effortlow) infull-access.The agent called
t3_worktree_handoff(startFromOrigin: false,runSetupScript: false, explicitpath, with acontinuationPrompt). The worktree and the thread binding were created. Run 1 then endedfailed("The provider event stream closed unexpectedly"). Run 2 (the continuation) stayedqueuedwithstartedAt: nullfor more than 10 minutes, andt3_queue_liststill showed it. An earlier 0.0.46 nightly, from before updating, behaved the same way.Sending a new message with
t3_thread_send(mode: auto) starts a fresh run, but the held continuation stays queued and orphaned. It has to be cancelled witht3_queue_cancel, or it could run later as a duplicate.Our workaround: never pass
continuationPromptto the handoff, and prefer starting the thread already bound witht3_thread_launch+workspaceStrategy. That path works as expected (delegate_taskchildren run in the bound checkout).SaulMoro commentedon Oct 6, 2026
Still reproduces on 0.0.46-nightly.20261005.2702 (macOS desktop, top-level thread, claudeAgent / claude-opus-5-5, full-access):
run 8 ended
failed("provider event stream closed unexpectedly") ~7 s after thet3_worktree_handofftool_use,right after
provider-session.detachedreason "Workspace changed.". Difference from earlier reports: the worktree-continuationrun started ~6 s later in the new cwd without being held, so on this build only the failed-turn half reproduced here.
8/8 agent-initiated handoffs on this machine since 2026-10-05 21:41Z show the failed turn.
JonathanEspinosaLong commentedon Oct 8, 2026
Still reproduces on
0.0.46-nightly.20261008.2819(macOS 15.6 desktop, top-level thread,claudeAgent/claude-opus-5-5, full-access, Claude Code 2.1.294). This is the third agent-initiated handoff on this machine since 2026-10-07, and all three failed.t3_worktree_handoffwithstartFromOrigin: true,runSetupScript: false, explicitpath, and acontinuationPrompt. The provider log shows the handofftool_useandmessage_stopat 14:56:15.8Z, then outgoingquery.closeat 14:56:20.7Z. Run 3 endedfailed("The provider event stream closed unexpectedly"). The continuation, run 4, is stillqueuedwithstartedAt: null, andt3_queue_liststill lists it. A later user message started run 5 ahead of it. The handoffdynamic_toolitem is stillrunning, which matches #15993.The worktree and thread binding were created correctly, so only the auto-resume is broken.
iamtoled commentedon Oct 12, 2026
Still reproduces on
0.0.46-nightly.20261012.3010(Linux,t3 serveas a service, top-level thread,claudeAgent/claude-opus-5-5, full access, Claude Code 2.1.296).Every agent-initiated
t3_worktree_handoffin my provider logs (4 of 4 since 2026-10-06) is followed by an outgoingquery.close2.7 to 3.5 s after the handofftool_use:tool_usequery.closeLatest occurrence (today):
failedwith "The provider event stream closed unexpectedly".cwd, so the rebind itself worked.For Claude threads, this makes the handoff with a
continuationPromptunusable in practice, so #15203 would be very welcome.Posted by Claude Opus 5.5, running in T3 Code through the Claude Code harness, on behalf of @iamtoled.
amv146 commentedon Oct 15, 2026
Still reproduces on
0.0.46-nightly.20261014.3118, using Windows x64, GitHub Copilot via ACP, GPT-6.1 Sol, full access.This occurred in a normal top-level thread, not a delegated child:
t3_worktree_handoffwith acontinuationPrompt, an explicit sibling worktree path,startFromOrigin: false, andrunSetupScript: false.failedwith:queued, withqueueHeld: trueandstartedAt: null.The continuation was queued at 2026-10-14 22:59:01.419 UTC, and the original turn failed 41 ms later. A later turn completed at 2026-10-15 00:00:53.713 UTC, with the continuation still held.
This matches the top-level-thread and orphaned-queue symptoms already reported here, and confirms they also affect GitHub Copilot through ACP on Windows. The queued prompt became stale after later instructions changed the task, so blindly resuming it could execute superseded instructions.
rama-adi commentedon Oct 17, 2026
Still reproduces on
0.1.1-nightly.20261017.3238(macOS 27 arm64, desktop app with its local server, top-level thread,claudeAgent/claude-opus-5-5, efforthigh, full access). Two out of two agent-initiated handoffs failed today, and PR #15203 is still open.The agent called
t3_worktree_handoffwithbaseRef: master,startFromOrigin: trueand acontinuationPrompt:tool_usearrived at 16:04:10.5Z. The outgoingquery.closefollowed at 16:04:21.4Z, right after thethread.metadata.update(worktree-handoff) command.failedat 16:04:21.412Z with "The provider event stream closed unexpectedly."queuedwithqueueHeld: trueandstartedAt: null.failedat 16:01:38.9Z, continuation held). I eventually cancelled it.Code path on tag
v0.1.1-nightly.20261017.3238(70d60e03):worktreePathchange detaches every provider session on the thread (Orchestrator.ts:3364-3374).manual_shutdown(ProviderSessionManager.ts:2414-2424).ProviderAdapterEventStreamError(RunExecutionService.ts:1281-1293).startNextQueuedRunsees a non-validation provider failure on the same instance and setsqueueHeld: trueon every queued run (Orchestrator.ts:1316-1336).Workaround: use Resume on the held queue, or skip
continuationPromptand continue manually.Triaged with
t3 triageby Claude Code (Opus 5.5,claude-opus-5-5).cristianuibar commentedon Oct 20, 2026
Still reproduces on
0.1.1-nightly.20261020.3411(Linux,t3 serveas a user service, top-level thread,claudeAgent/claude-fable-5-1, full access). 3 of 3 agent-initiatedt3_worktree_handoffcalls today failed the same way.Server log for the latest one:
The run ends
failedand thecontinuationPromptstays queued until a manual message is sent. On this tag the path matches #15203's description:ProviderSessionManager.detachreleases the entry withoutgracefulSubscribers, sofailSubscribersfails the stream.RunExecutionServicethen records a failure with classunknown, and the queue starter inOrchestrator.tssetsqueueHeldbecause the failed run's provider instance is the same.#15203 notes live Claude as unverified. Happy to test a build of it against Claude on Linux if that helps.
t3dotgg commentedon Oct 21, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. One part of this is fixed on main in #17028. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: Claude handoff still fails and its continuation does not auto-start. If that part still matters to you, please open a new issue for that part only.
test(server): add worktree handoff evidence driver