Skip to content

fix(openai_model): preserve carrier custom tools on Responses - #6956

Open
RyaliNvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
RyaliNvidia:codex/preserve-responses-carrier-tools
Open

RyaliNvidia wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
RyaliNvidia:codex/preserve-responses-carrier-tools

Conversation

@RyaliNvidia

Copy link
Copy Markdown
Contributor

What does this PR do?

Keep free-form custom tools carried in additional_tools items when the OpenAI model server handles /v1/responses. Codex code mode advertises functions.exec this way; the default sanitizer currently removes that declaration, so the backend loses the tool even though it supports the Responses custom-tool format.

Reuse the shared sanitizer with carrier custom-tool hoisting enabled for this model server. Preserve namespace restoration and replay, and honor drop_custom_tools and drop_hosted_tools. Export the two existing sanitizer types/helpers through the models package API for the component import. Document the behavior in the component README.

Related: #4880 established the shared sanitizer and Chat function bridge. This change handles the Responses backend without requiring that bridge. No separate issue: this is a focused reproduced protocol-compatibility bug with an HTTP regression.

Validation

Base: 228a16b96df8f925220a7edbff2d7d22317c78fb. Python 3.13.14, uv 0.13.4, frozen root environment with dev and telemetry extras.

uv sync --python 3.13.14 --extra dev --extra telemetry --frozen
.venv/bin/python -m pytest responses_api_models/openai_model/tests tests/unit_tests/models/test_responses_api_model_streaming.py tests/unit_tests/models/test_custom_tool_function_bridge.py tests/unit_tests/test_public_api_facades.py -q -o addopts='' --tb=short
.venv/bin/python -m pytest responses_api_models/openai_model/tests/test_app.py -k TestRefusedProviderConnection -q -o addopts='' --tb=short
.venv/bin/python -m pytest responses_api_models/openai_model/tests/test_app.py -k code_mode -q -o addopts='' --tb=short
pre-commit run --all-files
git diff --check
  • Selected suite: 1,530 passed, with four loopback connection-refusal tests denied socket access by the execution sandbox. Rerunning those four with local socket access: 4 passed. All 1,534 selected tests therefore passed across those runs.
  • Final focused regression: 4 passed. With the model-server implementation restored to the base revision, two cases fail because custom carrier tools disappear; two explicit-drop cases retain their expected behavior.
  • All available pre-commit hooks passed, including package layering and Ruff. The private guardwords catalog was unavailable, so that hook skipped its content scan. Whitespace checks passed.
  • CI classification: full, because the diff exports existing names from nemo_gym/models/__init__.py. The complete core/sandbox/server matrix is left to trusted CI.

Rollouts

N/A for this focused model-server protocol regression: tests exercise HTTP requests, provider-facing definitions, SSE namespace restoration and the next request containing the tool result, with a deterministic provider response. No live Codex/model rollout, container build or remote-sandbox qualification was performed or is claimed.

Compatibility and benchmark impact

Requests containing carrier custom tools now forward those declarations to Responses backends. Explicit tool-drop policies remain effective. No dependency, configuration key, Chat conversion policy or benchmark protocol changes. Runs that previously lost these tools can now use them; this is a capability repair, not evidence of a benchmark-score improvement.

Checklist

  • I have read the contributing guidelines.
  • The change is focused.
  • Regression tests added and applicable local suites pass as detailed above.
  • Component documentation updated.
  • Complete pre-commit content scanning: available hooks passed; private guardwords catalog unavailable.
  • Existing source license headers preserved; no new source files.
  • Commit includes DCO sign-off.

Signed-off-by: RyaliNvidia <ryali@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 30, 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.

@RyaliNvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 9938078

@RyaliNvidia RyaliNvidia added area:model Model servers, inference providers, and model adapters bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Nov 30, 2026
@nemo-pr-automation
nemo-pr-automation Bot requested a review from a team November 30, 2026 17:05
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 30, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP. LGTM, no concerns found.

I reviewed all four changed files and traced the shared sanitizer, Responses dispatch, namespace restoration and replay paths. Three delegated reviews covered request handling, response/replay behavior, and tests/API/docs. No BLOCKER, RISK or NOTE findings survived review.

Validation

I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:228a16b96df8f925220a7edbff2d7d22317c78fb, the base branch's successful CI image, because this head had no successful container build. Python was 3.13.14. Probe imports were verified against the admitted checkouts.

  • python /workspace/review-probes/leader/http_probe.py /workspace/review/source passed all four custom/hosted drop-policy combinations through a real loopback HTTP provider. Grammar definitions, multiple carriers, SSE output items and Unicode tool-result replay survived.
  • Delegated request and replay probes passed on head. They covered mixed function/custom tools, distinct namespaces, completed/incomplete/failed responses and next-turn call identity. The public-export probe also passed.
  • The four added regression cases run against base produced 2 expected failures and 2 passes: the failures reproduced the missing carrier custom tools. Existing green head suites were not rerun locally.

For the admitted head, CI run 46469139376 shows Nemo_CICD_Test, all four core shards, all eight server shards, sandbox tests and combined core coverage passing. Lint and DCO passed. Changed server tests and Session routing end-to-end were skipped, not passed.

The optional miniswe_sandboxed conformance job is red after its five-minute step timeout. That check also failed on base, but with a different reported failure, so I have not attributed the timeout to an existing cause. Conformance does not feed the Nemo_CICD_Test aggregate.

No live Codex/OpenAI rollout or GPU execution was performed. The probes verify Gym's protocol handling, not external-provider execution.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

This branch has not been deployed

No deployments
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 needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants