[Bug]: Delegated Claude children wake the parent on every background-job wake, and t3_background_wait can't prevent it
v0.1.9 (24e77473ecf4). A delegated Claude child that runs Bash run_in_background and calls t3_background_wait
holds its task until the job ends, as documented. But every later background-task wake is registered as a new
follow-up task (recordSubagentFollowup → mayStartSubagentFollowup returns true for background_task
notifications) with completionWake: "always", and delivered at that wake run's end. The awaited hold is checked
only for the original task (finalizeAppOwnedSubagent: task.id === forkedFrom.nodeId && state !== "result_available"). One child today: 50 runs, 52 parent notices, all "still running X" progress lines. The parent
took 213 such notices in a day.
Also: (a) when the original task is held, its delivered result is its own first run's text ("running in the
background…"), not the text after the wake. (b) When awaited work dies with the provider process (exit, scope stop,
or the 4 h idle-pin release in ProviderSessionManager.releaseIfStillIdle), the roster is cleared silently: the child
never gets a turn, and the parent receives the stale "waiting" text as the final result. Only a server restart
records restartCancelledBackgroundWork and starts a continuation.
Proposed: (1) treat background_task wakes like monitor wakes in mayStartSubagentFollowup, and attach the wake
run to the child's current task; (2) deliver the latest settled run's text for that task; (3) route
process-exit / session-release cancellation of awaited work through the existing restart-continuation path, with its
note. Then a delegated child reaches its parent exactly once per real finish or question, and no awaited work can end
without the child getting a turn.
Related, not the same: #31707 (remote children not notifying follow-ups at all).
I tried to reproduce this on the current build and could not.
Commit 9b3b1c79a7 (origin/main). No live provider run: I found no short, natural sequence that drives a real Claude child into this state (original task already settled, awaited background job still running, a provider progress wake arriving), and an open-ended live session would cost real turns with no assurance of showing it. Instead I added an orchestrator test to apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts ('a progress wake while awaited work still runs does not notify the parent'), using the real Orchestrator and EventSink. Steps: seed a parent whose delegated child already returned its original result (acknowledged). The child's provider thread lists an awaited background command 'build'. Dispatch a provider wake to the child (notification source background_task, outcome updated, the default ProviderContinuationService wake). That wake run ends with 'Still running the build.' while 'build' is still pending and awaited. Run recoverDelegatedTasks. On main a new follow-up task appears on the parent, settled with result 'Still running the build.', so the parent is notified while the awaited work still runs. The test fails with: expected [ 'Still running the build.' ] to deeply equal []. Claims (a) (held original delivers its first run's text) and (b) (process exit or idle release clears awaited work silently) were not tested.
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.
I found a live case of the unwanted parent wake on v0.1.11-nightly.20261117.4838 (ea6d3fc), with a Linux x64 T3 Code service and a Claude delegated child. In this case the follow-up was silent, rather than reporting “still running.”
Observed sequence (UTC, Nov 17):
- A third thread (not the parent) called
t3_thread_sendon the child at 16:57:12. Child run 2301 started. Itsrun.updatedpayloads had nodelegatedTaskId, including the terminal event. - At 16:57:13 a
background_tasknotification (outcome: updated, summaryBackground activity updated) queued child run 2302. Arun.updatedevent assigned it a newprovider-continuationdelegated task ID while it was still queued. The preceding delegated follow-up had already completed. - Run 2301 wrote a substantive final reply at 16:58:02. No delegated-result transfer was created for that run. Run 2302 then completed in 99 ms with no assistant text, and the parent was woken with “Child task completed without an assistant result.”
The parent timeline showed two rows with the fallback, but the event log has one task completion and one parent wake: the task card and its “Finished” notification render the same result from the same task ID.
This is the silent-new-follow-up case that #37942 left out, not an overwrite within one task. The wake run is tagged; the preceding report run is not. Skipping untagged runs in delegatedTaskReportRuns would skip the report itself and then hit a different, completed task. The relevant routing and report lookup are unchanged in the source for .4890; I did not replay the scenario on that build.
Suggested regression test: with the original task already settled, queue a background notification behind a non-parent send; let the send produce text and the wake finish silently. A successful notification-only follow-up with no report or provider stop reason should not wake the parent. Whether third-party replies should be forwarded to the parent is a separate attribution decision; the test should not implicitly borrow their text.