NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[Inference] openshell inference set changes gateway model but sandbox agent still reports old model

Open zNeill opened this issue 6 months ago • 2 comments

Description

Description

After switching the inference model via `openshell inference set`,
`nemoclaw status` correctly shows the new model, but the OpenClaw
agent inside the sandbox still reports the old model identity.

This is similar to the previously fixed bug 5997656/6008460
(Kimi→nemotron direction) but occurs in the reverse direction
(nemotron→kimi or kimi→nemotron after runtime switch).

The sandbox's openclaw.json or agent config caches the model set
at build time and does not pick up the gateway-side inference set
change without a rebuild.
Environment
Device:        MacBook Pro (Apple M4 Pro, 48 GB)
OS:            macOS 26.0.1
NemoClaw:      v0.0.36
OpenClaw:      2026.4.24
Original model: moonshotai/kimi-k2.6
Switched to:   nvidia/nemotron-3-super-120b-a12b
Steps to Reproduce
1. Onboard with Kimi K2.6
2. Run: openshell inference set -g nemoclaw --model nvidia/nemotron-3-super-120b-a12b --provider nvidia-prod
3. Verify: nemoclaw status → shows nemotron (correct)
4. Run: openclaw agent -m "What model are you?" --session-id post-switch
5. Agent responds: "I'm using model: inference/moonshotai/kimi-k2.6"
Expected Result
Agent should report the new model (nemotron) after inference set,
or at minimum the actual inference responses should come from the
new model.
Actual Result
nemoclaw status: nvidia/nemotron-3-super-120b-a12b (correct)
Agent self-report: inference/moonshotai/kimi-k2.6 (stale)

The openclaw.json inside the sandbox still has the build-time model.
openshell inference set only changes the gateway routing, not the
sandbox-internal agent config.
Note
Related to previously fixed 5997656 / 6008460 (same symptom, different
direction). Those were closed as verified — this may be a regression
or a different code path (runtime switch vs onboard-time config).

Bug Details

Field Value
Priority Unprioritized
Action Dev - Open - To fix
Disposition Open issue
Module Machine Learning - NemoClaw
Keyword NemoClaw, NemoClaw_CLI&UX, NEMOCLAW_GH_SYNC_APPROVAL, NemoClaw_Inference

[NVB#6154913]

zNeill avatar May 07 '26 12:05 zNeill

Platform: DGX Spark spark-8158 (10.173.104.102), aarch64 NemoClaw: v0.0.43 OpenShell: 0.0.39 (docker-driver gateway)

Repro steps:

Sandbox onboarded with model nvidia-routed, provider nvidia-router Ran: openshell inference set --model nvidia/nemotron-3-super-120b-a12b Gateway updated successfully (config version 2 → 3) nemoclaw status temporarily showed the new model Observed behavior:

nemoclaw list immediately showed drift indicator: (onboarded: model=nvidia-routed) — sandbox internal config (openclaw.json) still retained the onboard-time model After a short period, gateway config reverted back to nvidia-routed (version 3 → 4), confirming the sandbox's stale config overwrites the gateway change Root cause (unchanged): openshell inference set updates the gateway-level model config, but the sandbox's internal /sandbox/.openclaw/openclaw.json retains the original onboarded model. On the next gateway restart or config reconciliation, the sandbox config wins and reverts the gateway model.

Impact: Users who change the inference model via openshell inference set will see their change silently reverted. The only reliable workaround is to destroy and re-onboard with the desired model.

mercl-lau avatar May 15 '26 09:05 mercl-lau

Re-investigated this against the user's DGX Spark repro on v0.0.43. Confirming that #3319 does not close this path, and explaining why a NemoClaw-only fix can't.

What #3319 did and didn't cover

#3319 added two mechanisms:

  1. A new nemoclaw inference set (src/lib/actions/inference-set.ts) that updates the OpenShell gateway route AND patches the sandbox's /sandbox/.openclaw/openclaw.json in one operation.
  2. A safety-net reconciler in scripts/nemoclaw-start.sh (reconcile_agent_model_with_provider) intended for users who run openshell inference set directly.

Mechanism 1 works, but only if users call it. The repro used openshell inference set (the OpenShell command, run on the host), which is unchanged by #3319 — it still only writes the gateway-side config.

Mechanism 2 has a bug in its premise: it reads both fields of its equality check from the same file (agents.defaults.model.primary vs models.providers.inference.models[0].name). When the user runs openshell inference set, neither field in the sandbox file is touched, so they remain equal to each other and the reconciler short-circuits as a no-op. It never compares against the live gateway state, so it can't see the drift it was supposed to repair.

Why this also needs an OpenShell-side change

The user's "version 3 → 4" revert happens without a sandbox restart, while the sandbox is running. The sequence is:

t Event Gateway Sandbox openclaw.json
0 onboard nvidia-routed (v2) nvidia-routed
1 openshell inference set …nemotron… nemotron-120b (v3) ✓ nvidia-routed (untouched)
2 gateway-side reconciliation re-reads sandbox config nvidia-routed (v4 — reverted) nvidia-routed

The version counter is openshell-gateway's, and the t=2 bump is the gateway pulling models.providers.inference back out of openclaw.json and re-applying it. That push-back direction is owned by openshell-gateway, not NemoClaw. Even a correct NemoClaw-side reconciler only runs at sandbox start — it can't intercept a runtime reconcile cycle that hasn't been triggered by a restart.

Concretely, a fix for the silent-revert behavior needs OpenShell to either:

  • Skip the inference-provider sub-tree when ingesting openclaw.json after a runtime inference set (the sandbox shouldn't out-vote a deliberate gateway change), or
  • Compare config-version/timestamps and refuse to overwrite a newer gateway-side state with an older file-side state.

Without one of those, NemoClaw cannot keep the gateway change alive between the moment the user runs openshell inference set and the next sandbox restart.

NemoClaw-side follow-up

I'll send a small PR that fixes the safety-net reconciler in scripts/nemoclaw-start.sh to source its target from openshell inference get --json instead of from the same file it's writing to. That closes the original #3175 symptom (agent self-report drift) at the next sandbox restart, once the gateway change actually persists — i.e., once the OpenShell-side push-back is fixed or worked around. It also makes nemoclaw status/nemoclaw list drift detection meaningful, because a restart will now resolve the drift instead of papering over it.

But to be explicit: that PR is a partial fix. It is necessary but not sufficient for this repro. The silent revert seen at t=2 above will not stop until the OpenShell-side change lands. Recommend keeping this issue open and filing a paired bug against NVIDIA/OpenShell for the gateway-config push-back behavior.

Workaround in the meantime

Use nemoclaw inference set --provider <provider> --model <model> (added in #3319) instead of openshell inference set …. The wrapper updates both halves atomically, so the gateway has no stale sandbox-side state to revert to.

jason-ma-nv avatar May 18 '26 07:05 jason-ma-nv