Skip to content

Commit 320747e

Browse files
fix(server): parent turns no longer duplicate delegated task thread items
A new parent run was handed every completed subagent's child thread as a related thread, including delegated (app_owned) tasks that run their own runs. On Codex's shared session, each live parent run then ingested the child's turn items a second time. Only provider-native children are now routed to the parent run, matching how runs adopt children mid-turn. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b705eec commit 320747e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/ProviderTurnStartService.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,8 +1586,11 @@ export const layer: Layer.Layer<
15861586
if (!runningWrite.committed) {
15871587
return;
15881588
}
1589-
const routableSubagents = projection.subagents.filter((subagent) =>
1590-
RunExecutionService.canRouteRelatedSubagent(subagent.status),
1589+
// Delegated (app_owned) children run their own runs; routing them here ingests their items twice.
1590+
const routableSubagents = projection.subagents.filter(
1591+
(subagent) =>
1592+
subagent.origin === "provider_native" &&
1593+
RunExecutionService.canRouteRelatedSubagent(subagent.status),
15911594
);
15921595
const persistHandoff = Effect.fn("ProviderTurnStartService.persist")(function* (
15931596
handoff: OrchestrationV2ContextHandoff,

0 commit comments

Comments
 (0)