Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Stop always ends the background work a thread shows #14636

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

Showing 21 changed files with 186 additions and 14 deletions (loading 18).

x
0 of 21 viewed, 21 left
45 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -3492,6 +3492,51 @@
+ // The CLI process exits on its own after the turn settled (idle, crash),
+ // leaving its background task on the roster. Stop must succeed so the
+ // orchestrator goes on to settle what the thread still shows.
+ it.effect("a settled Stop with no CLI process left succeeds and clears the roster", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const harness = yield* makeWakeHarnessWithOptions();
+ const now = yield* DateTime.now;
+ yield* harness.runtime.startTurn(
+ makeClaudeTestTurnInput({
+ threadId: harness.threadId,
+ providerThread: harness.providerThread,
+ now,
+ attemptId: RunAttemptId.make("attempt-claude-settled-stop-no-process"),
+ 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;
+ assert.equal(settledThread?.pendingBackgroundTasks?.[0]?.taskId, WAKE_TASK_ID);
+​
+ yield* Queue.shutdown(harness.sdkMessages);
+ let quietYields = 0;