Skip to content

Commit da2445c

Browse files
fix(server): let a run's queued checkpoint capture decide its finalization
A terminal write gated on the run still being current now enqueues the run's checkpoint capture in the same commit. Run finalization only looked at the outbox, where that capture did not exist yet, so an interrupted run was finalized as one that never captures and its checkpoint was never taken. Rolling back to the stopped turn then targeted the wrong turn. Normalization now sees the effects enqueued with the write. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent a3105df commit da2445c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,13 @@ const layerBase: Layer.Layer<
552552
};
553553
}
554554

555+
// The checkpoint capture enqueued below decides how a run that
556+
// settles here finalizes, so it must be visible to normalization.
555557
const normalized = yield* normalizeEvents(
556558
input.guardPendingUserInputCancellations === true
557559
? yield* guardUserInputCancellations(input.events)
558560
: input.events,
561+
input.effects,
559562
);
560563
const storedEvents = yield* eventStore.append({
561564
...(input.commandId === undefined ? {} : { commandId: input.commandId }),

0 commit comments

Comments
 (0)