Skip to content

fix(vace): stop firstlastframe log flood with config validation flag#687

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

fix(vace): stop firstlastframe log flood with config validation flag#687
livepeer-tessa wants to merge 1 commit intomainfrom
fix/vace-firstlastframe-log-flood

Conversation

@livepeer-tessa
Copy link
Contributor

Problem

VaceEncodingBlock in firstlastframe mode raises a ValueError on every processed chunk when num_frame_per_block=1. Since ValueError is treated as recoverable by pipeline_processor, the pipeline keeps running and re-fires the same error every ~50ms — producing ~700 identical ERROR log lines in a 22-second session window.

Root: the check lived deep inside _build_extension_frames_and_masks, which is called per-chunk with no gate to short-circuit once a config error is known.

Fixes #685

Changes

1. Early validation in _encode_extension_mode (before the tensor-build path)

  • Checks num_frame_per_block >= 2 for firstlastframe mode at the start of each encoding call
  • Emits a clear, actionable message naming the config knob and suggesting alternatives (firstframe/lastframe with a single ref image)

2. _config_validation_error flag on the block instance

  • Set to the error message string when validation fails on the first chunk
  • __call__ checks the flag at entry; if set, returns early with vace_context=None (silent, DEBUG log)
  • Only the first chunk ever reaches the log as an ERROR — subsequent chunks no-op
  • Reset by clear_encoder_caches() so a corrected config works normally in a new session

3. Redundant ValueErrorassert

  • The original deep check in _build_extension_frames_and_masks is converted to an assert; it is now dead code for callers going through __call__, but remains a safety net for direct callers.

Behaviour After Fix

Before After
First chunk ERROR logged ERROR logged (same)
Subsequent chunks ERROR × N per session silent (DEBUG only)
Corrected config / new session works works (flag reset by clear_encoder_caches)

Related

When num_frame_per_block=1 is used with firstlastframe mode the
validation check in _build_extension_frames_and_masks fires on every
chunk (~50ms intervals), producing ~700 identical ERROR log lines in a
22-second session window.

Fix with two changes:

1. Early validation in _encode_extension_mode — checks the
   num_frame_per_block constraint up-front (before the deep tensor
   build path) and emits a clear, actionable error message that names
   the config knob and suggests alternatives.

2. _config_validation_error flag — when the validation fails the flag
   is set on the block instance. __call__ checks the flag at entry and
   returns early (vace_context=None) for all subsequent chunks, so
   only the first occurrence reaches the log as an ERROR.  The flag is
   reset by clear_encoder_caches() so a new session with corrected
   config works normally.

The redundant ValueError in _build_extension_frames_and_masks is
converted to an assert; it now serves as a safety net for callers that
bypass the public __call__ path.

Fixes #685
Related: #673 (same per-chunk flood pattern, vace_encoding)

Signed-off-by: livepeer-robot <robot@livepeer.org>
@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: 33487a6e-7b00-4173-b40f-958aa4611866

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-log-flood
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

@github-actions
Copy link
Contributor

🚀 fal.ai Preview Deployment

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

Testing

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

uv run build && SCOPE_CLOUD_APP_ID="daydream/scope-pr-687--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-687--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