Skip to content

feat(model): optionally omit unsupported Responses fields - #3976

Merged
alexandery-nvidia merged 4 commits into
mainfrom
alexandery/converter-drop-unrepresentable-request-fields
Oct 14, 2026
Merged

alexandery-nvidia merged 4 commits into
mainfrom
alexandery/converter-drop-unrepresentable-request-fields

Conversation

@alexandery-nvidia

@alexandery-nvidia alexandery-nvidia commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds drop_unrepresentable_request_fields to VLLMModelConfig (default false, 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_params refuses such a request with NotImplementedError, 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:

  • a non-empty include, whatever its values; it names extra fields to report on the response object (an empty include is already treated as absent on main since fix(responses): accept an empty include when downconverting to Chat Completions #3314);
  • reasoning.summary and its deprecated name reasoning.generate_summary, which ask for a summary of the reasoning on the response object; reasoning.effort still travels as reasoning_effort;
  • a message phase, which labels the message rather than changing its content.

An image part in a function_call_output is 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.context included: 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.responses and VLLMModelWithCompaction._context_compaction_chat_params pass the setting to the converter; the setting has no effect when is_responses_native is 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"] and reasoning.summary on 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 message phase is refused by default and dropped when configured; include is dropped on the plain and the streaming path; reasoning.summary and reasoning.generate_summary are dropped while the effort travels; every reasoning.context value is still refused; the compaction server refuses include with the setting off and serves the request with it on, with the exact prefix still reaching the backend.
  • Full tests/unit_tests and every responses_api_models/*/tests suite on this branch: the only failures (opensandbox, telemetry, and the two servers that import vllm) are the same as on main f128d43 in the same environment.
  • ruff check and ruff format --check on the changed files: clean.
  • Rollout evidence: this setting has run for weeks in a downstream fork training with the OpenCode and Codex harnesses through this model server; with it on, no Codex session ends on one of these fields.

Review follow-up

Rebased onto main f128d43. The huggingface-hub<2 bound that the validation merges had added to this branch lives in #4362 now.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Oct 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@linj-glitch linj-glitch changed the title feat(model): drop the Responses request fields that only select reporting instead of refusing the request feat(model): optionally omit unsupported Responses fields Oct 5, 2026
@linj-glitch linj-glitch added area:model Model servers, inference providers, and model adapters feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge labels Oct 5, 2026
@linj-glitch
linj-glitch marked this pull request as ready for review October 5, 2026 07:50
linj-glitch
linj-glitch previously approved these changes Oct 5, 2026

@linj-glitch linj-glitch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@linj-glitch

Copy link
Copy Markdown
Collaborator

/ok to test dc6e81f

@linj-glitch
linj-glitch enabled auto-merge October 5, 2026 07:50
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 5, 2026 07:50
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

@linj-glitch
linj-glitch added this pull request to the merge queue Oct 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 5, 2026
@yaoyu-33 yaoyu-33 added the complexity:medium Single-domain change with interacting parts or a moderate review surface label Oct 5, 2026
linj-glitch
linj-glitch previously approved these changes Oct 5, 2026

@linj-glitch linj-glitch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@linj-glitch

Copy link
Copy Markdown
Collaborator

/ok to test 21847e1

linj-glitch
linj-glitch previously approved these changes Oct 5, 2026

@linj-glitch linj-glitch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@zyzhou5 zyzhou5 added waiting-on-customer Waiting on the original author to respond and removed ready-to-merge PR is approved, current, and waiting for final CI or merge labels Oct 8, 2026
…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)
alexandery-nvidia added a commit that referenced this pull request Oct 10, 2026
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]>
@alexandery-nvidia
alexandery-nvidia force-pushed the alexandery/converter-drop-unrepresentable-request-fields branch from b7351b4 to 4de1ca5 Compare October 10, 2026 03:27
@alexandery-nvidia

Copy link
Copy Markdown
Contributor Author

Thanks. The branch is rebased onto main f128d43 and 4de1ca5 addresses the inline threads: the compaction server honors the flag with an endpoint test, reasoning.context is refused with any value, the image drop logs at debug with neutral placeholder wording, the description, docstring, and docs row list the drop set exactly, the image test is interleaved, and the dependency bound is #4362. The description is rewritten to match.

@yaoyu-33 yaoyu-33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

khazic pushed a commit to khazic/Gym-lao that referenced this pull request Oct 13, 2026
## 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]>
@alexandery-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test ed50396

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38526350038

Merged via the queue into main with commit 4fbffa1 Oct 14, 2026
51 of 53 checks passed
@alexandery-nvidia
alexandery-nvidia deleted the alexandery/converter-drop-unrepresentable-request-fields branch October 14, 2026 07:21
aroshanghias-nvd pushed a commit to aroshanghias-nvd/Gym that referenced this pull request Oct 16, 2026
## 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]>

This branch was previously deployed

1 inactive deployment
public — ed50396f Deployed Oct 14, 2026 by copy-pr-bot[bot] via release / finalize / notify #5269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:model Model servers, inference providers, and model adapters complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work waiting-on-customer Waiting on the original author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants