Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Stop reaches background work after a run fails before its provider starts #15474

Closedvitalyiegorov(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/15474/headopened View on GitHub

Showing 2 changed files with 32 additions and 9 deletions.

x
0 of 2 viewed, 2 left
18 additions and 4 deletionsapps/server/src/orchestration-v2/BackgroundWorkStop.integration.test.tsModified
View file
@@ -39,8 +39,9 @@
const modelSelection = { instanceId, model: "test-model" };
​
// Codex turns leave commands running, then the thread moves to another
-// provider thread (a provider switch). Stop on the newer, settled run must
-// reach both provider threads and end all of the Codex work.
+// provider thread (a provider switch), and its newest run fails before its
+// provider starts. Stop on that run must reach both provider threads and end
+// all of the Codex work.
it.effect("Stop reaches background work an earlier provider thread still runs", () =>
Effect.scoped(
Effect.gen(function* () {
@@ -387,6 +388,17 @@
});
const otherProviderThreadId = ProviderThreadId.make("provider-thread:other");
const latestRun = settledRun({ ordinal: 4, providerThreadId: otherProviderThreadId });
+ // The newest run failed before its provider started, so it has no
+ // provider turn of its own.
+ const failedRun = settledRun({ ordinal: 5, providerThreadId: otherProviderThreadId });
+ const failedRunEvents = failedRun.events.flatMap(
+ (event): Array<OrchestrationV2DomainEvent> =>
+ event.type === "provider-turn.updated"
+ ? []
+ : event.type === "run.created"
+ ? [{ ...event, payload: { ...event.payload, status: "failed" } }]
+ : [event],
+ );
yield* sink.write({
events: [