Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(producer): retry an interleaved parallel-stream plan at one worker, never N contiguous
Vance Ingalls9d72e7fa2359
diff --git a/packages/producer/src/services/render/capturePlan.test.ts b/packages/producer/src/services/render/capturePlan.test.tsindex 55aebe02ba..a40f8f17f1 100644--- a/packages/producer/src/services/render/capturePlan.test.ts+++ b/packages/producer/src/services/render/capturePlan.test.ts@@ -53,6 +53,49 @@ describe("CapturePlan", () => {expect(initial.kind).toBe("sdr_streaming");});+ it("retries interleaved parallel streaming at one worker, never N contiguous", () => {+ // The non-DE router's plan: N workers, interleaved, default routing.+ const routed = createCapturePlan({+ workerCount: 4,+ forceScreenshot: false,+ forceParallelStream: true,+ useStreamingEncode: true,+ useLayeredComposite: false,+ usePageSideCompositing: false,+ hasHdrContent: false,+ needsAlpha: false,+ });+ expect(routed).toMatchObject({+ kind: "sdr_streaming",+ forceParallelStream: true,+ routing: { kind: "default" },+ });+ const next = replanAfterFailure(routed, { kind: "capture_failure", memoryExhaustion: false });+ // Not `workerCount: 4, forceParallelStream: false` — that is contiguous+ // streaming, the serialising shape interleaving exists to avoid.+ expect(next).toMatchObject({+ kind: "sdr_streaming",+ workerCount: 1,+ forceParallelStream: false,+ forceScreenshot: true,+ });++ // A plan that was never interleaved keeps its worker count on retry.+ const plain = createCapturePlan({+ workerCount: 4,+ forceScreenshot: false,+ forceParallelStream: false,+ useStreamingEncode: true,+ useLayeredComposite: false,+ usePageSideCompositing: false,+ hasHdrContent: false,+ needsAlpha: false,+ });+ expect(+ replanAfterFailure(plain, { kind: "capture_failure", memoryExhaustion: false }).workerCount,+ ).toBe(4);+ });+it("makes page-side compositing force screenshot capture", () => {const plan = createCapturePlan({workerCount: 1,diff --git a/packages/producer/src/services/render/capturePlan.ts b/packages/producer/src/services/render/capturePlan.tsindex 4fb0abfe47..6467bf398b 100644--- a/packages/producer/src/services/render/capturePlan.ts+++ b/packages/producer/src/services/render/capturePlan.ts@@ -279,11 +279,19 @@ export function replanAfterFailure(plan: CapturePlan, failure: CapturePlanFailur// low-resource target. It is also the viable choice when disk, rather than// RAM, makes the preferred fallback impossible — for any routing kind// (see drawElementVerificationFailure for when that flag is populated).+ // An interleaved parallel-streaming plan (the non-DE router's shape) never+ // retries at N workers. With forceParallelStream off, N workers means+ // contiguous-chunk streaming, where worker k+1's first frame waits for ALL+ // of worker k's: throughput serialises to roughly one worker while N Chrome+ // processes run, and the no-progress watchdog can re-trip on the same+ // render. Single-worker streaming is the fully hardened path — typed stall,+ // init-excluded clock, routing-independent retry — so that is the target.+ const retryAtOneWorker = isMemoryExhaustion || plan.forceParallelStream;const fallback =plan.routing.kind === "default"? {kind: plan.kind,- workerCount: isMemoryExhaustion ? 1 : plan.workerCount,+ workerCount: retryAtOneWorker ? 1 : plan.workerCount,forceParallelStream: false,}: isMemoryExhaustion || diskFallbackUnavailable