Repository navigation
Description
Before submitting
- 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
A delegated Claude child never gets the result of a background command that finishes while it's still writing its final reply. T3 closes the child's session about 0.4 s after the turn ends, and that kills the turn Claude Code starts for the queued notification.
This isn't a narrow race. The command finishes 15 s after it starts, and Haiku takes about 25 s to write out the thousand numbers, so the command finishes during that reply. It reproduced on both runs I tried.
-
Set up
mainas the development runbook describes, with Claude Code installed and signed in. Inapps/server, start a server with a fresh base dir and a git repo with one commit as the project:
node src/bin.ts serve --base-dir <scratch> --host 127.0.0.1 --no-browser <project dir>Run the next steps from a second terminal in
apps/server. -
node src/bin.ts project add --base-dir <scratch> <project dir> -
node src/bin.ts thread start --base-dir <scratch> --provider claudeAgent --model claude-haiku-5-5 <project dir> - < prompt.txt, with thisprompt.txt:Call the delegate_task tool exactly once to hand the task below to a child agent on the claudeAgent provider with model claude-haiku-5-5. Pass the task text exactly as written between the lines. After the call returns, reply with the single word "delegated" and end your turn. Do nothing else. ---- Follow these steps exactly, in order. 1. Use the Bash tool with run_in_background set to true to run this command: sleep 15; echo WAKE-TOKEN 2. Call the t3_background_wait tool with that background task's ID. 3. Right after that, with no further tool calls, write your final reply: the numbers from one to one thousand written out as English words, one per line, nothing else. Then end your turn. 4. If you are later told that the background command finished, reply with exactly the line it printed and nothing else. ---- -
Wait a minute.
node src/bin.ts thread show --base-dir <scratch> <parent thread id>(step 3 prints the id) shows the parent's result. The child's protocol log is<scratch>/userdata/logs/provider/events.thread-delegated-task-*.log.
Expected behavior
The child gets the task notification and replies with WAKE-TOKEN, once. The delegated task isn't released while that turn runs.
Actual behavior
The child never replies with the token, and nothing wakes it again. The parent gets the list of numbers as the task's result, without the token.
What happens, from the child's provider log, the server trace and Claude Code's session transcript (timeline under Logs):
- The command finishes during the child's last model request. Claude Code queues the
<task-notification>. Its transcripts show that Claude Code hands a queued notification to the model only with the request after the next tool step, and there isn't one. - On the mid-turn
task_notification,ClaudeAdapterV2drops the task from the roster and clears its wake. So when the turn ends, T3 thinks nothing is owed. - Right after
result, Claude Code dequeues the notification and starts its own turn for it. - About 0.1 s later
releaseFinishedDelegateSessionsreleases the child, and thequery.closekills that turn.
I first hit this with two delegated Opus children on 0.1.11-nightly.20261120.4979. Both had registered their command with t3_background_wait, and both stayed idle until they got a message the next day.
This isn't the idle case from #33041 and #37252. There the task finishes after the turn has ended, and #36029 keeps the session open while a wake is owed. Here the task finishes during the turn, so nothing is owed. I have a recorded replay of a background command finishing during the last request. On main, and with #36029 applied, the roster is already empty when that turn ends.
#38221 may be this case too. There Claude's turn started about 1 s after the notification, while an idle completion's turn starts within about 0.1 s (85 ms and 120 ms in the repro attempts on #37252 and #33041). That gap would fit a notification that arrived while a last request was still running. #42455 is the same delegate release cutting a Claude child's turn, with a different trigger.
Impact
Major degradation or frequent failure
Version or commit
main @ d8a52dd, also 0.1.11-nightly.20261120.4979
Environment
Linux x86-64. Repro: Claude Code 2.1.332, claude-haiku-5-5. Where I hit it: Claude Code 2.1.329, claude-opus-5-5
Logs or stack traces
# Repro on main @ d8a52dda31, child thread, UTC 2026-11-26
23:23:01.361 in system status requesting # the child's last request starts
23:23:12.572 (Claude Code) queue enqueue <task-notification>
23:23:12.575 in system task_updated completed / task_notification completed
23:23:12.577 in system background_tasks_changed []
23:23:28.616 in result success end_turn
23:23:28.619 (Claude Code) queue dequeue; its own turn starts with the <task-notification>
23:23:28.721 Orchestrator.releaseFinishedDelegateSessions
23:23:28.747 dispatch.providerSessionDetach (command:system:delegated-task-release:...)
23:23:28.992 out query.close
# nothing more in the child; no reply with the tokenWorkaround
Send the stalled child a message. Its next turn starts normally. The notification is in its history, followed by a synthetic "No response requested.", so it helps to name the command in the message.
I have a fix in the Claude adapter, with that recorded replay as a test that fails on main and passes with the fix. Happy to open the PR and link it here.
Written by Claude Opus 5.5 in Claude Code, on my behalf.
Activity