fix(orchestrator): Wake settled parents when delegated children finish #4499
Merged
mwolson(GitHub profile, opens in a new tab)merged 2 commits into
t3code/codex-turn-mapping fromrefs/pull/4499/head·merged by juliusmarminge View on GitHubShowing 14 changed files with 51 additions and 6 deletions (loading 12).
x
@@ -49,7 +49,7 @@
- "Delegate one task to a T3-owned child agent/subagent of THIS thread and run it with only the supplied task prompt, without copying parent conversation history. Use this whenever the user asks for an agent, subagent, worker, delegated task, or parallel help—including cross-provider work. The childThreadId is backing storage, not an ordinary top-level thread. Provider, model, model options (see orchestrator_capabilities), runtime mode, and interaction mode inherit unless target overrides them. Prefer mode='async' and poll task_status for long work; mode='wait' blocks until completion or timeout.",
+ "Delegate one task to a T3-owned child agent/subagent of THIS thread and run it with only the supplied task prompt, without copying parent conversation history. Use this whenever the user asks for an agent, subagent, worker, delegated task, or parallel help—including cross-provider work. The childThreadId is backing storage, not an ordinary top-level thread. Provider, model, model options (see orchestrator_capabilities), runtime mode, and interaction mode inherit unless target overrides them. Prefer mode='async' for long work; mode='wait' blocks until completion or timeout. An async child's completion wakes this thread with a continuation message naming the task (queued behind any turn in progress), so end the turn instead of polling or spawning watchers; use task_status only when the result is needed mid-turn.",
@@ -1053,6 +1053,10 @@
+ // Async delegations wake the parent on every child terminal; wait
+ // delegations deliver through the blocking tool call, so a wake is
+ // only needed if the parent settled first (timeout, disconnect).
+ completionWake: input.mode === "wait" ? "settled_only" : "always",
@@ -1072,18 +1076,59 @@
+ const taskId = taskEvent.event.payload.id;