fix(producer): a probe step's out-of-memory error keeps its words, so it still reads as memory (#8513)

* fix(producer): a probe step's out-of-memory error keeps its words, so it still reads as memory

* fix(producer): drop the comment the memory check's name already says
This commit is contained in:
Miguel Ángel
2026-11-22 15:44:00 +00:00
committed by GitHub
parent fbd1cd4bcf
commit 258a3cf4ea
2 changed files with 19 additions and 1 deletions
@@ -185,6 +185,8 @@ mock.module("@hyperframes/engine", () => ({
},
// Mirror of the real engine classifier. Canonical tests + pattern list
// live in frameCapture-transientErrors.test.ts — update both if patterns change.
isMemoryExhaustionError: (error: unknown) =>
/^out of memory\.?$/i.test(error instanceof Error ? error.message.trim() : ""),
isTransientBrowserError: (error: unknown) => {
const msg = error instanceof Error ? error.message : String(error);
if (/Composition has zero duration[\s\S]*Runtime ready: false/.test(msg)) return true;
@@ -1890,4 +1892,15 @@ describe("runProbeStage — a page call that never answers", () => {
browserMediaError = null;
}
});
it("leaves a bare out-of-memory message as it is, so it is still read as memory exhaustion", async () => {
resetRetryMocks();
browserMediaError = new Error("Out of memory");
const { runProbeStage } = await import("./probeStage.js");
try {
await expect(runProbeStage(makeProbeInput({}))).rejects.toThrow(/^Out of memory$/);
} finally {
browserMediaError = null;
}
});
});
@@ -44,6 +44,7 @@ import {
getCompositionDuration,
getCompositionLengthSource,
initializeSession,
isMemoryExhaustionError,
isTransientBrowserError,
probeBeginFrameLiveness,
videoAudioId,
@@ -496,7 +497,11 @@ async function probeStep<T>(step: string, call: () => Promise<T>): Promise<T> {
try {
return await call();
} catch (error) {
if (error instanceof Error && !error.message.startsWith(STOPPED))
if (
error instanceof Error &&
!error.message.startsWith(STOPPED) &&
!isMemoryExhaustionError(error)
)
error.message = `${STOPPED}${step}: ${error.message}`;
throw error;
}