Skip to content

fix(vace): validate firstlastframe frame count early with actionable error message#686

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/vace-firstlastframe-validation
Open

fix(vace): validate firstlastframe frame count early with actionable error message#686
livepeer-tessa wants to merge 1 commit intomainfrom
fix/vace-firstlastframe-validation

Conversation

@livepeer-tessa
Copy link
Contributor

Problem

When a user runs streamdiffusionv2 (or any VACE pipeline) with firstlastframe mode and num_frame_per_block=1, VaceEncodingBlock raises a ValueError on every single processed chunk, flooding logs with hundreds of identical errors. Observed in prod on 2026-03-14 03:29 UTC — ~700 ERROR lines in 22 seconds from a single job.

Root cause: the frame-count check lived deep in _build_overlay_context, which is called per-chunk. No early exit, no actionable message.

Closes #685

Fix

Add a single guard at the top of _encode_extension_mode — before loading images or touching the GPU — that:

  1. Detects the invalid configuration on the first chunk
  2. Raises a ValueError with an actionable message telling the user exactly what to change (num_frame_per_block >= 2)

The pipeline still fails (correct — the config is genuinely invalid), but it now fails once per chunk with a clear message rather than producing a silent log storm.

Changes

  • src/scope/core/pipelines/wan2_1/vace/blocks/vace_encoding.py: 15-line guard added before _build_extension_frames_and_masks

Testing

Existing behaviour verified via code review — the downstream assertion in _build_overlay_context is now unreachable for this case (the guard fires first). No runtime changes for valid configs (num_frame_per_block >= 2).

Related

…error

When firstlastframe mode is used with num_frame_per_block=1 the existing
check deep inside _build_overlay_context fired on every processed chunk,
flooding logs with hundreds of identical errors in a single session.

Add an early validation in _encode_extension_mode (before any expensive
work) that raises a clear ValueError immediately with:
- the exact frame count required vs what was configured
- the specific config knob to fix (num_frame_per_block >= 2)
- an alternative suggestion (use firstframe/lastframe mode)

This means the pipeline still fails (correct behaviour — the config is
invalid), but it fails once per chunk with a message the user can act on
rather than producing a log storm from the same repeated assertion.

Observed in prod: ~700 identical ERROR log lines in 22 s from a single
fal.ai job (89097129-4a48-4508-b53f-ac8de2f75ea0) on streamdiffusionv2.

Fixes #685
@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63d8a4e4-4c2a-4547-96e8-59723e5c1665

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/vace-firstlastframe-validation
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@github-actions
Copy link
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-686--preview
WebSocket wss://fal.run/daydream/scope-pr-686--preview/ws
Commit 7296530

Testing

Connect to this preview deployment by running this on your branch:

uv run build && SCOPE_CLOUD_APP_ID="daydream/scope-pr-686--preview/ws" uv run daydream-scope

🧪 E2E tests will run automatically against this deployment.

@github-actions
Copy link
Contributor

✅ E2E Tests passed

Status passed
fal App daydream/scope-pr-686--preview
Run View logs

Test Artifacts

Check the workflow run for screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VaceEncodingBlock: firstlastframe mode floods error logs when num_frame_per_block=1 (need 8, got 4)

1 participant