Skip to content

fix(multimodal): correct VGR attachment errors and video translation - #1399

Open
gburachas wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
gburachas:fix/qa-err-fix-multimodal-routing
Open

gburachas wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
gburachas:fix/qa-err-fix-multimodal-routing

Conversation

@gburachas

@gburachas gburachas commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Fix multimodal attachment handling across VGR, backend health, and format translation (QA BUG-47 through BUG-50).

  • Enable efficient-tier attachment attempts by default in both the Rust API and TOML configuration. An explicit efficient_supports_attachments = false still opts out.
  • Return cloud attachment errors after VGR escalates. Remove the unverified efficient fallback, so a rejected local answer is never regenerated and served after cloud failure. Log the selected tier instead of claiming it has already served a response.
  • Classify unsupported audio, image patch-limit, and unsupported MIME-type errors as attachment rejections. Unsupported-audio HTTP 500 responses no longer trigger local retries or backend cooldown, so later Auto and Local Only text requests can use local immediately.
  • Preserve Chat Completions video_url blocks as video. Reject translation to Responses with HTTP 400 before sending a cloud request, rather than encoding the video payload as text.

Why

Unsupported media could take a healthy local backend out of service, send base64 video to cloud as billable text, or bypass VGR verification after cloud rejected an attachment. These changes return explicit errors and keep unrelated requests usable.

BUG-47 uses its permitted error outcome when cloud cannot read the attachment. This also addresses BUG-50 without serving a rejected local answer.

Notes for reviewers

Start with VGR outcome construction, shared attachment-error classification, and the Chat/Responses content codecs. HTTP regressions cover audio followed by text on Auto and Local Only, video rejection before cloud egress, and ICO/JPEG/MP4 cloud rejection with buffered and streaming requests.

Behavior changes:

  • Removing unverified efficient fallback applies to all content types, including cloud outages.
  • Attachment attempts default to enabled; off and shadow modes still serve cloud. This setting does not discover model modality support. Local models and judges must support the formats they receive. Existing configurations can set efficient_supports_attachments = true and reload/restart the integration, or omit the setting after upgrading.

Validation passed:

cargo fmt --all -- --check
git diff --check
cargo test -p switchyard-libsy -p switchyard-protocol --lib
cargo test -p switchyard-llm-client -p switchyard-runner --lib
cargo test -p switchyard-server --test server
cargo test -p switchyard-translation

The protocol, VGR, client, runner, and HTTP server suites passed 769 tests on the final code. The translation suite passed 274 tests; its code has not changed since that run. Reproductions use mocked upstream errors and synthetic attachment payloads. Live model endpoints and full-size media were not tested.

No CI behavior changes.

Summary by CodeRabbit

  • Behavior Changes
    • Attachment requests now use the efficient tier by default when supported; you can disable those attempts to send attachments directly to the capable tier.
    • If the capable tier is unavailable or rejects a request, the request returns an error instead of an unverified efficient-tier answer.
  • Bug Fixes
    • Unsupported audio requests no longer trigger retries or failure cooldowns.
    • Video attachments remain intact for Chat Completions. Requests translated to OpenAI Responses now return an error before dispatch, without including the video payload in the error.
  • Documentation
    • Updated routing and translation guidance to reflect these behaviors and defaults.

Signed-off-by: Giedrius Burachas <gburachas@nvidia.com>
Signed-off-by: Giedrius Burachas <gburachas@nvidia.com>
Signed-off-by: Giedrius Burachas <gburachas@nvidia.com>
Signed-off-by: Giedrius Burachas <gburachas@nvidia.com>
@gburachas
gburachas requested a review from a team as a code owner November 25, 2026 21:05
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

VGR now defaults to attempting attachments on the efficient tier and does not serve an unverified efficient-tier answer after selecting the capable tier. Attachment rejection matching covers additional audio and image errors. OpenAI Chat preserves video attachments, while OpenAI Responses rejects them as invalid requests.

Changes

VGR Media Handling

Layer / File(s) Summary
VGR selection and verification policy
crates/libsy/src/algorithms/vgr/*, crates/libsy/src/core/algorithm.rs, crates/switchyard-runner/src/algorithm.rs, crates/switchyard-server/tests/server.rs, docs/reference/toml_schema.md, docs/routing_algorithms/vgr_routing.md
VGR defaults efficient-tier attachment attempts to enabled and removes the path that serves an unverified efficient-tier answer after a capable-tier decision. Failure-history tracking is removed, decision logs name the selected tier, and tests and documentation reflect these behaviors.
Attachment rejection and fallback handling
crates/protocol/src/client.rs, crates/libsy-llm-client/src/run.rs, crates/switchyard-server/tests/server.rs, docs/routing_algorithms/vgr_routing.md
Attachment rejection matching adds audio, image patch-limit, and MIME error patterns. VGR fallback tests and server tests cover local and capable target errors, including subsequent text requests after audio rejection.
Video attachment translation and request errors
crates/switchyard-translation/src/codecs/openai_chat/buffered.rs, crates/switchyard-translation/src/codecs/responses/buffered.rs, crates/libsy-llm-client/src/client.rs, crates/switchyard-translation/tests/request_translation.rs, crates/switchyard-server/tests/server.rs, docs/reference/protocols/translation.md
OpenAI Chat decoding and encoding preserve raw video_url blocks. OpenAI Responses encoding rejects video content, and the LLM client maps that invalid-value error to an invalid request. Translation and server tests cover the behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: Minimal · up to 99dab

The change defaults VGR to attempting attachments on the efficient tier and returns capable-tier attachment errors instead of serving an unverified local answer. It also rejects video for Responses targets with a 400 before any cloud request. No actionable merge-blocking risk was found in the supplied review.

Security architecture risk: Moderate · up to 99dab

An upgrade can send attachments to configured destinations that did not previously receive them, even on routes that do not serve the resulting answer. The change also blocks unsupported video from reaching one destination and removes an unverified fallback, but a failed check can still let a proposed tool call reach the caller.

Retained concerns

  • Medium · security · observed: Existing enabled routes that omit the attachment setting now send attachment-bearing requests to the efficient target. Auxiliary calls can also copy raw media from instructions, message history, and nested tool results to configured judges. The same flag controls primary eligibility and verifier disclosure, so enabling an efficient attempt cannot independently keep media out of verifier calls. Shadow mode limits which answer is returned, not which endpoints can receive the media.
  • Medium · security · inferred: The previous default sent attachment-bearing requests to the capable tier before efficient generation. On an active route using the new default, an efficient model can return a structurally complete tool-call proposal and the judge can reject the copied media. A media rejection is not an endpoint failure, so the existing fail-open path can return that proposal without a usable verification result. This expands exposure of existing behavior; it does not establish tool execution or a privilege gain.
  • Low · reliability · inferred: A genuine transient HTTP 500 whose message or raw body matches the added attachment phrases would now skip client retry and per-target cooldown. This could weaken failure containment for requests sharing that target. There is no evidence that a deployed upstream emits such a body for a genuine outage or that a caller can control that classification. The VGR breaker predicate is unchanged.
Security review details

Security Blast Radius

  • observed — The new default affects attachment-bearing requests that reach an eligible VGR route. Potential recipients are its configured efficient and verifier endpoints, including a separately configured capable verifier when its verification step is reached. The judge defaults to the efficient target. Recipient locality and tenant sharing depend on deployment configuration.

Trust Boundaries and Controls

  • observed — Media follows operator-configured model targets. Responses encoding is a control on that provider call, not a universal ingress filter, and the inspected Chat codec preserves the supplied block rather than fetching its URL.

Hardening Proposals

  • proposed — Separate efficient-tier media capability from permission to send media to each verifier. Before rollout, pin the old behavior on routes whose destinations are not approved for attachment data.
  • proposed — For attachment-bearing tool proposals, escalate or return an error when required turn verification cannot produce a usable result, and test that case with a media-capable generator and a media-rejecting judge.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(multimodal): correct VGR attachment errors and video translation" matches the changeset. The diff changes VGR attachment error handling, including removing the unverified efficient fall…
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.
Full details: Title check

Explanation

The title "fix(multimodal): correct VGR attachment errors and video translation" matches the changeset. The diff changes VGR attachment error handling, including removing the unverified efficient fallback after capable-tier failure. It also adds attachment-rejection classification for unsupported audio, image patch limits, and MIME types. It makes Chat Completions video_url translation to Responses fail with an error. The title names the two main areas, so it is specific and conventional. It is not a full list of changes, which is acceptable.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the routing trail,
Video blocks stay whole in Chat.
Responses sends a clear request error,
Audio finds its proper path.
No unverified answer takes the stage,
The rabbit hops through tests with joy.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 435d3b9 and 99dab62.

Files selected for processing: 17

  • crates/libsy-llm-client/src/client.rs
  • crates/libsy-llm-client/src/run.rs
  • crates/libsy/src/algorithms/vgr.rs
  • crates/libsy/src/algorithms/vgr/config.rs
  • crates/libsy/src/algorithms/vgr/runtime.rs
  • crates/libsy/src/algorithms/vgr/runtime/tests.rs
  • crates/libsy/src/algorithms/vgr/safety.rs
  • crates/libsy/src/core/algorithm.rs
  • crates/protocol/src/client.rs
  • crates/switchyard-runner/src/algorithm.rs
  • crates/switchyard-server/tests/server.rs
  • crates/switchyard-translation/src/codecs/openai_chat/buffered.rs
  • crates/switchyard-translation/src/codecs/responses/buffered.rs
  • crates/switchyard-translation/tests/request_translation.rs
  • docs/reference/protocols/translation.md
  • docs/reference/toml_schema.md
  • docs/routing_algorithms/vgr_routing.md
Files with no reviewable changes: 2

  • crates/libsy/src/algorithms/vgr/safety.rs
  • crates/libsy/src/core/algorithm.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

This branch has not been deployed

No deployments
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