NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[MacOS] Invalid model Id was ignored and returned successful response

Open zNeill opened this issue 8 months ago • 11 comments

Description

When a request is sent to inference.local with a non-existent model ID (e.g., "model":"this-model-does-not-exist"), the OpenShell gateway does not validate the model and instead silently routes the request to the provider configured in the inference route. The request succeeds with a 200 response and a valid completion from the route-configured model (llama3.2:1b), completely ignoring the requested model. The gateway should validate the model ID and return a clear error when the requested model doesn't exist.Steps to reproduce

  1. Complete nemoclaw setup successfully
  2. Set inference route: openshell inference set --provider ollama-local --model llama3.2:1b
  3. Connect to sandbox: nemoclaw connect
  4. Send a request with a non-existent model ID: curl -s https://inference.local/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model":"this-model-does-not-exist","messages":[{"role":"user","content":"say hello"}]}'
Actual Result A valid completion is returned from the route-configured model (llama3.2:1b):
{"id":"chatcmpl-829","object":"chat.completion","model":"llama3.2:1b","choices":[{"index":0,"message":{"role":"assistant","content":"Hello."},"finish_reason":"stop"}],"usage":{"prompt_tokens":27,"completion_tokens":3,"total_tokens":30}}

Steps to reproduce

No steps provided.


[NVB# 5982631]

[NVB#5982631]

zNeill avatar Mar 26 '26 21:03 zNeill

@zNeill can I attempt this

sahithvibudhi avatar Mar 27 '26 22:03 sahithvibudhi

Fixed — fix(cli): fail fast on invalid model catalog payloads (752af4d2) now validates model IDs against the catalog and fails fast rather than silently returning a successful response. Closing as resolved.

wscurran avatar Apr 13 '26 22:04 wscurran

This issue is still reproducible with Nemoclaw v0.0.15. Tried on all platforms. Bug will remain open. Reopening this github issue. ​​​​​​​ Now the Local Ollama model available is openshell inference set --provider ollama-local --model qwen2.5:7b

When we run the curl command for a model name "this-model-does-not-exist", it still returns success(200) with model name "qwen2.5:7b"

sandbox@prachi-ollama:~$ curl https://inference.local/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"this-model-does-not-exist","messages":[{"role":"user","content":"say hello"}]}' {"id":"chatcmpl-92","object":"chat.completion","created":1776213152,"model":"qwen2.5:7b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! How can I assist you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":31,"completion_tokens":10,"total_tokens":41}}

PrachiShevate-nv avatar Apr 15 '26 00:04 PrachiShevate-nv

The issue is still reproducible on NemoClaw v0.0.30. Opened new nvbug

PrachiShevate-nv avatar Apr 29 '26 23:04 PrachiShevate-nv

Hi @zNeill, thanks for the report. This one has been open a while: around 37 releases have shipped since v0.0.30 (we are now on v0.0.67), with onboarding, the sandbox runtime, config generation, and many platform paths reworked along the way. Could you check whether this is still happening for you on the latest version? Cheers!

latenighthackathon avatar Jun 24 '26 16:06 latenighthackathon

@zNeill , @PrachiShevate-nv Findings — still reproduces on main; the fix belongs in the OpenShell gateway, not NemoClaw

I traced this on current main. The silent-success behavior is still present, and the reason it survived 752af4d2 is that the validation has to live in a layer that NemoClaw doesn't own. Evidence below.

Root cause

Rejecting an unknown model requires inspecting the live /v1/chat/completions body at the component that terminates the request and forwards to the provider. That component is the OpenShell gateway (inference.local), which is external to this repo. NemoClaw only configures the route — it is never on the request path, so it cannot see or reject the request.

  • inference.local is OpenShell's internal gateway hostname; it proxies to the configured provider — nemoclaw-blueprint/policies/openclaw-sandbox.yaml:90
  • Request path has no NemoClaw hop: Sandbox → OpenShell Gateway → Model Router → provider — docs/inference/inference-options.mdx:131
  • nemoclaw inference set is a thin wrapper over openshell inference set — src/lib/actions/inference-set.ts:330; the CLI itself redirects users to OpenShell for this op — src/commands/inference/set.ts:73
  • The only in-sandbox interception NemoClaw owns is a client-side Node preload, which by its own scope note is not loaded by non-Node callers like the curl in this repro — nemoclaw-blueprint/scripts/nemotron-inference-fix.js:113

Why 752af4d2 didn't hold

That commit hardened the setup-time catalog payload parser used by the onboard wizard — parseModelIds now throws on a malformed /v1/models response (src/lib/inference/provider-models.ts:37). That is config-time validation; it never touched per-request routing at the gateway, so the runtime path is unchanged. Consistent with QA re-reproducing on v0.0.15 and v0.0.30.

Recommendation

Authoritative fix → OpenShell gateway: validate the request model against the active route/catalog and return a 4xx (e.g. model_not_found) instead of silently serving the pinned model. This is the only layer that sees all clients (agent and raw curl). Suggest cross-filing/transferring to the OpenShell repo and tracking against NVBug 6128801.

hunglp6d avatar Jun 25 '26 10:06 hunglp6d

@hunglp6d @zNeill

Verified on v0.0.67. This bug/issue should stay open until there is a openshell gateway fix for this, and here is my explanation and logs.

The original symptom (invalid model giving 200 + a valid completion from another model) is no longer reproducible in your environment,

But that is only because inference.local itself is broken (NXDOMAIN), so the system never reaches the gateway to show the correct behavior.

Therefore the underlying issue (gateway must validate model and return a clear error) still needs an authoritative OpenShell-side fix, and the current result does not prove it’s fixed

Retest on MacOS / DGX Spark – inference.local DNS broken, main behavior not verifiable yet

Environment:

NemoClaw v0.0.67

OpenShell 0.0.44 (docker)

Sandbox: test-sb (default)

Retest steps (matching original repro):

Set inference route (local Ollama or NVIDIA Endpoints), confirm via nemoclaw test-sb status that inference is configured.

Inside sandbox/host, run:

nslookup inference.local

Output:

Server: 10.126.4.154
Address: 10.126.4.154#53

** server can't find inference.local: NXDOMAIN

So inference.local currently has no DNS record; the privacy router hostname does not resolve.knowledge.broadcom+1

Run the invalid-model curl test:

curl -s -o /dev/null -w "%{http_code}\n" https://inference.local/v1/chat/completions
-H "Content-Type: application/json"
-d '{"model":"this-model-does-not-exist","messages":[{"role":"user","content":"say hello"}]}'

Result: 000 and

curl: (6) Could not resolve host: inference.local

This means the request never reaches the gateway at all; curl reports http_code 000 when no HTTP response is received.everything.curl+1

Conclusion:

The original bad behavior for this bug (HTTP 200 + completion from a different model when "model":"this-model-does-not-exist") is not currently happening, but only because inference.local cannot be resolved — the gateway is not in the path.

As the latest analysis notes, the fix for this issue must live in the OpenShell gateway, since NemoClaw only configures inference.local and is not on the request path. The current DGX Spark environment shows a new reachability problem (NXDOMAIN for inference.local), which prevents verification of the intended gateway-side validation.nvidiapaste.txt

Until inference.local is wired correctly again (DNS record present, curl can reach /v1/...), we cannot confirm that the gateway validates the model field and returns a proper 4xx instead of silently serving the pinned route model.

Recommendation:

Keep NVBug 6128801 open and track it against the OpenShell gateway, as already suggested in the comments.

Once inference.local DNS is fixed on DGX Spark, re-run the invalid-model curl test and verify that the gateway returns a 4xx (e.g. model_not_found) rather than 200 + a completion from the route model.

The bug isn’t “fixed” in the sense of the gateway doing the right thing;

Your current environment just has inference.local broken at DNS, which blocks verification.

PrachiShevate-nv avatar Jun 25 '26 21:06 PrachiShevate-nv

@PrachiShevate-nv Was this open in OpenShell module of NVBugs ?

hunglp6d avatar Jun 26 '26 08:06 hunglp6d

@hunglp6d We usually open the NVBug in NemoClaw module. But if you / anyone else can help open this Github issue in the Openshell module, then we can keep tracking the Nvbug until the Openshell issue for this is resolved. Thanks, please let me know.

PrachiShevate-nv avatar Jun 26 '26 16:06 PrachiShevate-nv

@PrachiShevate-nv Update — verified against OpenShell source (HEAD a5161d0b): this is by-design, not a gateway defect.

prepare_backend_request (crates/openshell-router/src/backend.rs:297) unconditionally overwrites the request model with the route-configured model — intentionally, per the code comments: "so a sandbox cannot pick a different upstream model than what inference set configured" (:204). There is no request-time model validation. So {"model":"this-model-does-not-exist"} → HTTP 200 + completion from the pinned model is the deliberate result of model-pinning; the requested model is ignored by design. NemoClaw only configures the route and isn't on the request path, so it can't change this.

Recommendation: close #994 as by-design — or, optionally, keep it open until OpenShell #2063 (just created) lands. Either way the improvement (surface/optionally reject a silently-overwritten model) isn't dropped: it's reclassified bug → enhancement, tracked in OpenShell #2063.

hunglp6d avatar Jun 30 '26 16:06 hunglp6d

Thanks @hunglp6d for the root-cause analysis and for opening OpenShell #2063. Understood — this is by-design model-pinning behavior, not a gateway defect.

Closing #994 as by-design. The enhancement request (surface or optionally reject a silently-overwritten model) is now tracked in OpenShell #2063. I'll update NVBug 6128801 to link OpenShell #2063 and reclassify from Bug → Enhancement.

PrachiShevate-nv avatar Jun 30 '26 16:06 PrachiShevate-nv