Skip to content

fix(inference): strip thinking for Nemotron-3 models#7485

Merged
jyaunches merged 9 commits into
mainfrom
fix/6913-nemotron-3-thinking
Jul 24, 2026
Merged

fix(inference): strip thinking for Nemotron-3 models#7485
jyaunches merged 9 commits into
mainfrom
fix/6913-nemotron-3-thinking

Conversation

@jyaunches

@jyaunches jyaunches commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

NemoClaw now removes the unsupported top-level thinking field for all nvidia/nemotron-3- models on the managed NVIDIA Build route. Previously, only Nemotron-3 Ultra received this compatibility rewrite, so reasoning-enabled Super and Nano requests failed with HTTP 400.

Related Issue

Fixes #6913

Changes

  • Expand STRIP_TOP_LEVEL_THINKING_RE from one Ultra model ID to the Nemotron-3 family.
  • Preserve top-level thinking for unrelated models, including openai/gpt-oss-120b.
  • Update the preload regression test to cover Ultra, Super, Nano, and an adjacent Nemotron family.
  • Keep the rewrite in the sandbox preload because OpenClaw creates the field and NVIDIA Build rejects it. A private non-secret request marker keeps the decision synchronized when inference set changes providers at runtime; the preload removes that marker before forwarding.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: This internal request rewrite adds no command, configuration, schema, setup step, or user action.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Issue [All Platforms][Inference] OpenClaw sends unsupported "thinking" parameter to NVIDIA Endpoints for nemotron-3-ultra — every agent request fails HTTP 400 #6913 defines the Nemotron-3 family scope. The regression test verifies affected and unaffected model boundaries.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Reviewed the provider-marker synchronization and retry behavior at PR SHA 16f81679c against base SHA 8fcd69c5. OpenClaw now refreshes the non-secret provider marker on every inference set, including a retry after a failed config write. The preload removes the marker before forwarding requests. No user command, user-managed configuration, setup step, or migration changed. Six focused suites passed 49/49 tests; git diff --check passed.
  • Agent: Codex documentation writer subagent

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable
  • Station profile/scenario: Not applicable
  • Result: Not applicable
  • Supporting evidence: Not applicable; this PR does not change scripts/prepare-dgx-station-host.sh.

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: Six focused suites passed 49/49 tests; git diff --check passed.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Julie Yaunches jyaunches@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Refined “top-level thinking” handling for Nemotron-3: it’s removed only on requests routed through the managed local inference endpoint; other routes/endpoints preserve or rewrite “thinking” as expected.
    • OpenClaw runtime configuration now propagates the selected upstream provider via an X-NemoClaw-Upstream-Provider header during provider switches and routing changes.
  • Tests

    • Expanded coverage for endpoint- and provider-dependent request transformations, including fetch and HTTP body/content-length expectations.
    • Updated OpenClaw routing/restart assertions to verify the new upstream-provider header behavior.

@jyaunches jyaunches self-assigned this Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The request sanitizer now matches the nvidia/nemotron-3- model family and removes top-level thinking only for NemoClaw-managed inference.local requests. OpenClaw runtime configuration records upstream provider markers, with updated fetch, HTTP, and provider-switch regression tests.

Changes

Inference provider marker propagation

Layer / File(s) Summary
Record upstream provider changes in OpenClaw configuration
src/lib/actions/inference-set.ts, src/lib/actions/*test.ts
Provider configuration now adds or replaces X-NemoClaw-Upstream-Provider while preserving unrelated headers; tests cover compatible endpoints, restarts, and switching back to NVIDIA Build.

Managed Nemotron request sanitization

Layer / File(s) Summary
Gate Nemotron-3 rewriting by managed route
nemoclaw-blueprint/scripts/nemotron-inference-fix.js
The sanitizer matches the Nemotron-3 family, detects inference.local with the NVIDIA provider, removes the control header, and conditionally strips top-level thinking across fetch and Node HTTP paths.

Regression coverage

Layer / File(s) Summary
Validate model, provider, host, and transport behavior
test/nemotron-inference-fix.test.ts
Tests cover Nemotron variants, managed and non-managed routes, provider overrides, marker removal, transformed payloads, and content-length behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenClaw
  participant globalThis.fetch
  participant RouteDetection
  participant patchJsonBody
  participant InferenceEndpoint
  OpenClaw->>globalThis.fetch: send chat-completions request
  globalThis.fetch->>RouteDetection: inspect host and upstream provider
  RouteDetection-->>globalThis.fetch: return managed-route status
  globalThis.fetch->>patchJsonBody: pass body and status
  patchJsonBody->>InferenceEndpoint: forward rewritten request
Loading

Suggested labels: integration: openclaw, area: sandbox, bug-fix

Suggested reviewers: ericksoa, cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address #6913 by removing top-level thinking for Nemotron-3 NVIDIA Endpoints routes and preserving unrelated models.
Out of Scope Changes check ✅ Passed The upstream-provider header plumbing supports the inference rewrite and its tests, so no unrelated scope is evident.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: stripping top-level thinking for Nemotron-3 models.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/6913-nemotron-3-thinking

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 16f8167 in the fix/6913-nemotron-3-... branch remains at 96%, unchanged from commit 892d524 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 16f8167 in the fix/6913-nemotron-3-... branch remains at 80%, unchanged from commit 361ceac in the main branch.

Show a code coverage summary of the most impacted files.
File main 361ceac fix/6913-nemotron-3-... 16f8167 +/-
src/lib/inferen...time-context.ts 93% 87% -6%
src/lib/platform.ts 89% 84% -5%
src/lib/actions...nference-set.ts 94% 94% 0%
src/lib/onboard/dashboard.ts 72% 72% 0%
src/lib/actions...eway-restart.ts 93% 95% +2%
src/lib/onboard...shboard-port.ts 90% 93% +3%
src/lib/inferen...del-registry.ts 97% 100% +3%
src/lib/domain/.../connect-env.ts 89% 97% +8%
src/lib/onboard...orward-start.ts 89% 98% +9%
src/lib/onboard...ixed-forward.ts 38% 77% +39%

Updated July 24, 2026 20:23 UTC

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions
Status: Canonical ledger: 0 blocker(s), 1 warning(s), 0 suggestion(s).

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 1 blocker · 0 warnings · 2 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported 1 more blocker, 1 fewer warning, 2 more suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: inference-routing, network-policy

1 optional E2E recommendation
  • openclaw-inference-switch
1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Remove the provider marker for URL-form Node requests

  • Location: nemoclaw-blueprint/scripts/nemotron-inference-fix.js:454
  • Category: security
  • Problem: wrapModule returns before reading or removing the provider marker when http.request or https.request receives a URL string. A URL-plus-options request can forward X-NemoClaw-Upstream-Provider outside the sandbox.
  • Impact: The private runtime provider marker can reach the upstream provider, contrary to the marker's sandbox-only contract.
  • Recommendation: Normalize URL-plus-options calls before the early return, remove X-NemoClaw-Upstream-Provider from their headers, and preserve the existing request arguments.
  • Verification: Inspect the URL-string branch in wrapModule and a stubbed http.request(url, { headers }) call to confirm the original request receives no x-nemoclaw-upstream-provider header.
  • Test coverage: Add preload tests for http.request(url, options) and https.request(url, options) that assert the forwarded headers omit X-NemoClaw-Upstream-Provider.
  • Evidence: wrapModule returns immediately when options is a string, before upstreamProviderFromHeaders or req.removeHeader runs. The added comment for UPSTREAM_PROVIDER_HEADER states that this control metadata must not leave the sandbox. Existing changed tests exercise object-form Node requests and fetch headers, not URL-plus-options Node requests.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one provider-boundary blocker. The implementation otherwise looks focused, and the 7 targeted tests pass, but the tests do not model NemoClaw's real managed routing: every supported upstream uses inference.local. As written, this silently strips thinking for matching Nemotron-3 models on custom and local backends too, outside the accepted NVIDIA Build scope.

After fixing the provider discriminator, please add regression coverage using inference.local with the actual upstream-provider marker and refresh the Documentation Writer Review receipt. Its current evidence incorrectly says local NIM/custom payloads are preserved, and its recorded head predates the reviewed commit.

Security review: secrets, dependencies, authorization, logging, cryptography, and workflow configuration pass; provider/input validation, realistic regression coverage, and overall posture remain blocking until this boundary is corrected.

Comment thread nemoclaw-blueprint/scripts/nemotron-inference-fix.js Outdated
apurvvkumaria and others added 3 commits July 24, 2026 12:17
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head c036ef8. The NVIDIA Build rewrite now follows the current runtime provider across supported inference-set switches: OpenClaw carries a non-secret provider marker, the preload consumes and removes it before forwarding, and the image-baked environment remains only the untouched-config fallback. Both switch directions and non-Build preservation are covered. Focused suites pass 41/41, test:changed passes 147/147, and CLI build/typecheck/check:diff pass. Security review: no credential, authorization, dependency, logging, cryptography, or workflow regression found.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/actions/inference-set.ts`:
- Line 910: Update the marker reconciliation in the retry/rebuild path so it
compares both registry state and the marker currently present in the loaded
OpenClaw config being patched, rather than relying only on entry.provider ===
provider. Ensure a same-provider retry restores the correct marker after a prior
config-write failure and converges registry and config to one authoritative
runtime state. Add a regression covering a failed first config write followed by
a retry for the same provider.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 15a3026d-2b08-40ba-9706-2a5ff4e06b63

📥 Commits

Reviewing files that changed from the base of the PR and between 80a2d98 and c036ef8.

📒 Files selected for processing (7)
  • nemoclaw-blueprint/scripts/nemotron-inference-fix.js
  • src/lib/actions/inference-set-compatible-provider.test.ts
  • src/lib/actions/inference-set-openclaw-gateway-restart.test.ts
  • src/lib/actions/inference-set-openclaw-run.test.ts
  • src/lib/actions/inference-set-patch-openclaw.test.ts
  • src/lib/actions/inference-set.ts
  • test/nemotron-inference-fix.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • nemoclaw-blueprint/scripts/nemotron-inference-fix.js
  • test/nemotron-inference-fix.test.ts

Comment thread src/lib/actions/inference-set.ts Outdated
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches
jyaunches merged commit c737a2c into main Jul 24, 2026
97 of 99 checks passed
@jyaunches
jyaunches deleted the fix/6913-nemotron-3-thinking branch July 24, 2026 20:38
@senthilr-nv senthilr-nv mentioned this pull request Jul 25, 2026
23 tasks
senthilr-nv added a commit that referenced this pull request Jul 25, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Adds the canonical pre-tag `## v0.0.95` release entry to
`docs/changelog/2026-07-24.mdx`, before the existing v0.0.94 entry. The
entry summarizes approved user-visible changes merged since v0.0.94 and
excludes internal-only prerequisites.

## Changes

- Adds the v0.0.95 summary and detailed bullets for gateway lifecycle,
recovery, state transfer, inference compatibility, sandbox security,
Discord policy, and E2E evidence.
- Links each user-facing theme to the most specific published
documentation.
- Records the release entry in the shared native changelog used by the
OpenClaw, Hermes, and Deep Agents guides.

Source summary:

- [#7246](#7246),
[#7228](#7228),
[#7267](#7267),
[#7489](#7489),
[#7509](#7509),
[#7351](#7351), and
[#7290](#7290) ->
`docs/changelog/2026-07-24.mdx`: Gateway authority, forward teardown and
retry, managed recovery, Hermes restart recovery, scoped uninstall, and
orphan-aware backup behavior.
- [#7344](#7344) and
[#7416](#7416) ->
`docs/changelog/2026-07-24.mdx`: Atomic SQLite restore and host download
verification.
- [#7476](#7476),
[#7347](#7347),
[#7281](#7281),
[#7485](#7485),
[#7491](#7491), and
[#7422](#7422) ->
`docs/changelog/2026-07-24.mdx`: Windows Ollama reuse, CDI fallback,
bounded OpenRouter connection setup, Nemotron-3 request compatibility,
and managed Deep Agents retry and provider-error behavior.
- [#6884](#6884),
[#7481](#7481),
[#6878](#6878),
[#7467](#7467),
[#7502](#7502),
[#7503](#7503),
[#7504](#7504), and
[#7486](#7486) ->
`docs/changelog/2026-07-24.mdx`: Trusted base-image overrides, local
rebuild images, runtime validation, config preservation, reviewed
package updates, and fewer final-image payload layers.
- [#7303](#7303) ->
`docs/changelog/2026-07-24.mdx`: Scoped Discord application-command
management.
- [#7488](#7488),
[#7465](#7465),
[#7497](#7497),
[#7464](#7464),
[#7501](#7501),
[#7494](#7494), and
[#7493](#7493) ->
`docs/changelog/2026-07-24.mdx`: Selected-test risk signals, retry
cleanup, full root-image validation, direct-main Hermes setup, executed
PR-gate evidence, nightly history, and runner wait reporting.
- [#7447](#7447) is an internal
pinned-runtime prerequisite and is intentionally excluded from canonical
supported-integration documentation.
- [#7370](#7370) adds
maintainer-only advisory reconciliation tooling and does not change
supported user behavior.
- [#7495](#7495) updates existing
documentation and does not add a new v0.0.95 behavior claim.

## Type of Change

- [ ] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [x] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates

- [ ] Tests added or updated for changed behavior
- [x] Existing tests cover changed behavior — justification:
`test/changelog-docs.test.ts` validates the dated changelog structure,
heading uniqueness, and published links.
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [ ] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [ ] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `docs-updated`
- Evidence: `docs/changelog/2026-07-24.mdx`; writing rules,
documentation style, factual release meaning, and published links
reviewed at exact head `58b02f2bf`.
- Agent: Codex documentation writer reviewer
<!-- docs-review-head-sha: 58b02f2 -->
<!-- docs-review-agents-blob-sha: 9c9b36d -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit:
- Station profile/scenario:
- Result:
- Supporting evidence:

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: `npx
vitest run test/changelog-docs.test.ts` passed 6 tests.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) — the
build passed with 0 errors and 2 Fern warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
  * Added a new v0.0.95 changelog entry above v0.0.94.
* Documented improved externally supervised gateway lifecycle ownership.
  * Improved snapshot restore reliability and SQLite state handling.
  * Tightened CLI `backup-all` behavior and host artifact verification.
* Updated Windows onboarding guidance (including Ollama service reuse
and CDI directory fallback).
* Noted inference compatibility fixes, deeper agent failure
classification, stricter base-image validation, updated Discord bot
command permissions, and refined E2E release automation evidence
handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants