File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
internal-packages/run-engine/src/engine/systems Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,20 @@ export class CheckpointSystem {
5353 return await this . $ . runLock . lock ( [ runId ] , 5_000 , async ( ) => {
5454 const snapshot = await getLatestExecutionSnapshot ( prisma , runId ) ;
5555
56- if ( snapshot . id !== snapshotId && snapshot . previousSnapshotId !== snapshotId ) {
56+ const isValidSnapshot =
57+ // Case 1: The provided snapshotId matches the current snapshot
58+ snapshot . id === snapshotId ||
59+ // Case 2: The provided snapshotId matches the previous snapshot
60+ // AND we're in QUEUED_EXECUTING state (which is valid)
61+ ( snapshot . previousSnapshotId === snapshotId &&
62+ snapshot . executionStatus === "QUEUED_EXECUTING" ) ;
63+
64+ if ( ! isValidSnapshot ) {
65+ this . $ . logger . error ( "Tried to createCheckpoint on an invalid snapshot" , {
66+ snapshot,
67+ snapshotId,
68+ } ) ;
69+
5770 this . $ . eventBus . emit ( "incomingCheckpointDiscarded" , {
5871 time : new Date ( ) ,
5972 run : {
You can’t perform that action at this time.
0 commit comments