Skip to content

Commit 329d2e1

Browse files
committed
test(server): an explicit thread id wins over the stored one on Codex resume
1 parent 7d5a78c commit 329d2e1

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,24 @@ describe("CodexAdapterV2 post-settle continuation", () => {
24292429
label: "thread/resume without an app thread",
24302430
frame: { id: 4, result: { thread: { id: nativeThreadId, updatedAt: 1782622450 } } },
24312431
},
2432+
{
2433+
type: "expect_outbound",
2434+
label: "thread/resume with an explicit app thread",
2435+
frame: {
2436+
id: 5,
2437+
method: "thread/resume",
2438+
params: {
2439+
threadId: nativeThreadId,
2440+
excludeTurns: true,
2441+
config: CodexAdapterV2.CODEX_THREAD_CONFIG,
2442+
},
2443+
},
2444+
},
2445+
{
2446+
type: "emit_inbound",
2447+
label: "thread/resume with an explicit app thread",
2448+
frame: { id: 5, result: { thread: { id: nativeThreadId, updatedAt: 1782622450 } } },
2449+
},
24322450
],
24332451
});
24342452
const resumeThreadEnvs: Array<unknown> = [];
@@ -2450,11 +2468,18 @@ describe("CodexAdapterV2 post-settle continuation", () => {
24502468
modelSelection: CODEX_TEST_MODEL_SELECTION,
24512469
runtimePolicy: CODEX_TEST_RUNTIME_POLICY,
24522470
});
2471+
const explicitThreadId = ThreadId.make(`thread-${scenario}-explicit`);
2472+
yield* harness.runtime.resumeThread({
2473+
threadId: explicitThreadId,
2474+
providerThread: harness.providerThread,
2475+
modelSelection: CODEX_TEST_MODEL_SELECTION,
2476+
runtimePolicy: CODEX_TEST_RUNTIME_POLICY,
2477+
});
24532478

24542479
assert.equal(resumed.nativeThreadRef?.nativeId, nativeThreadId);
24552480
assert.equal(resumed.status, "idle");
24562481
assert.equal(DateTime.toEpochMillis(resumed.updatedAt), 1782622450000);
2457-
assert.deepEqual(resumeThreadEnvs, [harness.threadId, undefined]);
2482+
assert.deepEqual(resumeThreadEnvs, [harness.threadId, undefined, explicitThreadId]);
24582483
}).pipe(
24592484
Effect.provide(
24602485
Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),

0 commit comments

Comments
 (0)