Skip to content

fix(openai_model): normalize provider reasoning text discriminators - #5138

Merged
weijiac0619 merged 2 commits into
NVIDIA-NeMo:mainfrom
RyaliNvidia:codex/g2-provider-reasoning-content
Oct 30, 2026
Merged

weijiac0619 merged 2 commits into
NVIDIA-NeMo:mainfrom
RyaliNvidia:codex/g2-provider-reasoning-content

Conversation

@RyaliNvidia

@RyaliNvidia RyaliNvidia commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Responses-compatible providers can return a reasoning item's content with an output_text discriminator, which Gym's strict response schema rejects because it requires reasoning_text. Correct that narrow shape in openai_model immediately after receiving provider JSON and before response validation.

Only a dictionary reasoning content part with string text, exactly the type/text keys and optionally empty annotations: [] is corrected. Copy only changed containers and preserve text, ciphertext, usage, metadata and item order without mutating the provider response. Unknown fields, malformed values and invalid summaries still reach strict validation unchanged. Requests and continuation replay are unchanged.

Related merged #3413 handles provider normalization in litellm_model; this focused change handles the same discriminator mismatch at the openai_model response boundary. No separate issue is needed for this reproducible compatibility bug.

Validation

  • gym env test +entrypoint=responses_api_models/openai_model +should_validate_data=true — 128 passed, including the new regression suite, in the server's isolated environment.
  • Independent verification: complete model suite 128 passed; OpenAI-utils, streaming and Messages suites 549 passed; base model suite 93 passed.
  • Disabling normalization makes all four provider-ingress regressions fail. A separate 756-case boundary matrix confirmed exact shape eligibility and provider-input preservation.
  • pre-commit run --all-files, focused Ruff/format checks and git diff --check — passed. The guardwords hook skipped its private scan because its catalog was unavailable.
  • cd fern && npm run check — passed with zero errors; its redirect-history check was skipped without Fern authentication. Scoped hooks passed after the documentation update.
  • Python 3.13.14 and pinned OpenAI 2.44.0; imports verified to resolve this checkout. Independent verifier and simplifier reviews found no defects or worthwhile simplifications.

Rollouts and compatibility

Live model rollout: N/A for this response-transport correction. Deterministic provider-response tests cover accepted and rejected shapes; no model-quality or benchmark improvement is claimed. Full core, sandbox and all-server suites were not run for this server-only change.

No schema, dependency, retry or configuration change. Ordinary messages, valid reasoning content, Chat Completions, embeddings and outbound requests retain their behavior. The existing Fern OpenAI model page documents the supported normalization. Fixtures are synthetic and new source carries Apache-2.0 SPDX headers. Both commits include DCO sign-off.

Proposed maintainer labels: bug, area:model, needs-review.

@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 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.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Oct 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:model Model servers, inference providers, and model adapters bug Something isn't working labels Oct 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Oct 27, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 28, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 29, 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.

LGTM. The normalization is narrowly scoped and preserves strict validation; 36 focused tests passed. Full CI is still required.

@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Oct 30, 2026
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 30, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Oct 30, 2026
@weijiac0619

Copy link
Copy Markdown
Contributor

/ok to test b2fa138

@nemo-automation-bot nemo-automation-bot Bot removed the community-request Issue reported or requested by someone from the community label Oct 30, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 30, 2026 18:52
@github-actions

Copy link
Copy Markdown
Contributor

@weijiac0619
weijiac0619 added this pull request to the merge queue Oct 30, 2026
@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/41121333193

@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/41124377288

@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/41124466753

@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/41129252459

@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/41130477492

Merged via the queue into NVIDIA-NeMo:main with commit 221b0ee Oct 30, 2026
51 of 54 checks passed

This branch was previously deployed

1 inactive deployment
public — b2fa1382 Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8769
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 bug Something isn't working ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants