[Bug]: Claude child task dies after t3_worktree_handoff; continuation turn never starts #15136
Before submitting#
- 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(modeasync) with targetclaudeAgent/claude-opus-5-5(also reproduced withclaude-sonnet-5-5). - The child's task: call
t3_worktree_status, then, as its last action,t3_worktree_handoffwithbranch: feature/x,baseRef: main,startFromOrigin: false,runSetupScript: falseand acontinuationPrompt(for example "runpwdand 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.closeto the Claude session. Run 1 then endsfailedwith: "The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs." The handoff tool item endscancelled. - Run 2 (the continuation) stays
queuedand never starts (startedAtnull). 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.
Logs or stack traces#
Provider event log for the child (`logs/provider/events.thread-delegated-task-…log`), last events:
09:52:45.062Z incoming assistant: tool_use mcp__t3-code__t3_worktree_handoff
09:52:45.076Z incoming stream_event: message_delta stop_reason=tool_use
09:52:45.076Z incoming stream_event: message_stop
09:52:47.419Z outgoing query.close
Turn items: `dynamic_tool mcp__t3-code__t3_worktree_handoff` → `cancelled`; `error` → `failure.message: "The provider event stream closed unexpectedly. …"`, `class: unknown`. Runs: `ordinal 1 failed`, `ordinal 2 queued`.
Screenshots, recordings, or supporting files#
No response
Workaround#
Launch Claude workers with t3_thread_launch and workspaceStrategy: {type: "worktree", …} instead of delegate_task + handoff.
daniifrim(GitHub profile, opens in a new tab) added labelsbug
daniifrim(GitHub profile, opens in a new tab) added labelsneeds-triage
juliusmarminge removed labelsneeds-triage
juliusmarminge added labelsvia-triage
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.
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).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 afterprovider-session.detachedreason "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_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.
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:Date (UTC) handoff tool_usequery.close2026-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
failedwith "The provider event stream closed unexpectedly". - The continuation stays in the composer's Queued list and never starts.
- The composer shows Waiting on background task mcp__t3-code__t3_worktree_handoff with Stop (#15993).
- The thread only resumed when I sent a manual message 43 s later. The new session then started in the worktree
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.
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_handoffwith acontinuationPrompt, an explicit sibling worktree path,startFromOrigin: false, andrunSetupScript: false. - The worktree was created and the thread binding updated successfully.
- The original turn ended
failedwith:The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs.
- The continuation remained
queued, withqueueHeld: trueandstartedAt: 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.
- The agent called
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:- The worktree was created and the thread was rebound to it.
- The handoff
tool_usearrived at 16:04:10.5Z. The outgoingquery.closefollowed at 16:04:21.4Z, right after thethread.metadata.update(worktree-handoff) command. - Run 1 ended
failedat 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
queuedwithqueueHeld: trueandstartedAt: null. - An earlier attempt on another thread failed the same way (run 1
failedat 16:01:38.9Z, continuation held). I eventually cancelled it.
Code path on tag
v0.1.1-nightly.20261017.3238(70d60e03):- A
worktreePathchange 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). 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).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:
WARN orchestration V2 provider event ingestion failed … ProviderAdapterEventStreamError: Failed while streaming claudeAgent provider session … [cause]: Error: Workspace changed.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.
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.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
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.