Skip to content

Commit 507051f

Browse files
fix(server): provider switches hand off started cancelled runs
A run the provider reported cancelled after it started was skipped as a handoff source, so switching providers dropped its prompt and response. Accept cancelled runs with a startedAt; queued requests cancelled before starting stay excluded. Fixes #34009 AI-assisted; verified with the tests and tools listed above.
1 parent 97c676c commit 507051f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,13 @@ function rootProviderThreadsForProvider(
11011101
}
11021102

11031103
function isHandoffSourceRun(run: OrchestrationV2Run): boolean {
1104-
return run.status === "completed" || run.status === "failed" || run.status === "interrupted";
1104+
return (
1105+
run.status === "completed" ||
1106+
run.status === "failed" ||
1107+
run.status === "interrupted" ||
1108+
// A queued request cancelled before it started never reached any provider.
1109+
(run.status === "cancelled" && run.startedAt !== null)
1110+
);
11051111
}
11061112

11071113
function lastDeliveredRunForProviderThread(

0 commit comments

Comments
 (0)