Skip to content

fix(servicer): media-processing follow-ups to #2624, #2626 and #2627 - #2645

Closed
hello-alexmcc wants to merge 4 commits into
mainfrom
fix/servicer-media-followups
Closed

hello-alexmcc wants to merge 4 commits into
mainfrom
fix/servicer-media-followups

Conversation

@hello-alexmcc

Copy link
Copy Markdown
Collaborator

Description

Split out of #2642 (items 2–5, servicer side) from the reviews of #2624, #2626 and #2627 that merged without them. Every live fact below is the reviewer's observation quoted from the write-up; none of this was run against a cluster. The capability probe from #2640 (mm_salt.py) is left exactly as merged.

2. VideoMediaIO import and the frame budget (from #2624)

vllm.multimodal.video VideoMediaIO: absent / vllm.multimodal.media VideoMediaIO: present (nightly 0.29.1rc1, also current vLLM main)

The default was never found, so with no explicit num_frames the budget was written in its place, which for a budget above vLLM's 32 raised sampling. vllm_default_video_frames imports from vllm.multimodal.media (the except Exception fallback stays); with the default unknown and nothing set, clamp_video_frames leaves sampling untouched and logs one WARNING. The construction-test stub registers vllm.multimodal.media / .media.video, so the test exercises the production import; a new test covers the unknown-default case with num_frames left absent.

3. Proto floor, servicer version, field tests (from #2626)

grpc_servicer/pyproject.toml:7 is still version = "0.12.0" and :11 still "smg-grpc-proto>=0.4.20" … grep -rn mm_processor_source grpc_servicer/tests is empty

smg-grpc-proto>=0.4.21 with the annotated comment (0.4.21 is the first release with both GetServerInfoResponse.mm_processor_source (18) and GenerateComplete.media_identity (15): #2627 did not bump, per git log -- crates/grpc_client/proto/vllm_engine.proto), servicer 0.13.0. Both descriptor probes are gone: GetServerInfo sets mm_processor_source whenever a processor is advertised, _complete_response sets media_identity whenever one was built, media_identity_supported() is deleted (the router-side WARN for an older servicer stays, that one is legitimate). test_media_refs_proto_fields.py covers fields 18 and 15 (number, default, round trip); a servicer test asserts GetServerInfo(...).mm_processor_source == "flag" / "env" (vLLM lane).

Also from that review: a blank flag or env value (--mm-redis-url "", SMG_VLLM_MM_PROCESSOR=" ") is unset, consistently; client-visible strings lead with --mm-processor; the sidecar's --mm-sidecar-timeout-ms applied to nothing (each job carries its deadline_ms), so it is removed together with the README sentence built on it. Kept on purpose: e2e_test/infra/worker.py still sets SMG_VLLM_MM_PROCESSOR: the upstream launcher (vllm/entrypoints/launchers/grpc_server.py on vLLM main, checked 2026-09-23) has no --mm-* flags yet, so the e2e deprecation line stays until the launcher change lands, and env support cannot end in the next minor release before it does.

4. Guarded identity build (from #2627)

build_media_identity … can raise on shapes it did not anticipate … Any of these turns a request the engine already served into an error to the client.

The call is wrapped: a failure logs Request %s: media identity not built (%s); the decode leg will reprocess the media and the leg answers without an identity. Test in test_vllm_pd_media_identity.py (vLLM lane): build_media_identity raises, the request still completes.

5. Both video timing names, servicer side (from #2627)

The name second_per_grid_ts appears in this repository only there and in the router-side VLLM_MROPE_GRID_KEYS … while every processor and registry emits video_second_per_grid

Verified in vLLM main: the Qwen-VL processors (qwen2_5_vl.py, qwen3_vl.py) use second_per_grid_ts, the Qwen-Omni family (qwen2_5_omni_thinker.py, qwen3_omni_moe_thinker.py) and this gateway's processors video_second_per_grid. GRID_KEYS carries both, with a video case per spelling. The router's mirror (VLLM_MROPE_GRID_KEYS) is in the router follow-ups PR; each side tolerates the other's version.

Changes

  • grpc_servicer/smg_grpc_servicer/vllm/mm_processor.py (2, 3), vllm/servicer.py (3, 4), vllm/media_identity.py (3, 5), vllm/mm_sidecar.py, README.md, pyproject.toml (3).
  • Tests: test_vllm_mm_processor.py, test_media_refs_proto_fields.py, test_vllm_mm_sidecar.py, test_vllm_media_identity.py, test_vllm_pd_media_identity.py.

Test Plan

Each item's test was written first and watched fail before the fix.

  • Servicer, in the venv from the write-up's recipe (uv venv .venv && uv pip install … -e crates/grpc_client/python -e grpc_servicer …): 413 passed, 12 skipped (the vLLM-gated tests, including the three new ones in test_vllm_mm_processor.py::TestServicerWiring and test_vllm_pd_media_identity.py, run on the vLLM e2e lane).
  • Pre-commit hooks over the changed files pass.
  • Not run here (no cluster): MiniMax-M3 prefill/decode pair with the servicer from this branch on both legs: one image request → prefill log media_refs=1, decode log media_refs=0, preprocessed_mm=True, only the prefill sidecar sees the job; the same with a short video; SMG_VLLM_MM_MAX_VIDEO_FRAMES=16 on the sidecar container caps decoding at 16 frames, unset leaves it as vLLM decides; /workers shows mm_processor_source for an env-configured servicer.
Checklist
  • cargo +nightly fmt passes (no Rust change)
  • cargo clippy --all-targets -- -D warnings passes (no Rust change)
  • (Optional) Documentation updated (servicer README)
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

…edia

vllm.multimodal.video is not a module on the vLLM this servicer targets
(VideoMediaIO is re-exported from vllm.multimodal.media), so the default
frame count was never found and the budget was written in its place,
which for a budget above vLLM's default of 32 raised sampling instead of
capping it. The import is corrected, an unknown default with no explicit
count now leaves sampling untouched with one warning, and the test stub
registers the module production imports.

Signed-off-by: Alex McC <319643551+hello-alexmcc@users.noreply.github.com>
…r probes

smg-grpc-proto 0.4.21 is the first release with
GetServerInfoResponse.mm_processor_source (18) and
GenerateComplete.media_identity (15); the servicer now requires it, as
0.13.0, and sets both fields without probing the descriptor. The proto
contract tests cover both fields, and GetServerInfo names the processor
mode's source in a servicer test.

Also from that review: a blank flag or environment value is unset,
consistently; client-visible messages lead with --mm-processor; the
sidecar's --mm-sidecar-timeout-ms, which applied to nothing (each job
carries its deadline), is gone with the README claim built on it.

Signed-off-by: Alex McC <319643551+hello-alexmcc@users.noreply.github.com>
…not build

build_media_identity ran after the engine had answered and could raise
on shapes it did not anticipate (a missing prompt_token_ids key, mixed
grid dtypes, a non-tensor element), turning a served request into a
client error. The identity is an optimisation with a fallback, decode
reprocessing the media, so the build is now guarded: a failure logs
one warning with the request id and the leg answers without it.

Signed-off-by: Alex McC <319643551+hello-alexmcc@users.noreply.github.com>
…identity

vLLM's Qwen-VL processors emit the video timing as second_per_grid_ts,
the Qwen-Omni family and the gateway's own processors as
video_second_per_grid; the identity relay listed only the first, so a
worker-processed video's timing could be dropped from the decode leg
and its M-RoPE positions rebuilt without it. The servicer's GRID_KEYS
carries both, with a test per spelling; the router's mirror
(VLLM_MROPE_GRID_KEYS) lands with the router follow-ups.

Signed-off-by: Alex McC <319643551+hello-alexmcc@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Dependency updates grpc gRPC client and router changes tests Test changes labels Sep 23, 2026
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 4574e109-97bd-46dc-af0b-7eff26833993

📥 Commits

Reviewing files that changed from the base of the PR and between 872b84f and 01c41e3.

📒 Files selected for processing (11)
  • grpc_servicer/README.md
  • grpc_servicer/pyproject.toml
  • grpc_servicer/smg_grpc_servicer/vllm/media_identity.py
  • grpc_servicer/smg_grpc_servicer/vllm/mm_processor.py
  • grpc_servicer/smg_grpc_servicer/vllm/mm_sidecar.py
  • grpc_servicer/smg_grpc_servicer/vllm/servicer.py
  • grpc_servicer/tests/test_media_refs_proto_fields.py
  • grpc_servicer/tests/test_vllm_media_identity.py
  • grpc_servicer/tests/test_vllm_mm_processor.py
  • grpc_servicer/tests/test_vllm_mm_sidecar.py
  • grpc_servicer/tests/test_vllm_pd_media_identity.py

Included review availability: 6 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Video media identity now supports an additional video-timing format.
  • Bug Fixes
    • Blank configuration values now fall back to environment settings or defaults.
    • Video-frame limits no longer alter sampling when the default frame count is unknown and no limit is configured.
    • Generation can continue if media identity cannot be built.
    • The sidecar now relies on each job’s deadline rather than a separate timeout setting.

Walkthrough

The changes update processor-setting resolution and video-frame handling, adjust media-identity construction and proto-field handling, and remove sidecar timeout configuration.

Changes

Media Processing and Identity

Layer / File(s) Summary
Processor settings and video sampling
grpc_servicer/smg_grpc_servicer/vllm/mm_processor.py, grpc_servicer/smg_grpc_servicer/vllm/servicer.py, grpc_servicer/tests/test_vllm_mm_processor.py
Blank settings now resolve as unset. Processor-related errors identify the launcher flag. If the video-frame default is unknown and no frame count is configured, sampling remains unchanged. Tests cover these behaviors and processor-source reporting.
Media identity construction and proto fields
grpc_servicer/pyproject.toml, grpc_servicer/smg_grpc_servicer/vllm/media_identity.py, grpc_servicer/smg_grpc_servicer/vllm/servicer.py, grpc_servicer/tests/test_media_refs_proto_fields.py, grpc_servicer/tests/test_vllm_media_identity.py, grpc_servicer/tests/test_vllm_pd_media_identity.py
The package version and minimum proto dependency are updated. Media identity includes the alternate video timing key. The servicer attempts identity construction without checking proto descriptor support, and continues without an identity if construction raises an exception.

Sidecar Deadline Settings

Layer / File(s) Summary
Remove sidecar timeout setting
grpc_servicer/smg_grpc_servicer/vllm/mm_sidecar.py, grpc_servicer/README.md, grpc_servicer/tests/test_vllm_mm_sidecar.py
The sidecar no longer resolves or parses a timeout setting, or logs a timeout value. Documentation and tests describe the per-job deadline and the removed flag.

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

Merge Risk: ⚪ Minimal · up to 01c41

No actionable issue is established that should block merging. Normal validation remains appropriate for the updated media-processing paths.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 9 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description directly explains the servicer-side media-processing fixes, configuration changes, compatibility updates, tests, and known testing limits.
Title check ✅ Passed The title clearly identifies the servicer media-processing follow-ups addressed by the pull request and references the related reviews.
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: Docstring Coverage

Explanation

Docstring coverage is 26.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 9 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@claude

claude Bot commented Sep 23, 2026

Copy link
Copy Markdown

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Missing header: ### Problem
  • Missing header: ### Solution

Please update the PR description so reviewers have the context they need.

help="the worker's job timeout, for the startup log (falls back to "
"SMG_VLLM_MM_SIDECAR_TIMEOUT_MS)",
)
parser.add_argument("--concurrency", type=int, default=2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit: Dropping --mm-sidecar-timeout-ms from the parser outright is a hard break for existing sidecar launch commands: argparse exits at startup with "unrecognized arguments" after an upgrade. The flag was informational-only, so the removal is semantically safe, but elsewhere this PR gives env vars a deprecation release ("env support ends in the next minor release"). Consider accepting the flag as a suppressed no-op for one release (e.g. parser.add_argument("--mm-sidecar-timeout-ms", type=int, default=None, help=argparse.SUPPRESS) plus a deprecation warning when set) before removing it.

Comment on lines +25 to +29
# the video timing that goes with them, in both spellings: `second_per_grid_ts`
# from the Qwen-VL processors, `video_second_per_grid` from the Qwen-Omni
# family and the router's own processors. The router's VLLM_MROPE_GRID_KEYS
# mirrors this list.
GRID_KEYS = ("image_grid_thw", "video_grid_thw", "second_per_grid_ts", "video_second_per_grid")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit: "The router's VLLM_MROPE_GRID_KEYS mirrors this list" is ahead of the tree: model_gateway/src/routers/grpc/proto_wrapper.rs:1278 still has the three-key list (video_second_per_grid is in the router follow-ups PR, per the description). Since merge order isn't guaranteed, consider phrasing it as intent ("the router's VLLM_MROPE_GRID_KEYS is kept in sync with this list") or referencing the follow-up, so the comment doesn't read as a broken cross-reference if this lands first. No functional concern either way — I verified apply_media_identity relays the identity batches verbatim, so an old router tolerates the new key.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full review of the servicer-side media-processing follow-ups. No blocking issues found: 0 🔴 Important, 2 🟡 Nit, 0 🟣 Pre-existing (inline).

Verified along the way:

  • The guarded build_media_identity correctly initializes media_identity = None and the except Exception cannot swallow cancellation (CancelledError is a BaseException); the new PD test covers the fallback path.
  • Dropping the descriptor probes is safe given the smg-grpc-proto>=0.4.21 floor, and the router-side WARN for older servicers is kept.
  • clamp_video_frames with an unknown vLLM default now leaves sampling untouched (a cap must never raise sampling) and warns once at construction — both the worker and the sidecar call it only at build time, so no log spam.
  • Blank flag/env handling (_blank, resolve, resolve_mm_processor_mode) is consistent: blank falls through flag → env → default, with tests for both layers.
  • The new error message's --mm-processing cross-reference exists on the router (model_gateway/src/main.rs), and an old router relays the new video_second_per_grid identity key verbatim (apply_media_identity uses clone_from), so the cross-PR ordering with the router follow-ups is safe.

Nits: the hard removal of the sidecar's --mm-sidecar-timeout-ms flag breaks existing launch commands at argparse without the deprecation grace the PR gives env vars, and the VLLM_MROPE_GRID_KEYS mirror comment is ahead of the tree until the router follow-up lands.

Also posted separately: the PR description is missing the template's ### Problem / ### Solution headers.

@hello-alexmcc

Copy link
Copy Markdown
Collaborator Author

Closing in favour of one-concern-per-PR splits, at the maintainer's request. The requested changes were also re-judged on their merits rather than carried over wholesale; what survived:

Dropped, with reasons: the servicer capability-probe changes (#2640's author's call); .bmp rejection (imitates a cloud-side limitation a self-hosted engine does not have); GLM-5-Next in the enabled-only thinking rules (unrecorded); blank flag/env values as unset (no observed problem); the budget predicate, header and doc trims (cosmetic); CORS x-api-key (speculative); metrics label-name colons (a Prometheus client cannot emit an illegal label name); RawBody duplicate-key dedupe and case table (unreachable, as the review itself notes). The /engine_metrics breaking-change release note from #2636 is for the release author, not a PR.

@torchspec-bot
torchspec-bot deleted the fix/servicer-media-followups branch September 24, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates documentation Improvements or additions to documentation grpc gRPC client and router changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant