Describe the bug
When the policy model is an endpoint that executes tools server-side via hosted MCP — e.g. NVIDIA-hosted openai/gpt-oss-120b on integrate.api.nvidia.com — the Responses API returns output items of type: "mcp_call" (and may return mcp_list_tools / mcp_approval_request). These are valid OpenAI Responses output-item types, but they are absent from the NeMoGymResponse output-item union in nemo_gym/openai_utils.py. As a result NeMoGymResponse.model_validate(...) in responses_api_models/openai_model/app.py raises a ValidationError, the model server returns HTTP 500, and since ng_collect_rollouts aborts on the first /run 500, a single such response kills the entire rollout collection.
Steps/Code to reproduce bug
from nemo_gym.openai_utils import NeMoGymResponse
NeMoGymResponse.model_validate({
"id": "r", "created_at": 0.0, "model": "gpt-oss-120b", "object": "response",
"parallel_tool_calls": True, "tool_choice": "auto", "tools": [],
"output": [{
"type": "mcp_call", "id": "m", "name": "python", "server_label": "exec",
"arguments": "{}", "output": "42", "status": "completed",
}],
})
pydantic_core.ValidationError: 42 validation errors for NeMoGymResponse
Input should be 'message'/'function_call'/'reasoning'/... [input_value='mcp_call']
End-to-end: serve openai_model against openai/gpt-oss-120b with a function tool available and run ng_collect_rollouts. When the model routes through its built-in server-side python tool it emits an mcp_call, the model server 500s, and the collection aborts.
Expected behavior
Hosted-MCP output items should validate and pass through so the rollout completes (the agent already stops when no function_call is present, and a server-executed mcp_call already carries its output).
Configs
openai_model policy pointed at https://integrate.api.nvidia.com/v1, model openai/gpt-oss-120b, with a function tool attached to the request.
Environment details
- OS: Linux
- Python: 3.12
- openai==2.7.2 (defines McpCall / McpListTools / McpApprovalRequest in openai.types.responses.response_output_item)
Additional context
A related quirk on the same endpoint: it 500s with KeyError 'content' when its own content-less reasoning items are echoed back across tool-use turns. Fix for both is in the linked PR (adds the hosted-MCP items to the response schema; adds an opt-in drop_input_reasoning_items).
Describe the bug
When the policy model is an endpoint that executes tools server-side via hosted MCP — e.g. NVIDIA-hosted openai/gpt-oss-120b on integrate.api.nvidia.com — the Responses API returns output items of type: "mcp_call" (and may return mcp_list_tools / mcp_approval_request). These are valid OpenAI Responses output-item types, but they are absent from the NeMoGymResponse output-item union in nemo_gym/openai_utils.py. As a result NeMoGymResponse.model_validate(...) in responses_api_models/openai_model/app.py raises a ValidationError, the model server returns HTTP 500, and since ng_collect_rollouts aborts on the first /run 500, a single such response kills the entire rollout collection.
Steps/Code to reproduce bug
from nemo_gym.openai_utils import NeMoGymResponse
NeMoGymResponse.model_validate({
"id": "r", "created_at": 0.0, "model": "gpt-oss-120b", "object": "response",
"parallel_tool_calls": True, "tool_choice": "auto", "tools": [],
"output": [{
"type": "mcp_call", "id": "m", "name": "python", "server_label": "exec",
"arguments": "{}", "output": "42", "status": "completed",
}],
})
pydantic_core.ValidationError: 42 validation errors for NeMoGymResponse
Input should be 'message'/'function_call'/'reasoning'/... [input_value='mcp_call']
End-to-end: serve openai_model against openai/gpt-oss-120b with a function tool available and run ng_collect_rollouts. When the model routes through its built-in server-side python tool it emits an mcp_call, the model server 500s, and the collection aborts.
Expected behavior
Hosted-MCP output items should validate and pass through so the rollout completes (the agent already stops when no function_call is present, and a server-executed mcp_call already carries its output).
Configs
openai_model policy pointed at https://integrate.api.nvidia.com/v1, model openai/gpt-oss-120b, with a function tool attached to the request.
Environment details
Additional context
A related quirk on the same endpoint: it 500s with KeyError 'content' when its own content-less reasoning items are echoed back across tool-use turns. Fix for both is in the linked PR (adds the hosted-MCP items to the response schema; adds an opt-in drop_input_reasoning_items).