Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Stop ends a Claude thread's background work after the turn settles #13792

Mergedjuliusmarmingemerged 3 commits intot3code/codex-turn-mapping fromrefs/pull/13792/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 229 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
229 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -3274,6 +3274,235 @@
+ it.effect("stops background work after the turn settled", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ let closes = 0;
+ const harness = yield* makeWakeHarnessWithOptions({
+ close: (sdkMessages) =>
+ Effect.sync(() => {
+ closes++;
+ }).pipe(Effect.andThen(Queue.shutdown(sdkMessages))),
+ });
+ const now = yield* DateTime.now;
+ const attemptId = RunAttemptId.make("attempt-claude-settled-stop");
+ yield* harness.runtime.startTurn(
+ makeClaudeTestTurnInput({
+ threadId: harness.threadId,
+ providerThread: harness.providerThread,
+ now,
+ attemptId,
+ text: "Run the build in the background.",
+ attachments: [],
+ }),
+ );
+ yield* Queue.offer(harness.sdkMessages, wakeTaskStarted);
+ yield* Queue.offer(harness.sdkMessages, turnOneResult);
+ yield* awaitUntil(() => harness.terminalEvents().length === 1, "first turn terminal");
+ const settledThread = providerThreadRosterEvents(harness.events).at(-1)?.providerThread;