Skip to content

[NVBug 6758022] Verify chat_template_kwargs 422 fix on main and close bug #4493

Closed

Description

@qiaochuz-nv

Queue rank 6/48 · Difficulty 1/5 · Status on main: fixed

NVBug: https://nvbugspro.nvidia.com/bug/6758022 · NVBug priority: Unprioritized · ARB: Ananth Subramaniam
GitHub: #3682 (merged 2026-09-30)

Summary

The shipped Hermes Reasoning Gym example failed every first model request with HTTP 422 because hermes_agent sends chat_template_kwargs (enable_thinking) in extra_body, which the OpenAI SDK flattens to a top-level body field, and Gym's strict chat request schema (extra="forbid") had no such field. This is now fixed on main: the schema accepts the field and openai_model forwards it. The work is to verify on main and close the NVBug.

Reproduction

At observed commit 86e2252 (2026-09-10): run testcases/environments/hermes_reasoning_gym.py via ./run.sh test hermes_reasoning_gym on an H100; all five examples return response.status=failed, server_error, HTTP 422 extra_forbidden at body.chat_template_kwargs.

Root cause

At 86e2252, NeMoGymChatCompletionCreateParamsNonStreaming (openai_utils.py:1030) used extra="forbid" with no chat_template_kwargs field, so FastAPI's body validation rejected the request before it reached vLLM. hermes_agent defaults chat_template_kwargs_enabled=True, so the field ships on every call.

Status on main (fixed)

Merged PR #3682 (commit 3c85cc8, 2026-09-30, after the bug's 86e2252) resolves it. On current HEAD 75bb53e:

  • nemo_gym/openai_utils.py:1412 adds CHAT_REQUEST_PROVIDER_EXTENSION_FIELDS = frozenset({"chat_template_kwargs", "thinking", "output_config"}); line 1464 adds chat_template_kwargs: Optional[Dict[str, Any]] = None to the strict model (still rejects other unknown keys).
  • responses_api_models/openai_model/app.py:357 forwards it: self.config.extra_body | body.model_dump(exclude_unset=True).
  • hermes_agent still sends it by default (app.py:244), so the fixed path is exercised.
  • Test tests/unit_tests/test_openai_utils.py:1165 (test_provider_extension_fields_pass_strict_schema) asserts acceptance + preservation and that non-mapping values still 422.

Proposed fix

None needed in Gym; fix already merged. Action: pull current main, confirm PR #3682 present, re-run the QA E2E gate, then close NVBug 6758022. SeeAlso 6751030 is a distinct reasoning_content-replay issue — do not close on this.

Validation

Re-run testcases/environments/hermes_reasoning_gym.py (the "no model error" gate) on H100 with Qwen/Qwen3-8B via the README openai_model topology; confirm all five rows have response.error=None, nonzero output tokens, and reward in [0,1]. Also re-run sibling testcases/environments/hermes_math.py. Note the E2E gate may still surface the distinct SeeAlso 6751030 reasoning_content-replay path separately, so a passing "no model error" gate confirms only this schema fix.

Triage

Difficulty 1/5 — already fixed on main by merged PR #3682; work is verify-and-close. Needs GPU/model: yes (QA E2E rerun only). External dependency: none.

Reviewer notes

Verifier independently confirmed fixed: #3682 (3c85cc8, merged 2026-09-30) is reachable from HEAD and not an ancestor of the bug commit 86e2252; the frozenset and field are present and the unit test asserts acceptance plus 422 for non-mapping values. Difficulty 1 (verify-and-close) holds. Added a note that the E2E gate may still surface the separate 6751030 replay path; QA names are accurate. No facts corrected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions