Skip to content

Commit ee8da8c

Browse files
fix(server): a second Codex unload keeps the pending closing wait
A resume waiting for thread/closed could be left on its 10 s fallback when another unload of the same thread replaced the pending Deferred. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent fcb9dfc commit ee8da8c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7397,7 +7397,10 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
73977397
function* (unloadInput) {
73987398
const nativeThreadId = yield* getNativeThreadId(unloadInput.providerThread);
73997399
sessionApprovals.delete(nativeThreadId);
7400-
threadClosings.set(nativeThreadId, yield* Deferred.make<void>());
7400+
// A resume may already wait on the pending entry; replacing it would strand that wait.
7401+
if (!threadClosings.has(nativeThreadId)) {
7402+
threadClosings.set(nativeThreadId, yield* Deferred.make<void>());
7403+
}
74017404
yield* client.request("thread/unsubscribe", { threadId: nativeThreadId });
74027405
},
74037406
(effect, unloadInput) =>

0 commit comments

Comments
 (0)