Skip to content

Commit 0f7dc0f

Browse files
committed
ignore duplicate dependency resume messages
1 parent 6313db6 commit 0f7dc0f

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

packages/cli-v3/src/entryPoints/deploy-run-controller.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,15 @@ class ProdWorker {
585585
reconnectionDelayMax: 3000,
586586
},
587587
handlers: {
588-
RESUME_AFTER_DEPENDENCY: async ({ completions }) => {
588+
RESUME_AFTER_DEPENDENCY: async ({ attemptId, completions }) => {
589+
logger.log("Handling RESUME_AFTER_DEPENDENCY", {
590+
attemptId,
591+
completions: completions.map((c) => ({
592+
id: c.id,
593+
ok: c.ok,
594+
})),
595+
});
596+
589597
if (!this.paused) {
590598
logger.error("Failed to resume after dependency: Worker not paused");
591599
return;
@@ -616,12 +624,48 @@ class ProdWorker {
616624
return;
617625
}
618626

627+
const firstCompletion = completions[0];
628+
if (!firstCompletion) {
629+
logger.error("Failed to resume after dependency: No first completion", {
630+
completions,
631+
waitForTaskReplay: this.waitForTaskReplay,
632+
nextResumeAfter: this.nextResumeAfter,
633+
});
634+
return;
635+
}
636+
619637
switch (this.nextResumeAfter) {
620638
case "WAIT_FOR_TASK": {
639+
if (this.waitForTaskReplay) {
640+
if (this.waitForTaskReplay.message.friendlyId !== firstCompletion.id) {
641+
logger.error("Failed to resume after dependency: Task friendlyId mismatch", {
642+
completions,
643+
waitForTaskReplay: this.waitForTaskReplay,
644+
});
645+
return;
646+
}
647+
} else {
648+
// Only log here so we don't break any existing behavior
649+
logger.debug("No waitForTaskReplay", { completions });
650+
}
651+
621652
this.waitForTaskReplay = undefined;
622653
break;
623654
}
624655
case "WAIT_FOR_BATCH": {
656+
if (this.waitForBatchReplay) {
657+
if (!this.waitForBatchReplay.message.runFriendlyIds.includes(firstCompletion.id)) {
658+
logger.error("Failed to resume after dependency: Batch friendlyId mismatch", {
659+
completions,
660+
waitForBatchReplay: this.waitForBatchReplay,
661+
});
662+
return;
663+
}
664+
} else {
665+
// Only log here so we don't break any existing behavior
666+
logger.debug("No waitForBatchReplay", { completions });
667+
}
668+
625669
this.waitForBatchReplay = undefined;
626670
break;
627671
}

0 commit comments

Comments
 (0)