Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate. ([Bug]: Original delegate_task task finalizes on a stale result in the gap before the child's background-exit wake turn #24297 covers the original task finalizing in the gap before a background-exit wake turn is registered. Delegated task reports finished while its child thread still has running work #16603 covers a child that ends its turn without registering its running command. Here the command is registered with
t3_background_wait, and the task finalizes when an earlier wake turn ends.) - I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- A parent thread starts a Claude child with
delegate_task(mode: "async",isolation: "worktree"). - In its first turn, the child starts two Bash commands with
run_in_background: a short one (a test run, about 30 seconds) and a long one (sleep 330). It callst3_background_waitwith both task IDs, then ends its turn. - The short command exits. Claude Code starts a wake turn (run 2) in the child for that exit.
- Run 2 handles the short command's result, says it is still waiting on the long command, and ends its turn. It does not call
t3_background_waitagain. - The long command exits about five minutes later and starts run 3.
Expected behavior
The task stays open (waiting_for_children) while any task registered with t3_background_wait is still running, including after a wake turn for a different task ends. The parent receives the child's result after run 3.
Actual behavior
When run 2 ends, the task finalizes as completed, and the parent is woken with run 2's interim text as the result ("Still about five minutes until reset. The timer task will notify me."). The long command registered in run 1 is still running at that point. Run 3 starts about five minutes later, after the parent has already been told the task finished.
Observed timeline (relative to the child's first t3_background_wait):
T+0s child run 1: t3_background_wait([shortTask, longTask]); run 1 ends at T+9s
T+17s shortTask exits; child run 2 (wake turn) starts
T+38s run 2 ends; task finalized as completed with run 2's text; parent notified
T+330s longTask exits; child run 3 starts and keeps working
Impact
Major degradation or frequent failure
Logs or stack traces
# notification delivered to the parent at T+38s
Delegated task <taskId> (<title>) [completed]:
Still about five minutes until reset. The timer task will notify me.
# t3_thread_read on the child at T+330s+
thread.status: running, activeRunId: ...:ordinal:3, recentRuns: [3 running, 2 completed, 1 completed]Workaround
The child can call t3_background_wait again with the remaining task IDs before ending each wake turn. The parent can check t3_thread_read for the child's activeRunId instead of trusting the completed notification.
Activity
juliusmarminge commentedon Oct 28, 2026
Duplicate of https://git.cafe/pingdotgg/t3code/issues/24297.
I ran your steps on main at 886d8f6: a Claude parent,
delegate_taskasync with worktree isolation, and a Claude child that starts two background Bash commands, callst3_background_waitwith both IDs, and ends its turn. On the wake turn the child does not register again. I ran it twice: once with 15 s and 120 s commands, and once with 30 s andsleep 330where the wake turn reads the short command's output first.In both runs the task stayed open when the wake turn ended, and the long command stayed in the roster as awaited. The task finalized when the long command exited, in the gap before that exit's wake turn was registered. Times from the second run:
That is the race in https://git.cafe/pingdotgg/t3code/issues/24297, and it produces the interim result you quoted. On this commit the parent also gets run 3's result later, as a second task. If you see a task finalize at the end of a wake turn while an awaited command is still running, comment there with your T3 Code version and the run and task timestamps from
statev2.sqlite.