Skip to content

fix(inference): request a reply budget hosted endpoints accept - #7954

Merged
cv merged 4 commits into
mainfrom
fix/7939-probe-reply-budget-minimum
Aug 4, 2026
Merged

fix(inference): request a reply budget hosted endpoints accept#7954
cv merged 4 commits into
mainfrom
fix/7939-probe-reply-budget-minimum

Conversation

@nvshaxie

@nvshaxie nvshaxie commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Inference probes hard-coded a bounded reply budget of 8 tokens. That budget is a value the endpoint validates, not just a ceiling NemoClaw applies, so hosted endpoints that enforce a higher floor rejected the probe with HTTP 400 even though model discovery succeeded and normal inference worked. A valid endpoint, model, and credential combination therefore failed onboarding, health, and rebuild preflight. The probes now share one minimum reply budget of 16 and stay tightly bounded.

Related Issue

Refs: #7939

Changes

  • Add MIN_PROBE_REPLY_TOKENS (16) to src/lib/inference/max-tokens-field.ts, the module both probe builders already share for reply-budget decisions.
  • Use it for the Chat Completions probe payload and its Kimi K2.6 branch (openai-probe-models.ts), the provider health probe (health.ts), and all three rebuild-preflight routes — Chat Completions, Responses, and Anthropic Messages (rebuild-inference-preflight.ts).
  • Cover every preflight route and both Chat Completions budget fields with regression tests, so this cannot regress into the gpt-5.4 on a custom OpenAI-compatible provider fails: chat/completions rejects max_tokens (needs max_completion_tokens) #6642 field-name contract.

This is a direct value change. It adds no configuration, fallback, compatibility, or extension surface: the floor is one shared constant with three consumers, protected by the tests above. The value matches the floor the Anthropic Messages probe (probe-anthropic.ts) already used, so it introduces no new number to the codebase. The DeepSeek V4 Pro branch keeps its larger 8192 validation budget.

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: no command, flag, JSON field, text output, exit behavior, or configuration surface changes. docs/inference/choose-compatible-inference-api.mdx documents the reply-budget field name selection (gpt-5.4 on a custom OpenAI-compatible provider fails: chat/completions rejects max_tokens (needs max_completion_tokens) #6642), which is unchanged, and docs/inference/configure-model-limits.mdx documents user-configured sandbox model limits, which are a separate concept from this internal probe budget. No page states the probe budget value.
  • 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: Independent Codex Desktop security review completed for 56f8dadb4. All nine categories passed with no findings: secrets and credentials; input validation and data sanitization; authentication and authorization; dependencies and third-party libraries; error handling and logging; cryptography and data protection; configuration and security headers; security testing; and system security. The change keeps credentials out of commands and output, preserves response redaction and SSRF controls, and keeps the probe bounded at 16 tokens.
  • 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: Internal onboarding, inference-health, and rebuild probes now request 16 reply tokens instead of 8. Existing docs do not specify this implementation value; commands, configuration, output text, and operator procedures are unchanged. Reviewed all changed comments and test titles.
  • Agent: Codex Desktop

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub — all four PR commits, including the two maintainer refresh commits through 56f8dadb4, are verified.
  • Normal pre-commit, commit-msg, and pre-push hooks passed. The refreshed pre-push hook completed during publication of 56f8dadb4.
  • Targeted behavior tests passed for contributor commit 30904bc49 after npm run build:cli:
    • npx vitest run --project cli src/lib/inference/onboard-probes.test.ts src/lib/inference/health.test.ts src/lib/actions/sandbox/rebuild-inference-preflight.test.ts → 3 files, 85 passed
    • npx vitest run --project e2e-support → 172 files, 1840 passed, 17 skipped
    • npm run typecheck:cli → clean
    • Negative check: reverting MIN_PROBE_REPLY_TOKENS to 8 fails all five new (#7939) cases, so the added tests genuinely pin the fixed behavior.
  • GitHub CI passes for refreshed commit 56f8dadb4 — pending publication.
  • Applicable broad gate passed — not applicable; this is a scoped inference change, not a runtime/test-harness or repo-wide validation change.
  • 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)

Verification boundary

I could not reproduce the reporter's live HTTP 400 end to end: this host has no OpenShell sandbox, and the failing endpoint is an NVIDIA hosted route the report deliberately does not name. The fix is verified against the source contract the report cites — all three quoted call sites, plus the Responses and Anthropic routes the report did not enumerate — and by mock-level regression tests. Live confirmation on the reporter's endpoint with openai/openai/gpt-5.6-sol is still worth having before this is treated as field-proven.

Unrelated observation: src/lib/inference/nim.test.ts > detectGpu > returns object or null fails locally with a 5s test timeout because nvidia-smi takes ~10s on this multi-A100 host. It fails nondeterministically on unmodified main too and shares no import path with these files.


Signed-off-by: Shawn Xie shaxie@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved inference health checks and preflight validation by consistently allocating a minimum 16-token reply budget.
    • Updated support for multiple request formats, including Responses API, chat completions, and Anthropic requests.
    • Improved probe reliability across supported model families, including reasoning and streaming models.
  • Tests

    • Added coverage to verify token-budget fields and minimum values across inference routes and model types.

Inference probes hard-coded a bounded reply budget of 8 tokens in
onboarding, health, and rebuild-preflight payloads. The budget is a value
the endpoint validates, not just a ceiling NemoClaw applies, and some
supported hosted endpoints reject a budget below 16 with HTTP 400 even
when model discovery succeeds and normal inference works. A valid
endpoint, model, and credential combination therefore failed onboarding
and rebuild health checks.

Share one minimum reply budget of 16 across the probes that carried the
literal 8, matching the floor the Anthropic Messages probe already used.
The probes stay tightly bounded and no field-name selection changes, so
this does not regress the GPT-5 max_completion_tokens contract.

Refs: #7939

Signed-off-by: Shawn Xie <shaxie@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Probe requests now use a shared minimum reply budget of 16 tokens across OpenAI, Anthropic, Responses, chat-completions, and streaming formats. Tests update expected payloads and validate route-specific token fields across supported models.

Changes

Inference probe budget

Layer / File(s) Summary
Shared budget contract
src/lib/inference/max-tokens-field.ts, src/lib/inference/openai-probe-models.ts
Exports MIN_PROBE_REPLY_TOKENS = 16 and applies it to default and Kimi probe payloads.
Probe payload wiring
src/lib/inference/health.ts, src/lib/actions/sandbox/rebuild-inference-preflight.ts
Uses the shared minimum for health and sandbox preflight requests across supported route formats.
Budget validation
src/lib/inference/*.test.ts, src/lib/actions/sandbox/rebuild-inference-preflight.test.ts
Updates expected budgets to 16 and adds cross-route and cross-model minimum-budget assertions.

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

Possibly related PRs

  • NVIDIA/NemoClaw#5400: Modifies onboarding and inference probe payload token budgets and related tests.

Suggested labels: area: onboarding

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the inference fix to request a reply budget accepted by hosted endpoints.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/7939-probe-reply-budget-minimum

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

@github-code-quality

github-code-quality Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 56f8dad in the fix/7939-probe-reply... branch remains at 96%, unchanged from commit b724932 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 56f8dad in the fix/7939-probe-reply... branch remains at 81%, unchanged from commit 643a4ab in the main branch.

Show a code coverage summary of the most impacted files.
File main 643a4ab fix/7939-probe-reply... 56f8dad +/-
src/lib/onboard...shboard-port.ts 96% 90% -6%
src/lib/platform.ts 89% 84% -5%
src/lib/inferen...tokens-field.ts 100% 100% 0%
src/lib/messagi...nnels/policy.ts 100% 100% 0%
src/lib/sandbox...rce-identity.ts 88% 88% 0%
src/lib/state/config-io.ts 93% 93% 0%
src/lib/state/g...way-registry.ts 97% 97% 0%
src/lib/tunnel/services.ts 76% 76% 0%
src/lib/inference/health.ts 92% 93% +1%
src/lib/actions...ce-preflight.ts 50% 78% +28%

Updated August 04, 2026 06:36 UTC

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized terminology decisions differ; normalized E2E selections differ; severity counts match.
3 additional E2E selections from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • cloud-onboard: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • cloud-inference: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • kimi-inference-compat: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

1 semantic terminology decision

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — reply budget at src/lib/inference/max-tokens-field.ts:5: Keep `reply budget`. The changed text correctly states that probes use a minimum reply budget.

E2E guidance

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

Recommended E2E: inference-routing, network-policy, onboard-repair, onboard-resume, rebuild-openclaw, state-backup-restore

Workflow run details

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

@wscurran wscurran added area: inference Inference routing, serving, model selection, or outputs area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression labels Aug 3, 2026
@prekshivyas prekshivyas self-assigned this Aug 3, 2026

@apurvvkumaria apurvvkumaria 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.

Reviewed exact head 30904bc. The shared minimum probe reply budget is applied consistently across chat completions, responses, Anthropic, health, onboarding, and rebuild paths, with focused route and field coverage. I found no blocking correctness, security, compatibility, or regression issue; current CI is green.

@apurvvkumaria apurvvkumaria 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 current head b20f99b after the merge from main. The only combined-resolution area is src/lib/inference/onboard-probes.test.ts: it preserves this PRs 16-token hosted-endpoint floor while also retaining mains per-request curl argument capture and validation-timeout assertions. The harness counter now records arguments before parsing without changing response selection, and environment cleanup remains in finally. I found no new blocking defect. Exact-head CI is running; the image-build failures are the same inherited MCP runtime npm-audit findings and are unrelated to this inference/test merge.

cv added 2 commits August 3, 2026 23:07
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv merged commit 4b21250 into main Aug 4, 2026
98 of 100 checks passed
@cv
cv deleted the fix/7939-probe-reply-budget-minimum branch August 4, 2026 06:59
apurvvkumaria added a commit that referenced this pull request Aug 4, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Prepares the canonical v0.0.102 release documentation from the current
release-labeled scope.
The change adds a dated changelog for all 38 user-facing shipping PRs
and corrects the OpenClaw agent command reference for the behavior
delivered by #8191.

## Changes

- Add `docs/changelog/2026-08-04.mdx` with the v0.0.102 release summary,
detailed behavior changes, support boundaries, security evidence links,
and links to durable documentation.
- Update `docs/reference/commands.mdx` to describe non-JSON OpenClaw
output capture, its combined limit, marker handling, stream suppression,
recovery guidance, and exit behavior.
- [#8167](#8167) ->
`docs/changelog/2026-08-04.mdx`: Records authenticated attachment of
operator-managed llama.cpp servers.
- [#8129](#8129) ->
`docs/changelog/2026-08-04.mdx`: Records the Experimental managed vLLM
profile for two DGX Spark systems.
- [#7983](#7983) ->
`docs/changelog/2026-08-04.mdx`: Records qualification of the May 2026
GB300WS factory image.
- [#8207](#8207) ->
`docs/changelog/2026-08-04.mdx`: Records the qualified DGX Station
driver transaction.
- [#8208](#8208) ->
`docs/changelog/2026-08-04.mdx`: Records mode-bound Express resume
state.
- [#8158](#8158) ->
`docs/changelog/2026-08-04.mdx`: Records recovery of host-global
dual-Station runtime ownership.
- [#8145](#8145) ->
`docs/changelog/2026-08-04.mdx`: Records Windows-host Ollama validation
from Docker Desktop's network context.
- [#8190](#8190) ->
`docs/changelog/2026-08-04.mdx`: Records HTTP model pulls when WSL has
no local Ollama executable.
- [#8195](#8195) ->
`docs/changelog/2026-08-04.mdx`: Records reuse of a healthy
installer-managed CLI.
- [#8053](#8053) ->
`docs/changelog/2026-08-04.mdx`: Records early rejection of incompatible
OpenShell gateway versions.
- [#8098](#8098) ->
`docs/changelog/2026-08-04.mdx`: Records the bounded
package-service-to-standalone gateway recovery transition.
- [#8216](#8216) ->
`docs/changelog/2026-08-04.mdx`: Records the final dashboard port
selected during multi-sandbox onboarding.
- [#8146](#8146) ->
`docs/changelog/2026-08-04.mdx`: Records managed startup-state
restoration for stopped sandboxes.
- [#8092](#8092) ->
`docs/changelog/2026-08-04.mdx`: Records gateway watchdog recovery for
classified not-serving states.
- [#8182](#8182) ->
`docs/changelog/2026-08-04.mdx`: Records consistent managed-recovery
wait configuration.
- [#8040](#8040) ->
`docs/changelog/2026-08-04.mdx`: Records Docker sandbox rollback
authority through late validation.
- [#8130](#8130) ->
`docs/changelog/2026-08-04.mdx`: Records bounded Shields deadline
recovery and durable containment.
- [#8086](#8086) ->
`docs/changelog/2026-08-04.mdx`: Records repair of narrowly validated
permission-only configuration drift.
- [#8122](#8122) ->
`docs/changelog/2026-08-04.mdx`: Records prompt failure and guidance for
corrupt transition locks.
- [#8124](#8124) ->
`docs/changelog/2026-08-04.mdx`: Records policy restoration flags,
previews, and target revalidation.
- [#7886](#7886) ->
`docs/changelog/2026-08-04.mdx`: Records explicit destruction after
pre-delete Shields hardening failures while preserving recovery
authority.
- [#7901](#7901) ->
`docs/changelog/2026-08-04.mdx`: Records multi-port uninstall behavior
and shared-resource preservation.
- [#7984](#7984) ->
`docs/changelog/2026-08-04.mdx`: Records one classified transient remote
MCP startup retry.
- [#7954](#7954) ->
`docs/changelog/2026-08-04.mdx`: Records bounded hosted-inference probe
replies.
- [#7574](#7574) ->
`docs/changelog/2026-08-04.mdx`: Records preservation of validated
reasoning capabilities through onboarding.
- [#8089](#8089) ->
`docs/changelog/2026-08-04.mdx`: Records proxy routing for Hermes
WhatsApp pairing and media traffic.
- [#7682](#7682) ->
`docs/changelog/2026-08-04.mdx`: Records native Hermes session deletion
and identifier validation.
- [#8150](#8150) ->
`docs/changelog/2026-08-04.mdx`: Records corporate CA trust for
LangChain Deep Agents Code image builds.
- [#8156](#8156) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed managed runtime
dependency remediation.
- [#8180](#8180) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed MCP discovery runtime
dependency updates.
- [#8196](#8196) ->
`docs/changelog/2026-08-04.mdx`: Records private npm dependency
remediation across managed images.
- [#8203](#8203) ->
`docs/changelog/2026-08-04.mdx`: Records reviewed Hermes and LangChain
Deep Agents Code Python dependency updates.
- [#8125](#8125) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for invalid
enumerated CLI values.
- [#8193](#8193) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for
unresolved sandbox base images.
- [#8118](#8118) ->
`docs/changelog/2026-08-04.mdx`: Records bounded diagnostics for changed
gateway authority.
- [#8191](#8191) ->
`docs/changelog/2026-08-04.mdx`, `docs/reference/commands.mdx`: Records
output capture, marker handling, recovery guidance, and exit behavior
for non-JSON OpenClaw agent commands.
- [#8187](#8187) ->
`docs/changelog/2026-08-04.mdx`: Records the aligned
interactive-installation start across supported agents.
- [#8153](#8153) ->
`docs/changelog/2026-08-04.mdx`: Records current product capabilities
and support boundaries.

## 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
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: This documentation-only
release preparation does not change executable behavior. Existing
changelog and published-route tests pass.
- [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: Independently reviewed `docs/changelog/2026-08-04.mdx` and
`docs/reference/commands.mdx` at commit `b89913780`. All 38 user-facing
v0.0.102 PRs are represented, #8191 behavior matches the implementation,
and the writing rules, documentation style, controlled terminology,
route structure, and skip policy pass review. Targeted tests pass 36/36
and the documentation build completes with 0 errors.
- Agent: Codex Desktop independent documentation writer
<!-- docs-review-head-sha: b899137 -->
<!-- docs-review-agents-blob-sha: 3dd7c24 -->

## DGX Station Hardware Evidence

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

## 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 validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run --project integration
test/changelog-docs.test.ts test/check-docs-published-routes.test.ts`
passed 36/36.
- [x] Applicable broad gate passed — not applicable to
documentation-only changes; `npm run docs` completed successfully with 0
errors.
- [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) —
completed with 0 errors and 2 existing Fern warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [x] New doc pages include SPDX header and frontmatter (new pages only)
— the native dated changelog uses the required parser-safe MDX SPDX
comment and intentionally has no frontmatter.

---
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>


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

## Summary by CodeRabbit

- **Documentation**
- Added release notes for v0.0.102, covering authentication, hardware
setup, WSL, installer recovery, sandbox resilience, policy management,
inference reliability, CLI improvements, and unified quickstarts.
- Updated command documentation to explain how non-JSON agent output is
collected, replayed, and reported.

- **Bug Fixes**
- Improved command-output recovery guidance when output exceeds limits
or contains unsupported fallback markers.
- Preserved accurate command exit-status reporting after output
processing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

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

Labels

area: inference Inference routing, serving, model selection, or outputs area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants