fix(workers): preserve artifact failures through cleanup (#10055)

* fix(browser): preserve worker artifact failures through cleanup

* fix(javascript): preserve checkpoint failures before late cancellation
This commit is contained in:
morluto authored and GitHub committed 2026-11-11 17:25:48 +08:00
1 parent 2bb266b39b
commit 13abfdadff
5 files changed
+331 -49

No files matched your search

@@ -401,12 +401,15 @@ export class JavaScriptAnalysisWorker {
OPERATION,
"JavaScript worker emitted a duplicate static checkpoint",
);
const previousPhase = this.#phase;
this.#phase = "checkpoint-read";
javascript = await this.#readCheckpoint(
id,
file.path,
sourceIndex,
response,
);
this.#phase = previousPhase;
const exhausted = this.#parentCapacityFailure(file.path);
if (exhausted !== undefined) throw exhausted;
offeredResultBudget =
@@ -1276,6 +1279,7 @@ export class JavaScriptAnalysisWorker {
signal: AbortSignal | undefined,
): AnalysisError {
if (
this.#phase !== "checkpoint-read" &&
deadline?.interruption === "cancelled" &&
cause === deadline.signal.reason
)
@@ -1299,8 +1303,13 @@ export class JavaScriptAnalysisWorker {
cause.bindCleanupFailure(error);
return error;
}
// Ownership preparation is abortable before the worker deadline exists.
if (deadline?.interruption !== undefined)
// Checkpoint reads do not receive an AbortSignal. A rejected physical
// read or validation owns its failure even if the caller cancelled later.
// Ownership preparation remains abortable before the deadline exists.
if (
this.#phase !== "checkpoint-read" &&
deadline?.interruption !== undefined
)
return this.#interruptionFailure(path, deadline);
if (
deadline === undefined &&