Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(orchestrator): Wake settled parents when delegated children finish #4499

Mergedmwolson(GitHub profile, opens in a new tab)merged 2 commits intot3code/codex-turn-mapping fromrefs/pull/4499/headmerged by juliusmarminge View on GitHub

Showing 14 changed files with 51 additions and 6 deletions (loading 12).

x
0 of 14 viewed, 14 left
1 addition and 1 deletionapps/server/src/mcp/toolkits/orchestrator/tools.tsModified
View file
@@ -49,7 +49,7 @@
​
export const DelegateTaskTool = Tool.make("delegate_task", {
description:
- "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.",
parameters: OrchestratorMcpDelegateTaskInput,
success: OrchestratorMcpDelegateTaskResult,
failure: OrchestratorMcpFailure,
50 additions and 5 deletionsapps/server/src/mcp/OrchestratorMcpService.tsModified
View file
@@ -1053,6 +1053,10 @@
modelSelection: target.modelSelection,
runtimeMode,
interactionMode,
+ // 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",
.pipe(
Effect.mapError((error) =>
@@ -1072,18 +1076,59 @@
"Delegated task command did not produce a task projection.",
+ const taskId = taskEvent.event.payload.id;