Skip to content

fix(responses): accept an empty include when downconverting to Chat Completions - #3314

Merged
ananthsub merged 2 commits into
NVIDIA-NeMo:mainfrom
jiwasawa:jiwasawa/responses-include-downconvert
Oct 8, 2026
Merged

ananthsub merged 2 commits into
NVIDIA-NeMo:mainfrom
jiwasawa:jiwasawa/responses-include-downconvert

Conversation

@jiwasawa

@jiwasawa jiwasawa commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Closes #3312

ResponsesConverter.responses_to_chat_completion_create_params rejected any request carrying the include key.
The Codex CLI sends include on every request ([] or ["reasoning.encrypted_content"]), so it could not make a single call through a chat-backed model server (vllm_model, azure_openai_model, inference_provider).

include only widens the response shape; it does not change what the model is asked.
Codex sends include=[] against a Gym model server, so the converter now treats an
empty list as absent. Non-empty values still raise NotImplementedError, because the
converter does not produce reasoning.encrypted_content or message.output_text.logprobs
and returning a response without them would hide a lossy conversion.

The fix lives in the converter rather than sanitize_streaming_responses_body, which also serves the passthrough servers (openai_model, litellm_model) that forward include to providers honouring it.

Tests

uv run pytest tests/unit_tests/test_responses_converter.py -q   # 134 passed

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Sep 11, 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.

@yaoyu-33 yaoyu-33 added area:core Shared APIs, servers, telemetry, health, and registries bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Sep 11, 2026
Comment thread nemo_gym/responses_converter.py Resolved
@yaoyu-33 yaoyu-33 added waiting-on-customer Waiting on the original author to respond and removed needs-review PR is ready for code review and waiting on a reviewer labels Sep 11, 2026
@jiwasawa jiwasawa changed the title fix(responses): ignore include when downconverting to Chat Completions fix(responses): accept an empty include when downconverting to Chat Completions Sep 14, 2026
@jiwasawa
jiwasawa requested a review from ananthsub September 15, 2026 03:38
@yaoyu-33 yaoyu-33 added the complexity:low Localized change in one scope with a small, straightforward review surface label Sep 15, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Sep 16, 2026

@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.

Re-reviewed 481137a: only include=[] is treated as absent; nonempty include still fails explicitly. The original request and streaming passthrough are preserved. The earlier inline concern is addressed. 597 related tests and focused include-contract probes passed locally with openai==2.44.0; full CI was not run.

@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed waiting-on-customer Waiting on the original author to respond labels Oct 8, 2026
@zyzhou5 zyzhou5 added waiting-on-maintainers Waiting on maintainers to respond and removed ready-to-merge PR is approved, current, and waiting for final CI or merge labels Oct 8, 2026
@zyzhou5

zyzhou5 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

/ok to test 481137a

@ananthsub
ananthsub force-pushed the jiwasawa/responses-include-downconvert branch from 481137a to 921874f Compare October 8, 2026 21:09
@ananthsub

Copy link
Copy Markdown
Contributor

/ok to test 921874f

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 8, 2026 21:10
@ananthsub
ananthsub enabled auto-merge October 8, 2026 21:10
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Oct 8, 2026
Merged via the queue into NVIDIA-NeMo:main with commit e8aec2a Oct 8, 2026
46 of 50 checks passed
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Oct 14, 2026
…o#3976)

## 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 NVIDIA-NeMo#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 NVIDIA-NeMo#4362 now.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: alexandery <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: yaoyu-33 <[email protected]>
@jiwasawa
jiwasawa deleted the jiwasawa/responses-include-downconvert branch October 28, 2026 03:03

This branch was previously deployed

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

Labels

area:core Shared APIs, servers, telemetry, health, and registries bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(responses): downconverter rejects include on presence, so Codex CLI cannot call any chat-backed model server

4 participants