NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[Bug] Upgrade regenerates read-only openclaw.json and silently overrides user's model config via merge precedence

Open nv-ddave opened this issue 7 months ago • 2 comments

Description

After running curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash to upgrade NemoClaw (e.g., to v0.0.15), the read-only config at /sandbox/.openclaw/openclaw.json is regenerated with Nemotron as the default model. This silently overrides the user's custom model selection in the writable config at /sandbox/.openclaw-data/openclaw.json due to a merge precedence issue.

Steps to Reproduce

  1. Configure Claude Opus (or any non-Nemotron model) in the writable config:
    // /sandbox/.openclaw-data/openclaw.json
    {
      "agents": {
        "defaults": {
          "model": "inference/azure/anthropic/claude-opus-4-6"
        }
      }
    }
    
  2. Verify the agent uses Claude Opus (check sessions.json after a run)
  3. Run curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash to upgrade
  4. Run the agent again
  5. Check sessions.json — the agent now uses nvidia/nemotron-3-super-120b-a12b instead of Claude Opus

Root Cause

The upgrade regenerates the read-only config with:

{
  "agents": {
    "defaults": {
      "model": {"primary": "inference/nvidia/nemotron-3-super-120b-a12b"}
    }
  }
}

The writable config uses "model": "string-value" (flat string), while the regenerated read-only uses "model": {"primary": "..."} (nested object). During mode: "merge", the object form takes precedence over the string form, so the read-only config wins — even though the writable config is supposed to override it.

Expected Behavior

The writable config (/sandbox/.openclaw-data/openclaw.json) should always take precedence over the read-only config (/sandbox/.openclaw/openclaw.json) for the agents.defaults.model field, regardless of whether the value is a string or object.

Workaround

Change the writable config to use the same object format as the read-only:

{
  "agents": {
    "defaults": {
      "model": {"primary": "inference/azure/anthropic/claude-opus-4-6"}
    }
  }
}

This survives future upgrades because both configs use the same key structure and the writable wins the merge.

Impact

  • Users who customized their model to Claude, GPT-4, or other non-Nemotron models get silently downgraded after upgrade
  • No warning or log message indicates the model changed
  • The maxTokens also reverts to 4096 (Nemotron default), which causes tool call truncation for models that support larger output windows
  • Debugging this requires reading sessions.json — not obvious to most users

Environment

  • NemoClaw v0.0.15
  • OpenShell v0.0.28 (m-dev)
  • DGX Spark (aarch64, Ubuntu)
  • Config merge mode: "mode": "merge"

Suggested Fix

Option A: The merge logic should treat the writable config as authoritative for agents.defaults.model regardless of value type (string vs object).

Option B: The upgrade script should detect an existing writable config with a custom model and either (a) preserve it by not regenerating conflicting keys in the read-only config, or (b) warn the user that the model default was reset.

Option C: Log a warning at agent startup when the resolved model differs from what the writable config specifies.

nv-ddave avatar Apr 14 '26 13:04 nv-ddave

✨ Thanks for submitting this issue, which identifies a bug in the upgrade process that silently overrides the user's custom model selection.

wscurran avatar Apr 14 '26 14:04 wscurran

Thanks for the detailed report, @nv-ddave — the root cause analysis and the format-mismatch reproduction steps were exactly what was needed to track this down.

The fixes shipped in v0.0.27 fully address the behavior described here. You can update and verify with nemoclaw upgrade-sandboxes.

What was fixed and why it closes the issue: The silent override happened because the Dockerfile baked in nvidia/nemotron-3-super-120b-a12b as a literal default, and if that ARG wasn't explicitly overridden at build time the generated openclaw.json would carry the wrong model — silently, because OpenClaw's models.mode: merge gave the read-only config precedence.

Two changes closed that vector: Model is always baked from the user's own selection. patchStagedDockerfile now rewrites ARG NEMOCLAW_MODEL=... in the staged Dockerfile with the model the user actually chose before any docker build runs. The Nemotron default in the Dockerfile is only ever reached on a completely fresh first-time install where no prior selection exists.

Rebuild and upgrade preserve the existing selection. sandboxRebuild (used by both nemoclaw rebuild and nemoclaw upgrade-sandboxes) saves the session's provider + model before deleting the old sandbox and forwards them into the onboard --resume call. The new image is therefore built with the same model the previous sandbox was running — no prompt, no drift. The format-mismatch edge (string vs. {primary: "..."} object) is also guarded: getSelectionDrift treats an unrecognised model shape as unknown and surfaces it rather than silently proceeding.

Please reopen if you see the model revert to Nemotron after an upgrade on v0.0.27 — include the output of nemoclaw list before and after and we'll take another look.

gburachas avatar Apr 27 '26 04:04 gburachas