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]: Delegated Claude child is closed mid wake turn when its last background task stops; parent keeps the pre-wake "waiting" text as the result #42455
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Not cut down to a minimal repro: these are the steps of the run it happened in.
From a Claude thread, delegate_task to claudeAgent / claude-opus-5-5 with a brief that starts a long command with Bash run_in_background, plus a second background task watching its log.
The child ends its turn with a "still waiting" line. The delegated task reports completed to the parent with that line, and T3 keeps the session open for the background work.
A task notification wakes the child (an SDK wake turn, no prompt.offer from T3). In that turn it calls TaskStop on both background tasks to relaunch the batch, then goes on to a Bash call.
Expected behavior
The session isn't released while a wake turn is in flight (a message_start with no result yet).
The delegated task's result is the text of the child's last turn, not the pre-wake "waiting" line.
Actual behavior
46 ms after background_tasks_changed arrives with tasks: [], releaseFinishedDelegateSessions detaches the session and query.close goes out. The assistant message was still streaming; a Bash tool_use block had just started.
The child's run fails with "The provider event stream closed unexpectedly".
The parent gets no notice, because the task was already reported completed 18 minutes earlier with the waiting text.
The child's edits are left half applied in the checkout.
Same shape as #41529 (Antigravity), on the Claude adapter.
Impact
Major degradation or frequent failure
Version or commit
0.1.11 (not checked against the 0.1.12 nightlies)
Environment
Windows 11, desktop app, Claude provider (Claude Agent SDK)
Logs or stack traces
UTC, from the child's provider log and server.trace.ndjson:
14:37:44.809 in result success end_turn "Still waiting on ..." <- task reported completed here
14:54:43.947 in message_start <- SDK wake turn, no prompt.offer
14:55:15.853 in task_updated <A> killed; background_tasks_changed [<B>]
14:55:16.199 in task_updated <B> killed
14:55:16.200 in background_tasks_changed []
14:55:16.200 in content_block_start tool_use Bash <- same message, still streaming
14:55:16.229 Orchestrator.releaseFinishedDelegateSessions
14:55:16.237 dispatch.once command:system:delegated-task-release
14:55:16.237 dispatch.providerSessionDetach
14:55:16.243 ProviderSessionManager.removeLiveEntry / failSubscribers / closeScopeWithin
14:55:16.246 out query.close
14:55:16.259 ClaudeAdapterV2.interruptTurn
14:55:16.261 RunExecutionService.interruptLostToolCalls
The only prompt.offer in the session is the first one, so every later turn was an SDK wake turn.
I tried to reproduce this on the current build and could not.
Commit origin/main bd3e495. Ran node apps/server/src/bin.ts serve with T3CODE_DEV_SEED=0 on a fresh --base-dir and a scratch git project, then started a parent thread with t3 thread start --provider claudeAgent --model claude-haiku-5-5. The parent called delegate_task to claudeAgent/claude-haiku-5-5 with a scripted brief. I read the orchestration events from the isolated statev2.sqlite. Five runs: (1) and (2) background sleep 25; echo A plus sleep 900: T3 treated both as awaited sleep timers, so the task stayed open, the wake opened run 2 and the result was the final text. (3) non-sleep background commands (python3 -c ...sleep(30) > build.log and tail -f build.log), not awaited, matching the report: the task was reported completed with 'Still waiting on the build.' at the end of turn 1. When the task notification woke the child (an SDK wake turn with no new prompt from T3), T3 created a run at once and set the task back to running. The child ran TaskStop, the roster went to [] mid-turn, then a 20 s foreground Bash ran. The session was detached ('Delegated task finished.') only after that run completed, and the parent was told again with 'FINAL: fourth.txt written.' (4) same, but woken by a third short task while the 600 s 'build' and tail -f were still running, then TaskStop on both: same correct result. (5) as (4) with the wake about 4 minutes later (past the 2-minute idle release): same correct result. No query.close mid-turn, no 'provider event stream closed unexpectedly', and the child's files were fully written every time. Not tried: Opus, Windows, a 17-minute gap.
Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
Activity
juliusmarminge commentedon Nov 24, 2026
I tried to reproduce this on the current build and could not.
Commit origin/main bd3e495. Ran
node apps/server/src/bin.ts servewith T3CODE_DEV_SEED=0 on a fresh --base-dir and a scratch git project, then started a parent thread witht3 thread start --provider claudeAgent --model claude-haiku-5-5. The parent called delegate_task to claudeAgent/claude-haiku-5-5 with a scripted brief. I read the orchestration events from the isolated statev2.sqlite. Five runs: (1) and (2) backgroundsleep 25; echo Aplussleep 900: T3 treated both as awaited sleep timers, so the task stayed open, the wake opened run 2 and the result was the final text. (3) non-sleep background commands (python3 -c ...sleep(30)> build.log andtail -f build.log), not awaited, matching the report: the task was reported completed with 'Still waiting on the build.' at the end of turn 1. When the task notification woke the child (an SDK wake turn with no new prompt from T3), T3 created a run at once and set the task back to running. The child ran TaskStop, the roster went to [] mid-turn, then a 20 s foreground Bash ran. The session was detached ('Delegated task finished.') only after that run completed, and the parent was told again with 'FINAL: fourth.txt written.' (4) same, but woken by a third short task while the 600 s 'build' andtail -fwere still running, then TaskStop on both: same correct result. (5) as (4) with the wake about 4 minutes later (past the 2-minute idle release): same correct result. No query.close mid-turn, no 'provider event stream closed unexpectedly', and the child's files were fully written every time. Not tried: Opus, Windows, a 17-minute gap.Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.