Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): threads mid-turn continue after a restart on every provider #14182

Mergedjuliusmarmingemerged 1 commit intot3code/codex-turn-mapping fromrefs/pull/14182/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 17 additions and 1 deletion.

x
0 of 2 viewed, 2 left
14 additions and 0 deletionsapps/server/src/orchestration-v2/RestartContinuation.test.tsModified
View file
@@ -121,6 +121,20 @@
assert.isUndefined(restartContinuationRun(invalid as OrchestrationV2ThreadProjection));
});
​
+it("continues a live turn whose session the adapter never marked running", () => {
+ const projection = makeProjection();
+ // Codex, Claude, Cursor and ACP sessions stay "ready" for their whole life.
+ const withSessionStatus = (status: string) =>
+ ({
+ ...projection,
+ providerSessions: [{ ...projection.providerSessions[0]!, status }],
+ }) as OrchestrationV2ThreadProjection;
+ for (const status of ["starting", "ready", "running", "waiting"])
+ assert.equal(restartContinuationRun(withSessionStatus(status))?.id, runId, status);
+ for (const status of ["stopped", "error"])
+ assert.isUndefined(restartContinuationRun(withSessionStatus(status)), status);
+});
+​
it("recovers an admitted continuation after another crash before provider start", () => {
const projection = makeProjection();
const starting = {
3 additions and 1 deletionapps/server/src/orchestration-v2/RestartContinuation.tsModified
View file
@@ -66,12 +66,14 @@
);
// A settled thread's session may already be stopped and out of the recovery
// read; the continuation reopens it from the provider thread's native ref.
+ // Most adapters keep a live session "ready" through its turns, so only a