Skip to content

Commit b1bdf96

Browse files
fix(server): Codex subagent rows show the child's current command
CodexAdapterV2 never set progress on native subagent updates, so a spawn_agent child's row showed only Running and a timer. When a child starts a command or tool call, update the parent's subagent (and its turn item) with that line, as the Claude adapter does from task_progress. A reopened child drops its previous turn's line. AI-assisted; verified with the tests and tools listed above.
1 parent 3b678b0 commit b1bdf96

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2727,9 +2727,12 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
27272727
readonly completedAt?: DateTime.Utc | null;
27282728
readonly startedAt?: DateTime.Utc;
27292729
readonly reopen?: boolean;
2730+
readonly progress?: string;
27302731
}) {
27312732
const now = yield* DateTime.now;
2732-
const prior = input.subagent.task;
2733+
const prior = input.reopen
2734+
? (({ progress: _staleProgress, ...rest }) => rest)(input.subagent.task)
2735+
: input.subagent.task;
27332736
const settled = !isOrchestrationV2WorkActive(prior.status);
27342737
// Late snapshots must not reopen completed children; only new turns may.
27352738
if (settled && isOrchestrationV2WorkActive(input.status) && !input.reopen) return;
@@ -2747,6 +2750,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
27472750
}
27482751
: {}),
27492752
startedAt: input.startedAt ?? prior.startedAt,
2753+
...(input.progress === undefined ? {} : { progress: input.progress }),
27502754
result: input.result === undefined ? input.subagent.task.result : input.result,
27512755
completedAt,
27522756
updatedAt: now,
@@ -2784,11 +2788,28 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
27842788
providerInstanceId: task.providerInstanceId,
27852789
childThreadId: task.childThreadId,
27862790
prompt: task.prompt,
2791+
...(task.progress === undefined ? {} : { progress: task.progress }),
27872792
result: task.result,
27882793
},
27892794
});
27902795
});
27912796

2797+
// A native child's running item is the line its parent's subagent row shows.
2798+
const reportSubagentProgress =
2799+
/* Provider events include streaming deltas; avoid a span for each update. */
2800+
Effect.fnUntraced(function* (context: ActiveCodexTurnContext, progress: string | null) {
2801+
const subagent = context.subagent;
2802+
const line = progress?.trim();
2803+
if (subagent === null || !line) return;
2804+
if (!isOrchestrationV2WorkActive(subagent.task.status)) return;
2805+
if (subagent.task.progress === line) return;
2806+
yield* emitSubagentTaskUpdate({
2807+
subagent,
2808+
status: subagent.task.status,
2809+
progress: line,
2810+
});
2811+
});
2812+
27922813
const emitSubagentProviderTurnStarted =
27932814
/* Provider events include streaming deltas; avoid a span for each update. */
27942815
Effect.fnUntraced(function* (
@@ -5194,6 +5215,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
51945215
driver: CODEX_PROVIDER,
51955216
turnItem: artifacts.turnItem,
51965217
});
5218+
yield* reportSubagentProgress(context, payload.item.command);
51975219
return;
51985220
}
51995221

@@ -5212,6 +5234,12 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
52125234
driver: CODEX_PROVIDER,
52135235
turnItem: artifacts.turnItem,
52145236
});
5237+
if (artifacts.turnItem.type === "dynamic_tool") {
5238+
yield* reportSubagentProgress(
5239+
context,
5240+
artifacts.turnItem.title ?? artifacts.turnItem.toolName,
5241+
);
5242+
}
52155243
return;
52165244
}
52175245

0 commit comments

Comments
 (0)