Repository navigation
[Bug]: Claude child task dies after t3_worktree_handoff; continuation turn never starts #15136
Description
Activity
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on 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.- addedvia-triageFiled through npx t3 triageFiled through npx t3 triageand removedneeds-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Oct 3, 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.
Reacted by Dani IfrimStill 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).Reacted by Dani IfrimStill reproduces on 0.0.46-nightly.20261005.2702 (macOS desktop, top-level thread, claudeAgent / claude-opus-5-5, full-access):
run 8 endedfailed("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.
Before submitting
Area
apps/desktop
Steps to reproduce
delegate_task(modeasync) with targetclaudeAgent/claude-opus-5-5(also reproduced withclaude-sonnet-5-5).t3_worktree_status, then, as its last action,t3_worktree_handoffwithbranch: feature/x,baseRef: main,startFromOrigin: false,runSetupScript: falseand acontinuationPrompt(for example "runpwdand report").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
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.queuedand never starts (startedAtnull). On build 2610 it was once cancelled instead.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 serveweb mode. Claude Code 2.1.288, codex-cli 0.159.1. Runtime modefull-access.Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Launch Claude workers with
t3_thread_launchandworkspaceStrategy: {type: "worktree", …}instead ofdelegate_task+ handoff.