Skip to content

Commit e0f8cd3

Browse files
committed
fix(codex): retain sessions with pending descendants
Count pending and waiting native descendants in the session-wide idle probe, matching the per-thread archive guard. Extend the existing nested-descendant regression to check the session remains busy while pending and clears after completion.
1 parent 3a25d58 commit e0f8cd3

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7429,6 +7429,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
74297429
assert.include(harness.continuationRequests[0]?.detail, "CHILD_DONE");
74307430
assert.equal(harness.subagentUpdates().at(-1)?.subagent.status, "pending");
74317431
assert.isTrue(yield* ownsRunningWork);
7432+
assert.isTrue(yield* harness.hasPendingBackgroundWork);
74327433

74337434
yield* TestClock.adjust("30 seconds");
74347435
yield* fenced("gpt-fence-grandchild-running");
@@ -7437,6 +7438,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
74377438
yield* TestClock.adjust("30 seconds");
74387439
yield* fenced("gpt-fence-grandchild-settled");
74397440
assert.isFalse(yield* ownsRunningWork);
7441+
assert.isFalse(yield* harness.hasPendingBackgroundWork);
74407442
}).pipe(
74417443
Effect.provide(
74427444
Layer.mergeAll(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7050,7 +7050,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
70507050
if (state.running.size > 0 || state.saved.size > 0) return true;
70517051
}
70527052
for (const subagent of (yield* Ref.get(subagentThreads)).values()) {
7053-
if (subagent.task.status === "running") {
7053+
if (isOrchestrationV2WorkActive(subagent.task.status)) {
70547054
return true;
70557055
}
70567056
}

0 commit comments

Comments
 (0)