Skip to content

fix(react): audio:"native" → unified audio field instead of blind fal.generate_audio injection - #237

Merged
SecurityQQ merged 1 commit into
mainfrom
fix/native-audio-unified-field
Sep 1, 2026
Merged

SecurityQQ merged 1 commit into
mainfrom
fix/native-audio-unified-field

Conversation

@SecurityQQ

Copy link
Copy Markdown
Contributor

Companion to vargHQ/api#111 and api migration 0147.

The audio: "native" sugar injected provider_options.fal.generate_audio into every varg gateway model, relying on the API silently stripping the flag where unsupported. The API now 422s on unknown provider_options keys, breaking renders on ~26 fal video models without generate_audio in their schema.

  • expandNativeAudio: for varg models sets providerOptions.varg.audio = true (unified field) instead of varg.fal.generate_audio
  • VargVideoModel.doGenerate: lifts audio from the varg namespace to the request body top level; the API maps it per model (rename audio → generate_audio) and silently ignores it elsewhere — same best-effort contract as unified resolution
  • direct fal/magnific providers untouched (bypass the varg API)

Tests: audio-element suite updated (27 pass); full bun test — only pre-existing pricing failures (also fail on main).

Note: render currently vendors vargai/@vargai-gateway — patched separately in the render repo until this ships in a release.

…erate_audio

The sugar blindly injected provider_options.fal.generate_audio into every
varg gateway model, relying on the varg API silently stripping the flag on
models whose fal schema doesn't declare it. The API now rejects unknown
provider_options keys with a 422 (silent stripping was losing real fields),
so the blind injection started failing renders on ~26 fal video models.

New contract: for varg models the sugar sets providerOptions.varg.audio =
true — the UNIFIED native-audio field. VargVideoModel lifts it out of the
varg namespace onto the request body top level; the API maps it per model
via mapping_rules (rename audio -> generate_audio, migration 0147) and
models without native-audio support silently ignore it (same best-effort
contract as the unified resolution field).

Direct fal/magnific providers keep their own generate_audio handling —
they bypass the varg API.
@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 3f2c094c-18a4-4ea7-9e63-90f0980236c0

📥 Commits

Reviewing files that changed from the base of the PR and between 51c2997 and 01dfe9e.

📒 Files selected for processing (3)
  • src/ai-sdk/providers/varg.ts
  • src/react/elements.ts
  • src/react/tests/audio-element.test.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

varg native audio now uses providerOptions.varg.audio. VargVideoModel lifts this value to params.audio, removes it from provider_options, and preserves remaining options only when present. Tests verify that the legacy nested fal namespace is absent.

Changes

varg audio flow

Layer / File(s) Summary
Inject the unified audio option
src/react/elements.ts, src/react/tests/audio-element.test.ts
expandNativeAudio now sets providerOptions.varg.audio. The test checks this field and confirms that providerOptions.varg.fal is absent.
Map audio into the request body
src/ai-sdk/providers/varg.ts
VargVideoModel.doGenerate moves audio to params.audio and sends remaining varg options as provider_options only when they are non-empty.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 01dfe

This change updates native-audio handling to use the unified video request field while preserving existing provider behavior. No actionable merge-blocking risk remains, so the PR is merge-ready after normal checks and review.

Poem

varg audio takes a cleaner flight
from nested fog to request-light
fal fades out of view
tests confirm the path is true
meow, the mapping shines bright

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed the title clearly identifies the react audio handling fix and the replacement of blind fal.generate_audio injection.
Description check ✅ Passed the description directly explains the varg audio mapping change, the 422 error prevention, affected providers, and test results.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/native-audio-unified-field

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@SecurityQQ
SecurityQQ merged commit 79fe656 into main Sep 1, 2026
2 of 3 checks passed
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.

1 participant