Note
Grok responding on behalf of Julius.
Thanks for the deterministic replay. The guard does what you describe on current main. When a task_notification arrives while the root is idle, the outcome is applied directly only if no task_started for that task is still in the wake buffer, or if a stop outcome is already known (apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts:7112-7125). Otherwise it waits for the continuation drain. #18778 added that deferral so an old buffered start replaying later couldn't flip a finished subagent back to running.
The replay depends on step 2, though: it leaves the idle launch's continuation undrained. A subagent task_started that arrives while the root is idle is buffered specifically so that a continuation drains it (lines 6669-6675). In the normal flow that drain processes both the start and the later notification and settles the task. So the open question is what kept that start undrained in your real incident. A held or jammed continuation would make this the same root cause as #20430, or the wake that never opens in #19196, rather than a separate problem with the guard.
To narrow it down, could you check the provider log and run history from the production incident:
- Did a continuation or wake run start between the idle
task_startedand your next user turn? - Was any queued or held run sitting on the thread at that point?
- Did any run start after the final
task_notificationarrived?