Skip to content

Commit b55f240

Browse files
t3dotggclaude
andcommitted
perf(server): cancelling a never-started wake skips the attempts read
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8437cce commit b55f240

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,12 +2826,20 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
28262826

28272827
if (deliveryRun?.status === "queued") {
28282828
if (remainingTaskIds.length === 0) {
2829+
const rootNodeFilter = {
2830+
nodeIds: deliveryRun.rootNodeId === null ? [] : [deliveryRun.rootNodeId],
2831+
};
28292832
yield* emitQueuedRunCancellation({
28302833
command,
28312834
events,
2832-
projection: yield* loadProjectionForCommand(command, ["nodes", "attempts"], {
2833-
nodeIds: deliveryRun.rootNodeId === null ? [] : [deliveryRun.rootNodeId],
2834-
}),
2835+
// Attempts have no id filter; a wake that never started has no attempt to cancel.
2836+
projection:
2837+
deliveryRun.activeAttemptId === null
2838+
? {
2839+
attempts: [],
2840+
...(yield* loadProjectionForCommand(command, ["nodes"], rootNodeFilter)),
2841+
}
2842+
: yield* loadProjectionForCommand(command, ["nodes", "attempts"], rootNodeFilter),
28352843
run: deliveryRun,
28362844
now,
28372845
});

0 commit comments

Comments
 (0)