mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
fix(engine,producer): drive forceScreenshot from one authoritative local
Miguel R4 blocker on #2359: my R3 fix at renderOrchestrator only updated the observability copy, leaving the authoritative captureForceScreenshot local at compileResult.forceScreenshot (false for auto→software). The frameCapture side clamped its own local and correctly routed screenshot, but downstream orchestrator code overwrote observability back to beginframe from the still-false local at two sites: - Parallel-stream label at renderOrchestrator.ts:2293 mis-labelled the stream as 'beginframe' when actual capture was 'screenshot'. - capture_strategy telemetry at renderOrchestrator.ts:2440-2450 overwrote the earlier observability correction, so the final captureMode observation flipped back to 'beginframe' while the engine actually captured screenshot. Fix: extract the clamp into a caller-facing helper applyConcreteGpuScreenshotClamp(current, resolvedGpuMode, cfg) that returns the (possibly-promoted) new boolean. Callers assign it back to their authoritative local, so routing + telemetry + strategy code read one value. Changes: - packages/engine/src/config.ts: new exported applyConcreteGpuScreenshotClamp; delegates to shouldClampToScreenshotForConcreteGpu but computes the caller's final value, not just the clamp decision. Reads the programmatic opt-out from cfg.forceScreenshotExplicitlyOptedOut. Idempotent on already-true input. - packages/engine/src/index.ts: export the new helper. - packages/engine/src/services/frameCapture.ts: replace the inline OR expression with applyConcreteGpuScreenshotClamp. - packages/producer/src/services/renderOrchestrator.ts: assign result into the AUTHORITATIVE captureForceScreenshot local (was updating only observability). Downstream parallel-stream label at :2293 and capture_strategy telemetry at :2440-2450 now read the corrected value. Tests: 6 new caller-level cases for applyConcreteGpuScreenshotClamp covering the exact matrix Miguel called out: - resolved software + default false → promotes to true (screenshot) - resolved software + programmatic opt-out → stays false (BeginFrame) - resolved hardware + default false → stays false - resolved software + already-true → stays true (idempotent) - resolved software + env PRODUCER_FORCE_SCREENSHOT=false → stays false - resolved software + undefined cfg → promotes to true (frameCapture path) Local: 67/67 engine config tests pass (was 61). oxfmt clean.
This commit is contained in:
@@ -70,7 +70,7 @@ import {
|
||||
type SubTimelineWaitOutcome,
|
||||
resolveBrowserGpuMode,
|
||||
resolveHeadlessShellPath,
|
||||
shouldClampToScreenshotForConcreteGpu,
|
||||
applyConcreteGpuScreenshotClamp,
|
||||
scaleProtocolTimeoutForComposition,
|
||||
isMemoryExhaustionError,
|
||||
isTransientBrowserError,
|
||||
@@ -1909,25 +1909,27 @@ export async function executeRenderJob(
|
||||
chromePath: resolveHeadlessShellPath(cfg),
|
||||
browserTimeout: cfg.browserTimeout,
|
||||
});
|
||||
// Mirror the frameCapture.ts routing invariant here so observability
|
||||
// reports the actual capture mode on `browserGpuMode: "auto"` renders
|
||||
// that probe to software: `resolveConfig` couldn't see this at config
|
||||
// time, so `captureObservability.forceScreenshot` was still false,
|
||||
// misreporting `captureMode: "beginframe"` for a session that will
|
||||
// actually take the screenshot path. Both env and programmatic opt-outs
|
||||
// preserved via the shared helper (the programmatic one carried on the
|
||||
// Apply the software-GPU→screenshot clamp to the AUTHORITATIVE local
|
||||
// `captureForceScreenshot` (not just the observability copy) so all
|
||||
// downstream strategy + telemetry code reads the corrected value.
|
||||
// Otherwise: `frameCapture.ts` clamps its own local and routes
|
||||
// screenshot, but the still-`false` orchestrator local (a) mislabels the
|
||||
// parallel-stream logging as "beginframe" below and (b) overwrites the
|
||||
// earlier observability correction back to BeginFrame at the
|
||||
// capture_strategy telemetry site. `resolveConfig` couldn't see
|
||||
// `browserGpuMode:"auto"` resolving to software at config time, so
|
||||
// `captureForceScreenshot` was still `compileResult.forceScreenshot === false`
|
||||
// on that path. Both env and programmatic opt-outs preserved via
|
||||
// `applyConcreteGpuScreenshotClamp` (the programmatic one carried on the
|
||||
// config as `forceScreenshotExplicitlyOptedOut`).
|
||||
const observabilityForceScreenshot =
|
||||
captureObservability.forceScreenshot ||
|
||||
shouldClampToScreenshotForConcreteGpu(
|
||||
resolvedBrowserGpuMode,
|
||||
captureObservability.forceScreenshot,
|
||||
process.env,
|
||||
{ programmaticOptOut: cfg.forceScreenshotExplicitlyOptedOut ?? false },
|
||||
);
|
||||
captureForceScreenshot = applyConcreteGpuScreenshotClamp(
|
||||
captureForceScreenshot,
|
||||
resolvedBrowserGpuMode,
|
||||
cfg,
|
||||
);
|
||||
updateCaptureObservability({
|
||||
browserGpuMode: resolvedBrowserGpuMode,
|
||||
forceScreenshot: observabilityForceScreenshot,
|
||||
forceScreenshot: captureForceScreenshot,
|
||||
});
|
||||
const videoCaptureBeyondViewport = resolveVideoCaptureBeyondViewport(composition.videos.length);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user