Skip to content

Commit 26d6834

Browse files
ashx-jclaude
andcommitted
test(claude): cover a turn ending right after Claude withdraws a request
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f841c28 commit 26d6834

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9080,10 +9080,8 @@ describe("ClaudeAdapterV2 background wake turns", () => {
90809080
const pending = (yield* Queue.take(harness.runtimeRequestReceipts)).runtimeRequest;
90819081
assert.equal(pending.status, "pending");
90829082

9083+
// The turn can end right after the withdrawal, before the callback returns.
90839084
withdrawal.abort();
9084-
9085-
assert.equal((yield* Fiber.join(permission))?.behavior, "deny");
9086-
// Events arrive in order, so the turn's end follows anything the withdrawal emitted.
90879085
yield* Queue.offer(
90889086
harness.sdkMessages,
90899087
claudeSdkFrame({
@@ -9092,8 +9090,14 @@ describe("ClaudeAdapterV2 background wake turns", () => {
90929090
}),
90939091
);
90949092
yield* harness.awaitTerminal(1);
9093+
assert.equal((yield* Fiber.join(permission))?.behavior, "deny");
9094+
// The cancellation has to land before the turn's end finalizes the run.
9095+
const beforeTerminal = harness.events.slice(
9096+
0,
9097+
harness.events.findIndex((event) => event.type === "turn.terminal"),
9098+
);
90959099
const statusOf = (type: "runtime_request.updated" | "node.updated" | "turn_item.updated") =>
9096-
harness.events
9100+
beforeTerminal
90979101
.flatMap((event): Array<{ readonly type: string; readonly status: string }> =>
90989102
event.type === "runtime_request.updated" && event.runtimeRequest.id === pending.id
90999103
? [{ type: event.type, status: event.runtimeRequest.status }]

0 commit comments

Comments
 (0)