[Bug]: t3_background_wait doesn't hold completion for runs started by t3_thread_send
Before submitting
- [x] I searched existing issues and did not find a duplicate. Related but different: #37006 (wait refusals), #31087 (completion alert timing), #25585 (Done at intermediate stops).
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
delegate_task(async, Claude provider) with the task "reply 'ready' and end your turn". Wait for it to complete.t3_thread_send(modeauto) to that child thread: "Runsleep 60 && touch /tmp/x.donewith Bashrun_in_background: true, callt3_background_waitwith its task ID, then end your turn."- About 10 s later, run
task_statuson the returnedthread-sendtask ID.
Expected behavior
status: running, workState: waiting_for_children until the background command exits. That is what happens when the same steps run in the first delegate_task run.
Actual behavior
t3_background_wait returns {"matched":["<id>"],"unmatched":[]}, but the task goes to status: completed, workState: result_available as soon as the turn ends, and the parent is woken with the child's interim text ("I'll continue when it finishes"). About 60 s later the child is woken by the command's notification and the parent gets a second [completed] with the real result.
So the awaited-work contract only holds on a child's first run. Orchestrators that trust the first [completed] act on an interim result (report, merge, or re-send the task).
Smaller, related: task_status.summary keeps the first run's text after later runs complete; only latestTerminalSummary updates, though the tool description calls summary the final result.
Impact
Major degradation or frequent failure
Version or commit
T3 Code 0.1.7
Environment
Linux; Claude Code 2.1.319 (claudeAgent provider), Claude Opus parent and child.
Workaround
On follow-up runs, keep long work in the foreground instead of run_in_background + t3_background_wait. In the parent, treat a [completed] whose text says the child is still waiting as interim and wait for the next one.
Same symptom on a child's first delegate_task run, so it is not only t3_thread_send runs. The gate does hold while the command runs; it releases as soon as the awaited task finishes, before the child's wake turn runs.
T3 Code 0.1.7, macOS 26, Claude Code 2.1.325 (claudeAgent), Opus parent and child.
Child timeline (one run, a single prompt):
- 16:42:05 Bash
git pushwithrun_in_background: true(pre-push hook about 255 s) → taskbr518kwl2 - 16:42:09
t3_background_wait {"taskIds":["br518kwl2"]}→{"matched":["br518kwl2"],"unmatched":[]}; turn ends with interim text ("push is running in the background…") - 16:47:09.182 the child is woken by the
br518kwl2task notification
Parent:
- 16:47:09.287
Delegated task … [completed]:with the child's interim 16:42 text - 16:58:51, 17:03:43, 17:06:46: three more deliveries (provider-continuation) with the real results
So waiting_for_children holds until the awaited work clears. But when it clears, result_available is derived from the last terminal run (the interim one) before the wake run starts. I expected delivery to wait until the run started by the task notification ends.
Scale on one machine since 2026-11-13: 89 of 262 delegated completions carried interim "still running" text; parents took 236 more continuation wakes.
This is the same problem as #36403, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.