Repository navigation
feat(model): optionally omit unsupported Responses fields - #3976
alexandery-nvidia merged 4 commits into
Conversation
linj-glitch
left a comment
There was a problem hiding this comment.
Reviewed the opt-in conversion policy, preserved reasoning effort, strict defaults, and unsupported field/part rejection against current main and the existing model-server contract. No blocking findings remain.
Validation: 321 focused tests passed; full pre-commit suite and git diff --check passed. Model plugin imports were pinned to this review checkout in the shared dependency environment. Additive main merges preserve the author commits and retain the current-main credential-redaction regression tests. No fresh GPU/model rollout was run locally; the author-provided downstream deployment evidence is retained above.
|
/ok to test dc6e81f |
linj-glitch
left a comment
There was a problem hiding this comment.
Reviewed the opt-in conversion policy, preserved reasoning effort, strict defaults, and unsupported field/part rejection against current main and the existing model-server contract. No blocking findings remain.
Validation after the final additive merge of current main: 328 focused regression tests passed; the full repository pre-commit suite and git diff --check passed. Author history is preserved. Model plugin imports were pinned to this review checkout in the shared dependency environment. No fresh GPU/model rollout was run locally; the author-provided downstream deployment evidence is retained above.
|
/ok to test 21847e1 |
linj-glitch
left a comment
There was a problem hiding this comment.
Reviewed the opt-in conversion policy, preserved reasoning effort, strict defaults, and unsupported field/part rejection against current main and the existing model-server contract. No blocking findings remain.
Validation after the final additive merge of current main: 330 focused regression tests passed; the full repository pre-commit suite and git diff --check passed. Author history is preserved. Model plugin imports were pinned to this review checkout in the shared dependency environment. No fresh GPU/model rollout was run locally; the author-provided downstream deployment evidence is retained above.
Added focused compatibility bounds for full server CI: Hugging Face Hub below2 in the dev extra, and a datasets floor confined to Aviary. These avoid the reproduced SDK/cookie transport failures and legacy tokenizer/PyArrow resolution; all locked package versions remain unchanged. Ordinary server setup also selects dev. Fresh installs across GDPVal, OpenEnv, session-state, Aviary, LangGraph, and Fabric passed640 tests with1 intentional Docker skip. Final-head focused tests, full pre-commit, uv lock --offline --check, and git diff --check passed. The full GitHub server suite remains required before merging. No separate issue is needed for these narrow CI compatibility fixes.
…ting instead of refusing the request The Responses-to-Chat-Completions conversion refuses a request that carries a field with no Chat Completions representation, so the caller can route it to a server that serves Responses natively. A model server without such a route ends the rollout over a field the backend never needed: the Codex CLI sends include and reasoning.summary on every request, and some of its tools return an image part in their output. The new VLLMModelConfig setting drop_unrepresentable_request_fields (off by default, the previous behavior) drops the fields that only select what the provider reports back rather than what the model generates, and lets the conversion proceed: include, reasoning.summary, reasoning.context, a message phase, and an image part in a tool's output, which becomes a text placeholder so the surrounding text parts keep their positions. Every other unrepresentable field, and every other reasoning field and tool-output part type, is still refused. The vLLM model-server configuration reference documents the setting. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: alexandery <[email protected]> (cherry picked from commit 4704171)
huggingface-hub 2.x installs httpx2, which Starlette's TestClient prefers over httpx when both are present; the OpenAI client's http_client and Gym's httpx cookie helpers then fail in the server test suites. The committed lock already resolves huggingface-hub to 1.33.0, so this bound only keeps a future re-resolution from crossing into 2.x. It was first carried as a commit on the branches of #3973, #3976, and #3978 while they were validated against main; review asked for it to live in its own pull request, and those branches no longer carry it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: alexandery <[email protected]>
…d neutralize the image placeholder Review follow-up on the unrepresentable-request-fields switch. reasoning.context is not reporting-only: it tells the provider which earlier reasoning items to render back to the model, which the conversion cannot honor (it renders every item and leaves the rest to the chat template), so it stays refused with any value, with the switch on or off. reasoning.generate_summary, the deprecated name of the summary selector, is dropped alongside reasoning.summary. The compaction model server converts through the same converter but ignored the switch; it now passes it through, and an endpoint test checks both settings. The image placeholder is neutral wording that does not describe the model's inputs, and its drop is logged at debug like the other drops, because the whole transcript is re-converted on every later turn. The setting's description, the converter docstring, and the vLLM server reference list the drop set exactly, say the placeholder replaces part of the prompt, and note that the setting has no effect when is_responses_native is on. Tests cover the streaming path, the interleaved image placeholder, every reasoning.context value, and the compaction server. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: alexandery <[email protected]>
b7351b4 to
4de1ca5
Compare
|
Thanks. The branch is rebased onto main f128d43 and 4de1ca5 addresses the inline threads: the compaction server honors the flag with an endpoint test, |
Signed-off-by: yaoyu-33 <[email protected]>
yaoyu-33
left a comment
There was a problem hiding this comment.
All requests in the review summary are addressed: compaction forwards the flag, reasoning.context remains refused, the description and docs explain the prompt-changing image replacement, the image drop logs at debug, tests assert the exact ordered placeholder content, and the dependency change is split into #4362. The additional neutral-placeholder, generate_summary, and streaming-test suggestions are covered too.
Merged main 124accc24d8e into the branch and resolved the test conflict by retaining both main's replayed-turn regression and this PR's include/reasoning tests. The four tests involved in the conflict are preserved unchanged.
Validation on e01134c4bb67:
- Converter, vLLM model, and compaction model test suites: 424 passed, with imports verified against the isolated review checkout.
pre-commit run --all-files: passed.git diff --check refs/conflict-fix/main HEAD: passed.
No fresh model rollout was run for this conflict-only update; the author's downstream rollout evidence remains in the PR description. Full repository CI remains required before merging.
## What does this PR do? Adds `huggingface-hub<2` to the `dev` extra. huggingface-hub 2.x installs `httpx2`, which Starlette's `TestClient` prefers over `httpx` when both are present; the OpenAI client's `http_client` and Gym's httpx cookie helpers then fail in the server test suites. The committed `uv.lock` already resolves huggingface-hub to 1.33.0, so this bound changes no installed version today; it keeps a future re-resolution from crossing into 2.x. `uv lock --check` passes. ## Why a separate PR The same bound was carried as a commit on the branches of NVIDIA-NeMo#3973, NVIDIA-NeMo#3976, and NVIDIA-NeMo#3978 while they were validated against `main` (the maintainer's "build: bound server test dependencies for SDK compatibility"). Review on those PRs asked for the dependency change to live in its own PR that the feature PRs rebase on; those branches no longer carry it. ## Tests `uv lock --offline --check` passes. No code change. ## Checklist - [x] I have read the [contributing guidelines](https://docs.nvidia.com/nemo/gym/latest/contribute/development-setup). - [x] The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs. - [x] Tests added or updated and pass locally, or N/A for docs-only / non-code changes. - [x] Pre-commit checks pass locally (`pre-commit run --all-files`). - [x] All commits have DCO sign-off (`git commit -s`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: alexandery <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
|
/ok to test ed50396 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38526350038 |
## What does this PR do? `/v1/chat/completions` now accepts image parts in a tool message, besides text. Before, a tool message's `content` was validated as text only, following the OpenAI SDK type. Every request that carried an image in a tool result failed with 422 before it reached the backend. **Why.** An agent harness may return the image a vision tool loaded inside that tool's result, so that a vision-capable main model sees it in its own context. [Hermes Agent](https://github.com/NousResearch/hermes-agent) does this with `vision_analyze` when the main model is declared vision-capable and no auxiliary vision model is configured (`tools/vision_tools.py`, its native path). Through Gym's model server, every such request failed with 422. Hermes then retried without the image (`agent/turn_recovery.py`), so the model never saw it. **Backends accept it.** - vLLM's OpenAI-compatible server parses a tool message's content parts like any other message's and collects the image for the model. Rendering it is left to the chat template (`vllm/renderers/chat_utils/chat_message.py`, `parse_chat_message_content`). - Sent directly, bypassing Gym, four OpenAI-compatible endpoints serving vision models answered a tool message whose content was a text part and an image part. Each named the image's color correctly. **Changes.** - `NeMoGymChatCompletionToolMessageParam.content` takes text and image parts (`NeMoGymChatCompletionContentPartImageParam`). Other media parts (audio, video, file) are still refused in a tool message. - `ResponsesConverter.chat_completions_messages_to_responses_items` maps a tool message's image part to a `function_call_output` `input_image` part, with the image's `detail` or `auto`. Before, it read `part["text"]` from every part and raised `KeyError` on an image part. **Not changed.** Converting a Responses `function_call_output` image to Chat Completions still refuses it, or replaces it with the placeholder under `drop_unrepresentable_request_fields` (NVIDIA-NeMo#2490, NVIDIA-NeMo#3976). Mapping it to an image part in the tool message is now possible. It would change what a Responses client such as Codex sends to a vLLM chat backend, so it is left for a separate change if wanted. No issue was filed: the change is small, and the failure and the fix are shown here end to end. Happy to open one if you prefer to discuss it there first. Proposed labels (I cannot apply labels): `feature`, `area:model`. ## Validation All runs were against the final diff on `main` 06f5f89. - New tests, each seen failing before the change: - `tests/unit_tests/test_openai_utils.py`: `test_tool_message_accepts_image_parts`, and `test_tool_message_refuses_other_media_parts` (audio, video). The latter passes before and after; it pins the scope. - `tests/unit_tests/test_responses_converter.py::test_chat_tool_image_to_responses_becomes_input_image`. It failed with `KeyError: 'text'` before the change. - `responses_api_models/vllm_model/tests/test_app.py::TestVLLMConverter::test_tool_message_image_reaches_the_backend[False|True]`. It failed with 422 before the change; it now checks that the backend receives the tool message unchanged, on the plain and the streaming path. - `pytest tests/unit_tests/test_openai_utils.py tests/unit_tests/test_responses_converter.py responses_api_models/vllm_model/tests/test_app.py`: 775 passed. - `./scripts/ci/core_unit_tests.sh`: 8,637 passed, 28 skipped. - `gym env test +entrypoint=responses_api_models/vllm_model +should_validate_data=true`: 536 passed. - `pre-commit run --all-files`: passed (the guardwords check skipped: its private catalog is unavailable outside NVIDIA's network; I reviewed the diff for internal content by hand). ## Rollouts The rollouts used Hermes Agent (`0e427d78`) with `model.supports_vision: true` and no `auxiliary.vision` backend, through `vllm_model` against an OpenAI-compatible endpoint serving a vision-language model. Each task asks the agent to read a five-digit number from a PNG in its workspace. - **Without the change:** every request with `vision_analyze`'s image in the tool message got 422. Hermes retried without the image, and the agent could not read the number. - **With the change** (applied to `79dee227`, where the tool-message type does not yet have `name`): - every request was answered (200), with the image in the tool message; - the model read the number from it in both tasks ("8-1-4-4-3", "14535"); - its answers were right, and the file it wrote held the number. ## Compatibility and benchmark impact - **Requests:** the change only widens what the endpoint accepts, so a request that validated before validates the same way. - **Breaking risk:** code that reads a tool message's parts and assumes text may meet an image part. In this repository, that was only the converter fixed here; `token_id_capture` fingerprints serialize list content as JSON. - **Behaviour:** a backend or chat template that cannot render an image in a tool message now receives one and may refuse it, where Gym refused it before. - **Benchmarks:** none of the benchmarks in this repository changes. ## Checklist - [x] I have read the [contributing guidelines](https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md). - [x] The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs. - [x] Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable). - [x] Documentation added or updated, or N/A with justification. N/A: no page documents which content parts a chat tool message accepts; the type's comment records it. - [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so CI lint/format checks pass). - [x] New source files include the required Apache-2.0 SPDX header. N/A: no new files. - [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check passes). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Patrick Plattner <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
What does this PR do?
Adds
drop_unrepresentable_request_fieldstoVLLMModelConfig(defaultfalse, today's behavior). It decides what the Responses-to-Chat-Completions conversion does with a request field that has no Chat Completions representation.Today
ResponsesConverter.responses_to_chat_completion_create_paramsrefuses such a request withNotImplementedError, so a caller can route it to a server that serves Responses natively. For a model server that has no such route, the refusal ends the rollout over a field the backend never needed. With the setting on, the reporting-only fields are dropped (logged at debug level) and the conversion proceeds:include, whatever its values; it names extra fields to report on the response object (an emptyincludeis already treated as absent onmainsince fix(responses): accept an empty include when downconverting to Chat Completions #3314);reasoning.summaryand its deprecated namereasoning.generate_summary, which ask for a summary of the reasoning on the response object;reasoning.effortstill travels asreasoning_effort;phase, which labels the message rather than changing its content.An image part in a
function_call_outputis replaced with the text placeholder[image omitted from tool output]in the tool message, so the surrounding text parts keep their positions and the conversion proceeds; this one does change the prompt the model sees, which is why the placeholder says only what happened to the tool's output. Every other unrepresentable field is still refused,reasoning.contextincluded: it tells the provider which earlier reasoning items to render back to the model, which the conversion cannot honor (it renders every reasoning item the request carries and leaves the rest to the chat template).VLLMModel.responsesandVLLMModelWithCompaction._context_compaction_chat_paramspass the setting to the converter; the setting has no effect whenis_responses_nativeis on, because that path skips the conversion. The vLLM model-server configuration reference documents it.Concrete trigger: the Codex CLI sends
include: ["reasoning.encrypted_content"]andreasoning.summaryon every request, and some of its tools return an image part in their output; each of those ended a session against a vLLM chat backend.Issue
No issue filed; the refusals were observed in training transcripts of the Codex CLI harness against a vLLM chat backend.
Validation
tests/unit_tests/test_responses_converter.py,responses_api_models/vllm_model/tests/test_app.py,responses_api_models/vllm_model_with_compaction/tests/test_app.py: 420 passed. New tests: an interleaved tool output (text, image, text) becomes the exact three-part message with the placeholder in place and the drop logged at debug; other part types are still refused; a messagephaseis refused by default and dropped when configured;includeis dropped on the plain and the streaming path;reasoning.summaryandreasoning.generate_summaryare dropped while the effort travels; everyreasoning.contextvalue is still refused; the compaction server refusesincludewith the setting off and serves the request with it on, with the exact prefix still reaching the backend.tests/unit_testsand everyresponses_api_models/*/testssuite on this branch: the only failures (opensandbox, telemetry, and the two servers that importvllm) are the same as onmainf128d43 in the same environment.ruff checkandruff format --checkon the changed files: clean.Review follow-up
Rebased onto
mainf128d43. Thehuggingface-hub<2bound that the validation merges had added to this branch lives in #4362 now.🤖 Generated with Claude Code