Skip to content

fix(nemotron3): forward tools to parse_qwen35 for schema-aware coercion#65

Merged
hallerite merged 1 commit into
mainfrom
fix/nemotron3-forward-tools
May 26, 2026
Merged

fix(nemotron3): forward tools to parse_qwen35 for schema-aware coercion#65
hallerite merged 1 commit into
mainfrom
fix/nemotron3-forward-tools

Conversation

@hallerite
Copy link
Copy Markdown
Member

@hallerite hallerite commented May 26, 2026

Summary

Nemotron3Renderer.parse_response accepted tools but didn't forward it to parse_qwen35, with a # noqa: ARG002 — args land in a JSON object, schema not needed comment. The comment is wrong for Nemotron3's actual wire format, which is identical XML to Qwen3.5 (<tool_call><function=name><parameter=k>v</parameter>...).

Why it wasn't surfacing

Pre-fix, the no-schema branch of _coerce_arg_value did an opportunistic json.loads with a raw-text fallback, so numeric/boolean args were recovered by accident from raw <parameter=> strings. With #52's vLLM-parity refactor in flight (no schema → verbatim string, matching vLLM's extract_types_from_schema(None) → ["string"]), every Nemotron3 tool-call arg would silently become a string. Cursor Bugbot flagged this on #52.

The fix

One line: drop the # noqa, add tools=tools to the parse_qwen35 call. That routes Nemotron3 through the same schema-aware coercion the other five XML renderers (Qwen3.5/3.6, GLM-4.5/5, MiniMax-M2, Laguna-XS.2) already use — which is what vLLM does for the same wire format via its shared qwen3_coder parser (vLLM has no Nemotron-specific tool parser).

Test plan

  • Extends tests/test_tool_arg_type_preservation.py to include Nemotron-3-Nano alongside the four existing XML renderers — same string-vs-coerced-type matrix.
  • pytest tests/test_tool_arg_type_preservation.py tests/test_roundtrip.py — 141 passed, 2 skipped.

Note

Low Risk
Single-line wiring change in response parsing plus an extended parametrized test; no auth, data, or API surface changes.

Overview
Nemotron 3 tool-call parsing now passes the caller’s tools schema into parse_qwen35, matching the other XML renderers on the same wire format instead of leaving tools unused.

That enables schema-aware argument coercion for <parameter> values (e.g. keeping declared string args verbatim when they look like JSON booleans/numbers). Coverage adds NVIDIA Nemotron-3-Nano to the shared test_tool_arg_type_preservation matrix.

Reviewed by Cursor Bugbot for commit 092c204. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix Nemotron3Renderer.parse_response to forward tools to parse_qwen35 for schema-aware coercion

  • Passes the tools argument through to parse_qwen35 in nemotron3.py, enabling schema-aware type coercion of tool call arguments.
  • Adds nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 to the tool argument type preservation test suite in test_tool_arg_type_preservation.py.

Macroscope summarized 092c204.

Nemotron3 uses the same XML-style wire format as Qwen3.5
(<tool_call><function=name><parameter=k>v</parameter>...), so values
arrive as raw strings between the tags. ``parse_response`` accepted
``tools`` but didn't forward it, with a ``# noqa: ARG002`` claiming
"args land in a JSON object, schema not needed" — which is incorrect
for the actual XML wire format.

Pre-fix, the no-schema branch of ``_coerce_arg_value`` did an
opportunistic ``json.loads`` with a raw-text fallback, so numeric and
boolean args were recovered by accident. With #52's vLLM-parity
refactor in flight (no schema → verbatim string, matching vLLM's
``extract_types_from_schema(None) → ["string"]``), every Nemotron3
tool-call arg would silently become a string.

Forwarding ``tools`` routes Nemotron3 through the same schema-aware
ladder the other five XML renderers (Qwen3.5/3.6, GLM-4.5/5,
MiniMax-M2, Laguna-XS.2) already use — which is what vLLM does for
the same wire format via its shared ``qwen3_coder`` parser.

Test plan: extends ``tests/test_tool_arg_type_preservation.py`` to
include Nemotron-3-Nano, exercising the same string-vs-coerced-type
matrix as the other XML renderers. All 141 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented May 26, 2026

Approvability

Verdict: Approved

This is a small bug fix forwarding a previously-ignored tools parameter to enable schema-aware type coercion for the Nemotron3 renderer, matching existing behavior in other XML-style renderers. The change is minimal, low-risk, and includes test coverage.

You can customize Macroscope's approvability policy. Learn more.

@hallerite hallerite merged commit 88aa42d into main May 26, 2026
11 checks passed
@hallerite hallerite deleted the fix/nemotron3-forward-tools branch May 26, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant