Skip to content

fix(dcode): apply the compatible-endpoint reasoning effort at runtime - #7971

Merged
jyaunches merged 5 commits into
mainfrom
fix/dcode-reasoning-effort
Jul 31, 2026
Merged

jyaunches merged 5 commits into
mainfrom
fix/dcode-reasoning-effort

Conversation

@laitingsheng

@laitingsheng laitingsheng commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A NemoClaw-managed Deep Agents Code sandbox recorded a compatible-endpoint reasoning effort in registry state but sent every model request without it, so the endpoint default applied instead. The managed image now bakes the recorded effort into a root-owned file, and the managed provider resolver supplies it as an extra_body.reasoning_effort request parameter.

Related Issue

Fixes #7938

Changes

  • agents/langchain-deepagents-code/Dockerfile declares ARG NEMOCLAW_REASONING_EFFORT, validates it as empty, low, medium, or high at build time, and writes it to root-owned 0444 /usr/local/share/nemoclaw/dcode-reasoning-effort. The staged-Dockerfile patcher already rewrote this ARG name for OpenClaw; with no matching declaration here the rewrite was a silent no-op.
  • agents/langchain-deepagents-code/managed-dcode-runtime.py adds managed_reasoning_effort(). It repeats the fail-closed shape of managed_auto_approval_mode() because both read image state that runtime must not trust: ownership, mode, exact size, O_NOFOLLOW, and a read-race check. An unsafe or unrecognized file returns None, which keeps the endpoint default. Direct-module cases in test/langchain-deepagents-code-reasoning-effort.test.ts pin the rejected shapes.
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py sets extra_body.reasoning_effort on the managed OpenAI adapter. The hardened resolver never consumes the mutable config.toml params table, so a generator-only change cannot reach the request. The same file adds the new function to the stale-helper guard, which now covers every managed capability rather than auto-approval alone.
  • agents/langchain-deepagents-code/generate-config.ts records the effort in the generated per-model params table. extra_body now merges the Ultra template argument and the reasoning effort into one table; an unset effort produces byte-identical output to before.
  • scripts/check-dcode-profile-import-gate.sh allows the new ARG name. The gate refuses any unlisted ARG, so the build fails without this entry.
  • Docs record the build-time behavior for Deep Agents Code and correct the model-capabilities page, which previously implied inference set could change the effort on a Deep Agents Code sandbox.

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:
  • 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

  • Documentation writer subagent reviewed the completed changes
  • Result: blocked
  • Evidence: docs/get-started/quickstart-langchain-deepagents-code.mdx, docs/inference/configure-model-capabilities.mdx. The authoring host ran with subagents disabled, so no documentation writer subagent reviewed the change. npm run docs reports 0 errors, including the route check that rejected an earlier cross-variant link.
  • Agent: Claude Code

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

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 validate:pr passed after refreshing origin/main 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: npx vitest run --project integration test/langchain-deepagents-code-config.test.ts test/langchain-deepagents-code-reasoning-effort.test.ts test/langchain-deepagents-code-direct-module-patch.test.ts test/langchain-deepagents-code-nemotron-profile-plugin.test.ts test/langchain-deepagents-code-image.test.ts test/langchain-deepagents-code-auto-approval-image.test.ts test/langchain-deepagents-code-profile-build-gate.test.ts — 7 files, 150 tests passed. npm run typecheck:cli reports 0 errors.
  • 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: Tinson Lai tinsonl@nvidia.com

Summary by CodeRabbit

  • New Features

    • Added configurable reasoning-effort levels—low, medium, or high—for supported Deep Agents Code inference endpoints.
    • Leaving the setting unset preserves the endpoint default; invalid or unsafe values are safely ignored.
    • Changes require fresh onboarding with sandbox recreation.
  • Documentation

    • Clarified supported workflows and configuration behavior.
  • Tests

    • Added coverage for valid, unset, invalid, unsafe, and provider-specific settings.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1c03e73f-2e49-4d21-9d6e-4b147de97608

📥 Commits

Reviewing files that changed from the base of the PR and between 29602d4 and 0a71152.

📒 Files selected for processing (3)
  • src/lib/onboard/managed-startup-agent-environment.test.ts
  • src/lib/onboard/managed-startup/agent-environment.ts
  • src/lib/onboard/managed-startup/profile.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/lib/onboard/managed-startup/profile.ts
  • src/lib/onboard/managed-startup-agent-environment.test.ts
  • src/lib/onboard/managed-startup/agent-environment.ts

📝 Walkthrough

Walkthrough

The change adds managed reasoning-effort configuration for LangChain Deep Agents Code. DCode profiles resolve reasoningEffort from the environment, store it in protected image material, the runtime reads the recorded value, and the managed provider applies it to OpenAI requests.

Changes

Managed DCode reasoning effort

Layer / File(s) Summary
Startup profile contract and image materials
src/lib/onboard/managed-startup/profile.ts, src/lib/onboard/managed-startup/profile-builder.ts, src/lib/onboard/managed-startup/onboard-profile.ts, src/lib/onboard/managed-startup/agent-environment.ts, agents/langchain-deepagents-code/Dockerfile, scripts/check-dcode-profile-import-gate.sh
DCode affordances advertise reasoningEffort tuning support and map NEMOCLAW_REASONING_EFFORT to tuning.reasoningEffort. Profile builders resolve the setting from the environment. The profile removes it from the runtime environment and creates protected root-owned image material. The Dockerfile validates accepted values and persists them.
Configuration generation and provider integration
agents/langchain-deepagents-code/generate-config.ts, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py
The configuration generator reads and validates the reasoning-effort setting. The managed runtime securely reads the capability file. The managed provider adds extra_body.reasoning_effort for OpenAI requests and validates patch requirements include the capability function.
Test coverage for reasoning effort
test/helpers/langchain-deepagents-code-patch-fixture.ts, test/langchain-deepagents-code-config.test.ts, test/langchain-deepagents-code-reasoning-effort.test.ts, src/lib/onboard/managed-startup-agent-environment.test.ts, src/lib/onboard/managed-startup-profile-builder.test.ts, src/lib/onboard/managed-startup-onboard-profile.test.ts
Tests verify supported effort values, unset behavior, invalid configuration rejection, unsafe capability files, provider-specific application, configuration isolation, and managed startup profile integration.
Documentation
docs/get-started/quickstart-langchain-deepagents-code.mdx, docs/inference/configure-model-capabilities.mdx
Documentation describes reasoning effort propagation, endpoint-default preservation when unset, re-onboarding requirements for changes, and workflow limitations for OpenClaw and Hermes sandboxes.

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

Sequence Diagram(s)

sequenceDiagram
  participant StartupProfile
  participant ImageBuild
  participant GenerateConfig
  participant ManagedRuntime
  participant ProviderPatch
  participant OpenAIEndpoint
  StartupProfile->>ImageBuild: Provide NEMOCLAW_REASONING_EFFORT
  ImageBuild->>ImageBuild: Validate and record reasoning effort
  GenerateConfig->>GenerateConfig: Read and validate NEMOCLAW_REASONING_EFFORT
  ManagedRuntime->>ManagedRuntime: Read managed_reasoning_effort()
  ProviderPatch->>ProviderPatch: Add extra_body.reasoning_effort
  ProviderPatch->>OpenAIEndpoint: Send request with reasoning_effort
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#7463: Adds Nemotron Ultra template workaround to managed OpenAI provider parameters alongside the reasoning-effort setting.
  • NVIDIA/NemoClaw#7946: Modifies DCode tuning and managed startup profile schema support with overlapping capability handling.
  • NVIDIA/NemoClaw#7959: Extends managed startup profile construction for DCode affordances and validation.

Suggested labels: area: onboarding

Suggested reviewers: cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes applying compatible-endpoint reasoning effort during DCode runtime requests.
Linked Issues check ✅ Passed The changes store, validate, read, and apply NemoClaw reasoning effort through the managed DCode adapter while preserving override restrictions and adding coverage for supported values [#7938].
Out of Scope Changes check ✅ Passed The code, tests, profile updates, import gate, and documentation changes directly support the linked issue objectives.
✨ 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/dcode-reasoning-effort

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 0a71152 in the fix/dcode-reasoning-... branch remains at 96%, unchanged from commit 7eb0369 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 0a71152 in the fix/dcode-reasoning-... branch remains at 81%, unchanged from commit 7eb0369 in the main branch.

Show a code coverage summary of the most impacted files.
File main 7eb0369 fix/dcode-reasoning-... 0a71152 +/-
src/lib/onboard/docker-cdi.ts 80% 70% -10%
src/lib/onboard...host-anchors.ts 94% 90% -4%
src/lib/onboard/preflight.ts 80% 80% 0%
src/lib/onboard...al-inference.ts 91% 93% +2%
src/lib/actions...orchestrator.ts 83% 87% +4%
src/lib/onboard...box-gpu-mode.ts 92% 97% +5%
src/lib/actions...confirmation.ts 69% 79% +10%
src/lib/actions...ocker-health.ts 65% 82% +17%
src/lib/onboard...box-prebuild.ts 74% 92% +18%
src/lib/onboard...flight-ports.ts 33% 67% +34%

Updated July 31, 2026 14:04 UTC

@github-actions

Copy link
Copy Markdown
Contributor

@laitingsheng laitingsheng added area: inference Inference routing, serving, model selection, or outputs bug-fix PR fixes a bug or regression integration: dcode LangChain Deep Code integration behavior area: integrations Third-party service integration behavior area: providers Inference provider integrations and provider behavior and removed area: inference Inference routing, serving, model selection, or outputs labels Jul 31, 2026

@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: 3

🤖 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 `@agents/langchain-deepagents-code/managed-dcode-runtime.py`:
- Around line 1333-1338: Extend the reasoning-effort negative-path tests around
managed_reasoning_effort() to replace the fixture capability path with a
symbolic link, then assert the function returns None and generated OpenAI kwargs
omit extra_body. Ensure the test also verifies the rejection does not expose
sensitive capability-path details through errors, logs, state, or process
arguments.

In `@docs/inference/configure-model-capabilities.mdx`:
- Line 92: Update the reasoning-effort instruction associated with the page’s
agent-variants metadata to refer only to OpenClaw, removing the Hermes reference
from this OpenClaw-only page. Do not add Hermes guidance here; place it on a
page published for Hermes if needed, and ensure rendered navigation remains
scoped to the correct agent variant.

In `@test/langchain-deepagents-code-reasoning-effort.test.ts`:
- Around line 81-91: Remove the contents-based conditional from the
parameterized test using writeManagedReasoningEffort. Move the null “missing
capability file” case into a separate it block, and keep the remaining
parameterized cases limited to inputs that write a capability file.
🪄 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: 0dad58f5-7144-4d7b-bfd4-74bfda096843

📥 Commits

Reviewing files that changed from the base of the PR and between 91fc63e and 2a09f90.

📒 Files selected for processing (10)
  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/generate-config.ts
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • docs/inference/configure-model-capabilities.mdx
  • scripts/check-dcode-profile-import-gate.sh
  • test/helpers/langchain-deepagents-code-patch-fixture.ts
  • test/langchain-deepagents-code-config.test.ts
  • test/langchain-deepagents-code-reasoning-effort.test.ts

@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 · high 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 E2E selections differ; severity counts match.

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: cloud-onboard, onboard-repair, onboard-resume, ubuntu-repo-cloud-langchain-deepagents-code

Workflow run details

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

…onal

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
The managed startup profile requires every stock Docker input to map to a
versioned startup field or a declared build-only exclusion, and the new
reasoning-effort build argument had neither. It now maps to the same
tuning field OpenClaw uses, and the DCode mapper emits the root-owned
capability file the sandbox runtime reads, matching the auto-approval
input it sits beside.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@github-actions github-actions Bot added v0.0.100 and removed v0.0.99 labels Jul 31, 2026
@jyaunches jyaunches self-assigned this Jul 31, 2026

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

Approved after exact-revision merge gate: current head/base CI and selected E2E evidence pass, the linked supported regression is covered by tests and documentation, contributor requirements pass, and no unresolved correctness or security findings remain.

@jyaunches
jyaunches merged commit 865e3f9 into main Jul 31, 2026
75 of 76 checks passed
@jyaunches
jyaunches deleted the fix/dcode-reasoning-effort branch July 31, 2026 14:59
@senthilr-nv senthilr-nv mentioned this pull request Aug 1, 2026
10 of 23 tasks
senthilr-nv added a commit that referenced this pull request Aug 1, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Adds the canonical dated changelog entry for `v0.0.100` so the
maintainer release plan can verify the pre-tag documentation
prerequisite. The entry summarizes the user-facing changes merged since
`v0.0.99` and links to the relevant guides.

## Changes

- Add `docs/changelog/2026-07-31.mdx` with the exact `## v0.0.100`
heading.
- Cover restored OpenClaw pairing, transactional replacement, Deep
Agents Code, onboarding recovery, lifecycle cleanup, Hermes builds, host
provenance, documentation, and trusted E2E evidence.
- Distinguish active Docker and Kubernetes runtime-bundle enforcement
from the still-inactive managed shared-state transaction foundation.

## Source Coverage

The release entry maps the doc-impacting merged PRs in the
`v0.0.99..main` release range to `docs/changelog/2026-07-31.mdx`: #8021,
#8024, #7973, #8028, #7947, #7788, #7884, #8023, #7969, #8020, #7989,
#8000, #7907, #7942, #7567, #8013, #7955, #8017, #8014, #8015, #7629,
#7644, #7821, #7971, and #7991.

PR #7974 was reviewed after the final rebase and excluded because it
changes internal maintainer-skill attribution policy and tests only; it
does not change a user-facing product or documentation surface.

## 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: the
changelog contract test validates the dated entry, version heading, SPDX
form, and route constraints.
- [ ] 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-31.mdx`; exact-head review passed
for `6093f44f`; writing rules and documentation style reviewed; `npx
vitest run test/changelog-docs.test.ts` passed 6/6; `npm run docs`
passed with zero Fern errors and two generic Fern upgrade notices.
- Agent: Codex Desktop
<!-- docs-review-head-sha: 6093f44 -->
<!-- docs-review-agents-blob-sha: 3dd7c24 -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit: Not applicable; no DGX Station host script changed.
- 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 — command/result or justification: `npx
vitest run test/changelog-docs.test.ts` passed 6/6 at `6093f44f`.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: Not applicable to a dated
prose-only release entry.
- [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) —
validation passed with zero errors; Fern emitted two generic upgrade
notices.
- [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)
— the changelog entry has the required parser-safe MDX SPDX header;
dated changelog entries intentionally do not use page frontmatter.

---

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


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

## Summary by CodeRabbit

* **Documentation**
  * Added release notes for v0.0.100.
* Documented improvements to restore pairing, sandbox replacement,
onboarding recovery, lifecycle cleanup, runtime handling, build support,
host readiness, and end-to-end validation.

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

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
rsliter pushed a commit that referenced this pull request Oct 21, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Sandbox creation built its inference selection with a hardcoded `null`
reasoning effort, so a
compatible-endpoint route onboarded with an explicit
`NEMOCLAW_REASONING_EFFORT` was registered
without it and `status` reported `endpoint-default`. This PR threads the
requested effort through
the sandbox phase the same way the neighbouring reasoning flag already
travels.

Closes #12744.

## Reproduction
Executed on our Ubuntu 24.04 x86_64 test host (no GPU), from a clean
uninstall each time:

```bash
export NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 NEMOCLAW_NON_INTERACTIVE=1 NEMOCLAW_POLICY_MODE=suggested
export NEMOCLAW_PROVIDER=custom NEMOCLAW_ENDPOINT_URL=<an OpenAI-compatible endpoint>
export NEMOCLAW_MODEL=nvidia/nemotron-3-ultra-550b-a55b
export NEMOCLAW_REASONING_EFFORT=high
nemoclaw onboard --agent langchain-deepagents-code --name repro-12744 --non-interactive --yes --no-gpu
nemoclaw repro-12744 status
```

**Environment**
- Ubuntu 24.04.3 LTS, x86_64, Node.js v22.22.2, OpenShell 0.0.116
- Reproduced on the reporter's version `v0.0.130` (`a73099c77`) and on
`main` (`f633c9958`)
- Agent: Deep Agents Code; provider: `compatible-endpoint` over a public
OpenAI-compatible endpoint

**Observed on `main` (before fix)**

```
  Sandbox: repro-12744
    Model:    nvidia/nemotron-3-ultra-550b-a55b
    Provider: compatible-endpoint
    Reasoning effort: endpoint-default
```

The onboarding session recorded the request correctly, but the registry
entry did not:

```
onboard-session.json : "compatibleEndpointReasoningEffort": "high"
sandboxes.json       : "compatibleEndpointReasoningEffort": null
```

**Observed on `fix/dcode-reasoning-effort-12744` (after fix)**

```
  Sandbox: repro-12744
    Provider: compatible-endpoint
    Reasoning effort: high

sandboxes.json : "compatibleEndpointReasoningEffort": "high"
```

The issue's expected result also covers a rebuild. A source build of
`main` cannot exercise
`rebuild` (its managed image catalog is not published, so the preflight
fails with a GHCR 404
before reaching any of this code), so that half was verified on
`v0.0.130` with this patch applied:

```
BASE=a73099c77  PATCH_APPLIED=ok  BUILD=0  nemoclaw v0.0.130
ONBOARD_EXIT=0  -> Reasoning effort: high
REBUILD_EXIT=0  -> Reasoning effort: high
```

## Analysis
`status` renders the effort through `getEffectiveReasoningEffort()`
(`src/lib/inference/selection.ts:102-120`), which returns
`endpoint-default` when the route is a
compatible endpoint on `openai-completions` and the recorded effort is
absent. That output was
correct; the recorded value was missing.

Instrumenting the onboarding chain on the test host showed the requested
value surviving every hop
up to and including the provider-inference handler's return:

```
selection.custom          effort=high  env=high
flow.readSelection…       effort=high  stateEffort=high
flow.beforeClear          provider=compatible-endpoint effort=high
handler.fromSelection     effort=high  reuseCred=false
handler.return            effort=high  api=openai-completions provider=compatible-endpoint
registration.selection    match=true   sessEffort=high   sessReasoning=false
registry.register         effortIn=null  reasoningIn=false     <-- dropped here
```

The drop is at `src/lib/onboard/machine/handlers/sandbox.ts:2322-2332`,
where the sandbox phase
builds the selection it hands to `createSandbox()`. Every field there is
threaded from
`this.options` — provider, model, endpoint URL and source, credential
env, preferred API,
`compatibleEndpointReasoning`, NIM container — except the effort, which
was written as a literal
`null`. The phase options type did not carry the field at all, and
`src/lib/onboard/machine/core-flow-phases.ts:357` did not pass it, even
though the same function
passes `context.compatibleEndpointReasoningEffort` to the two
neighbouring phases (lines 277 and
302). That is why the sibling `compatibleEndpointReasoning` value
reached the registry while the
effort did not.

The registry entry is the durable record: `nemoclaw <sandbox> status`
reads it, and
`rebuild-resume-config.ts:123-125` replays it on rebuild. With the field
empty at creation, both
reads were correct about an empty value.

#7971 fixed propagation inside provider selection and into the
onboarding session, which is why
the session still shows `high` on v0.0.130. This last hop into the
created sandbox was never
connected.

## Fix
- `src/lib/onboard/machine/handlers/sandbox.ts`: add
`compatibleEndpointReasoningEffort` to the
phase options and pass `this.options.compatibleEndpointReasoningEffort`
into
  `sandboxCreateInferenceSelection()` instead of the literal `null`.
- `src/lib/onboard/machine/core-flow-phases.ts`: pass
`context.compatibleEndpointReasoningEffort`
  into the sandbox phase, matching the two sibling phases.
- `src/lib/onboard/machine/handlers/sandbox-test-fixtures.ts`: the
shared options fixture gains the
  new required field.

Normalization is unchanged: `normalizeInferenceSelection()` still drops
an effort recorded against
a provider that cannot use it, so threading the value cannot smuggle it
onto another route.

**Whole-class check.** `sandboxCreateInferenceSelection()` has exactly
one call site (the one
fixed). `buildCreatedSandboxRegistryEntry()` has one call site, which
consumes that selection.
The other literal `compatibleEndpointReasoningEffort: null` in
`setup-nim-flow.ts:880` is an
initial-state default sitting beside `compatibleEndpointReasoning: null`
and is not affected. The
rebuild path reads the registry rather than rebuilding the selection, so
it needs no change — and
the rebuild run above confirms it.

**Failure path.** The change adds no branch and no new failure mode: it
replaces a constant with a
value that was already validated and normalized downstream. An absent
request stays `null` and the
endpoint default continues to apply.

## Changes
- `src/lib/onboard/machine/handlers/sandbox.ts`: thread the requested
reasoning effort into the created sandbox selection.
- `src/lib/onboard/machine/core-flow-phases.ts`: pass the effort into
the sandbox phase options.
- `src/lib/onboard/machine/handlers/sandbox-test-fixtures.ts`: add the
new option to the shared fixture.
- `src/lib/onboard/machine/handlers/sandbox-reasoning-effort.test.ts`:
new regression coverage.
- `src/lib/state/registry-route-reservation.test.ts`: give the
durable-route staging block its own timeout budget — unrelated to the
fix, see below.

## Unrelated CI fix carried here
`cli-test-shards (6)` failed on this branch, and on unmodified `main`,
because the first case of
the durable-route staging block in
`src/lib/state/registry-route-reservation.test.ts` exceeds the
5 s default once the shard adds coverage instrumentation:

```text
# unmodified main
npx vitest run src/lib/state/registry-route-reservation.test.ts --coverage \
  --coverage.reporter=json-summary --coverage.include="src/**/*.ts"
 × stages fresh Model Router route from the durable route  5007ms
```

Without coverage the same case takes 1722 / 1667 / 1760 ms and the file
passes 53/53, so the
budget was exceeded by construction rather than by timing luck; three
shard reruns did not change
it. The case pays the cold import of `./registry` and
`../onboard/sandbox-registration` after
`vi.resetModules()`. This PR gives that block an explicit budget through
the shared `testTimeout`
helper, which restores a green shard (53/53 with coverage). #12818
tracks the underlying cost if
maintainers would rather make the setup cheaper than widen the budget.

## Test matrix
- Requested effort reaches the created sandbox selection (regression
lock; fails without the fix).
- No requested effort stays absent, so the endpoint default still
applies.
- An effort recorded against a provider that cannot use it is still
dropped by normalization.
- Full `src/lib/onboard/machine/handlers` suite: 45 files, 637 tests,
passing.

## Type of Change

- [x] 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)

## Verification

- [x] `npx prek run --all-files` passes
- [x] `npm test` passes (touched files at minimum)
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] 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)

## AI Disclosure
- [x] AI-assisted — tool: Claude Code

Signed-off-by: Yanyun Liao <yanyunl@nvidia.com>

🤖 Generated with [Claude Code](https://claude.com/claude-code)


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

* **Bug Fixes**
* Sandbox creation during onboarding now uses the configured reasoning
effort when the selected endpoint supports it. When no effort is
configured or the endpoint is incompatible, no reasoning effort is
selected. This ensures the sandbox’s inference selection reflects the
onboarding settings and the selected endpoint’s capabilities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Yanyun Liao <yanyunl@nvidia.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: integrations Third-party service integration behavior area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression integration: dcode LangChain Deep Code integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Managed DCode omits compatible-endpoint reasoning effort at runtime

3 participants