Skip to content

Commit 96189e8

Browse files
committed
fix(codex): keep pending descendants out of archive cleanup
1 parent 349bbc5 commit 96189e8

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7218,11 +7218,15 @@ describe("CodexAdapterV2 post-settle continuation", () => {
72187218
method: "item/completed",
72197219
params: {
72207220
item: {
7221-
type: "subAgentActivity",
7221+
type: "collabAgentToolCall",
72227222
id: "call-codex-grandchild-spawn",
7223-
kind: "started",
7224-
agentThreadId: grandchildThread,
7225-
agentPath: "/root/resume_agent/grandchild",
7223+
tool: "spawnAgent",
7224+
status: "completed",
7225+
senderThreadId: RESUME_CHILD_THREAD,
7226+
receiverThreadIds: [grandchildThread],
7227+
agentsStates: {
7228+
[grandchildThread]: { status: "pendingInit", message: null },
7229+
},
72267230
},
72277231
threadId: RESUME_CHILD_THREAD,
72287232
turnId: RESUME_CHILD_TURN_1,
@@ -7290,6 +7294,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
72907294
yield* TestClock.adjust("30 seconds");
72917295
yield* fenced("gpt-fence-child-settled");
72927296
assert.include(harness.continuationRequests[0]?.detail, "CHILD_DONE");
7297+
assert.equal(harness.subagentUpdates().at(-1)?.subagent.status, "pending");
72937298
assert.isTrue(yield* ownsRunningWork);
72947299

72957300
yield* TestClock.adjust("30 seconds");

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7062,7 +7062,10 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
70627062
};
70637063
if (options?.includeSubagents === true) {
70647064
for (const subagent of (yield* Ref.get(subagentThreads)).values()) {
7065-
if (subagent.task.status === "running" && owned(subagent.parentContext)) {
7065+
if (
7066+
isOrchestrationV2WorkActive(subagent.task.status) &&
7067+
owned(subagent.parentContext)
7068+
) {
70667069
return true;
70677070
}
70687071
}

0 commit comments

Comments
 (0)