fix(inference): trust explicit custom switch metadata - #5877
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (11)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughInference switch commands now accept optional endpoint URL, credential env, and inference API flags, pass them into ChangesInference switch metadata
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@src/lib/actions/inference-set.ts`:
- Around line 432-442: The validation in normalizeExplicitInferenceApi currently
allows anthropic-messages for compatible-endpoint, which can persist an
incompatible API family. Update the inference-api validation path in
normalizeExplicitInferenceApi and the compatible-endpoint handling so that
compatible-endpoint rejects anthropic-messages while still allowing
compatible-anthropic-endpoint to keep openai-completions. Make sure the
InferenceSetError message and the INFERENCE_SET_APIS checks reflect this
route-specific restriction.
In `@test/e2e-scenario/live/openclaw-inference-switch.test.ts`:
- Around line 960-965: The endpoint assignment in the switch-provider setup can
write the literal string "undefined" into
process.env.NEMOCLAW_SWITCH_ENDPOINT_URL when both sources are empty. Update the
logic around the SWITCH_PROVIDER/SWITCH_INFERENCE_API branch in
openclaw-inference-switch.test.ts to only assign the variable when
mockProvider?.endpointUrl or an existing env value is actually present, and
leave it unset otherwise so the later --endpoint-url flow does not receive an
invalid value.
🪄 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: 512fb063-f60d-4701-acec-bde2d513f6f6
📒 Files selected for processing (9)
src/commands/global-oclif-command-adapters.test.tssrc/commands/inference/set.tssrc/lib/actions/inference-set.test.tssrc/lib/actions/inference-set.tstest/e2e-scenario/live/hermes-inference-switch-helpers.tstest/e2e-scenario/live/hermes-inference-switch.test.tstest/e2e-scenario/live/openclaw-inference-switch.test.tstest/e2e/test-hermes-inference-switch.shtest/e2e/test-openclaw-inference-switch.sh
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@docs/reference/commands.mdx`:
- Line 1880: The documentation line in the commands reference combines multiple
sentences on one source line, which violates the one-sentence-per-line style.
Split the text in the compatible-endpoint guidance so the sentence ending with
durable rebuild metadata. is on its own line, and place the remaining sentence
about --credential-env, --inference-api, and supported API values on the next
line. Use the existing command description block around the compatible provider
options to locate and reflow it without changing the wording.
- Line 1880: The docs for the compatible provider flags need to be split by
provider and kept to one sentence per line. Update the section describing
compatible-endpoint and compatible-anthropic-endpoint so the supported
--inference-api values are listed separately: compatible-endpoint should mention
only openai-completions and openai-responses, while
compatible-anthropic-endpoint should additionally include anthropic-messages;
use the existing command reference wording and style in commands.mdx to locate
the affected paragraph.
🪄 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: bda14e16-a64c-4789-b981-94d669c6cdff
📒 Files selected for processing (7)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/lib/actions/inference-set.test.tssrc/lib/actions/inference-set.tstest/e2e-scenario/live/hermes-inference-switch-helpers.tstest/e2e-scenario/live/hermes-inference-switch.test.tstest/e2e-scenario/live/openclaw-inference-switch.test.ts
✅ Files skipped from review due to trivial changes (1)
- docs/reference/commands-nemohermes.mdx
🚧 Files skipped from review as they are similar to previous changes (3)
- test/e2e-scenario/live/hermes-inference-switch.test.ts
- src/lib/actions/inference-set.test.ts
- src/lib/actions/inference-set.ts
44fd0c9 to
af72c21
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/actions/inference-set.ts (1)
567-574: 🩺 Stability & Availability | 🔵 TrivialRun the targeted inference-switch E2Es for this path.
This change affects both route selection and sandbox config/session metadata, so the selective OpenClaw and Hermes switch jobs are the right validation gate here.
As per path instructions, run
openclaw-inference-switch-e2eandhermes-inference-switch-e2eforsrc/lib/actions/inference-set.tschanges.Also applies to: 712-719
🤖 Prompt for 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. In `@src/lib/actions/inference-set.ts` around lines 567 - 574, Run the targeted inference-switch E2Es for the inference-set flow: this change touches route selection and sandbox/session metadata in the `registryMetadataForProviderSwitch` path, so validate the `src/lib/actions/inference-set.ts` update by running both `openclaw-inference-switch-e2e` and `hermes-inference-switch-e2e` jobs.Source: Path instructions
🤖 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 `@src/lib/actions/inference-set.ts`:
- Around line 567-574: The final sync path in inference-set is letting
config/session-derived inference API state override an explicitly provided
`--inference-api`. Update the `resolveRuntimeInferenceApi(...)` / second
registry write flow so the explicit `preferredInferenceApi` from
`explicitCustomProviderMetadata(...)` is preserved when present, and ensure the
effective metadata passed into the onboard-session sync reflects that explicit
choice. Use the `registryMetadataForProviderSwitch(...)` and subsequent
patch/write logic in `inference-set.ts` to keep the explicit API authoritative
through the final sync.
---
Nitpick comments:
In `@src/lib/actions/inference-set.ts`:
- Around line 567-574: Run the targeted inference-switch E2Es for the
inference-set flow: this change touches route selection and sandbox/session
metadata in the `registryMetadataForProviderSwitch` path, so validate the
`src/lib/actions/inference-set.ts` update by running both
`openclaw-inference-switch-e2e` and `hermes-inference-switch-e2e` jobs.
🪄 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: 36505b7b-18a9-4798-9b39-81a2c25c38ba
📒 Files selected for processing (11)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/commands/global-oclif-command-adapters.test.tssrc/commands/inference/set.tssrc/lib/actions/inference-set.test.tssrc/lib/actions/inference-set.tstest/e2e-scenario/live/hermes-inference-switch-helpers.tstest/e2e-scenario/live/hermes-inference-switch.test.tstest/e2e-scenario/live/openclaw-inference-switch.test.tstest/e2e/test-hermes-inference-switch.shtest/e2e/test-openclaw-inference-switch.sh
✅ Files skipped from review due to trivial changes (2)
- docs/reference/commands-nemohermes.mdx
- docs/reference/commands.mdx
🚧 Files skipped from review as they are similar to previous changes (8)
- test/e2e/test-hermes-inference-switch.sh
- test/e2e/test-openclaw-inference-switch.sh
- src/commands/global-oclif-command-adapters.test.ts
- test/e2e-scenario/live/hermes-inference-switch.test.ts
- test/e2e-scenario/live/hermes-inference-switch-helpers.ts
- src/commands/inference/set.ts
- src/lib/actions/inference-set.test.ts
- test/e2e-scenario/live/openclaw-inference-switch.test.ts
cv
left a comment
There was a problem hiding this comment.
LGTM after addressing any feedback comments
47f4edd to
58cfe26
Compare
Selective E2E Results —
|
| Job | Result |
|---|---|
| hermes-inference-switch-e2e | |
| openclaw-inference-switch-e2e |
Selective E2E Results — ✅ All requested jobs passedRun: 28259557106
|
## Summary Adds the v0.0.69 release notes to the published release-notes page so users can see the shipped sandbox recovery, Deep Agents Code, Hermes, inference, policy, and release-validation changes. The section is based on the v0.0.69 announcement and links each user-facing theme to the deeper docs pages that already cover the behavior. ## Changes - Added a new `v0.0.69` section to `docs/about/release-notes.mdx`. - Linked release-note themes to lifecycle, backup, troubleshooting, Deep Agents Code, commands, workspace, messaging, Hermes, inference, security, monitoring, and network-policy docs. Source summary: - #5455 -> `docs/about/release-notes.mdx`: Summarized persistent workspace and state cleanup during sandbox destroy. - #5738 -> `docs/about/release-notes.mdx`: Summarized nonzero exit status preservation for failed hosted endpoint validation. - #5786 -> `docs/about/release-notes.mdx`: Summarized live sandbox rediscovery when local registry state is missing. - #5881 -> `docs/about/release-notes.mdx`: Summarized the `nemo-deepagents` alias command surface. - #5594 -> `docs/about/release-notes.mdx`: Summarized the Hermes Agent 2026.6.19 update. - #5777 -> `docs/about/release-notes.mdx`: Summarized manifest-derived messaging channel support. - #5825 -> `docs/about/release-notes.mdx`: Summarized DeepSeek V4 Flash managed-vLLM defaults for DGX Station. - #5877 -> `docs/about/release-notes.mdx`: Summarized provider switch metadata preservation. - #5932 -> `docs/about/release-notes.mdx`: Summarized transient inference smoke retry behavior. - #5934 -> `docs/about/release-notes.mdx`: Summarized constrained inference smoke retry boundaries. - #5681 -> `docs/about/release-notes.mdx`: Summarized Shields config-hash sealing during auto-restore. - #5682 -> `docs/about/release-notes.mdx`: Summarized sandbox connect process-limit enforcement. - #5683 -> `docs/about/release-notes.mdx`: Summarized JSON agent failure provenance warnings. - #5711 -> `docs/about/release-notes.mdx`: Summarized sparse-source log breadcrumbs. - #5838 -> `docs/about/release-notes.mdx`: Summarized host-authoritative Shields status. - #5880 -> `docs/about/release-notes.mdx`: Summarized policy round-trip documentation updates. - #5886 -> `docs/about/release-notes.mdx`: Summarized network request approval-flow documentation updates. ## 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: doc-only release-notes prose; no runtime behavior changed. - [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: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [ ] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [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) - [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) `npm run docs` passed with 0 errors and the existing Fern light-mode accent contrast warning. `fern check --warnings` reported the same accent-color warning. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added release notes for **v0.0.69**, covering improved sandbox lifecycle recovery (state preservation across destroy/recreate/rebuild/recovery/validation failures), clearer Deep Agents Code terminal/CLI behavior, and safer Hermes messaging/provider switching with manifest-driven channels. * Improved inference setup validation guidance, including handling of local/compatible endpoints and redaction of sensitive validation errors. * Refreshed release-gate documentation with clearer approval examples and validation behavior for NVIDIA API keys vs hosted inference keys. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary - Add explicit trusted metadata flags for compatible custom provider switches: endpoint URL, credential env, and inference API. - Persist explicit metadata into sandbox registry and matching onboard session during inference set. - Update OpenClaw/Hermes Anthropic inference-switch E2Es to pass mock endpoint metadata instead of relying on unrelated session state. ## Why Nightly openclaw-anthropic-inference-switch-e2e and hermes-anthropic-inference-switch-e2e fail after PR NVIDIA#5869 because the new source-boundary guard correctly refuses cross-provider compatible-Anthropic switches without durable endpoint metadata. This PR keeps that guard intact while giving the switch command a first-class trusted metadata path. ## Validation - npm run build:cli - npm test -- src/lib/actions/inference-set.test.ts src/commands/global-oclif-command-adapters.test.ts ## Related - Regression from PR NVIDIA#5869 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added optional `--endpoint-url`, `--credential-env`, and `--inference-api` flags to the Hermes/NemoClaw “inference set” commands. * **Bug Fixes** * Enhanced compatible-provider switching by validating allowed `--inference-api` values, persisting durable rebuild metadata, and synchronizing onboarding settings (including `endpoint-url` normalization). * **Documentation** * Updated command references and compatibility guidance, including trusted `--endpoint-url` requirements and allowed `--inference-api` values. * **Tests** * Expanded unit and end-to-end scenarios to cover the new flags and compatible switch behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary Adds the v0.0.69 release notes to the published release-notes page so users can see the shipped sandbox recovery, Deep Agents Code, Hermes, inference, policy, and release-validation changes. The section is based on the v0.0.69 announcement and links each user-facing theme to the deeper docs pages that already cover the behavior. ## Changes - Added a new `v0.0.69` section to `docs/about/release-notes.mdx`. - Linked release-note themes to lifecycle, backup, troubleshooting, Deep Agents Code, commands, workspace, messaging, Hermes, inference, security, monitoring, and network-policy docs. Source summary: - NVIDIA#5455 -> `docs/about/release-notes.mdx`: Summarized persistent workspace and state cleanup during sandbox destroy. - NVIDIA#5738 -> `docs/about/release-notes.mdx`: Summarized nonzero exit status preservation for failed hosted endpoint validation. - NVIDIA#5786 -> `docs/about/release-notes.mdx`: Summarized live sandbox rediscovery when local registry state is missing. - NVIDIA#5881 -> `docs/about/release-notes.mdx`: Summarized the `nemo-deepagents` alias command surface. - NVIDIA#5594 -> `docs/about/release-notes.mdx`: Summarized the Hermes Agent 2026.6.19 update. - NVIDIA#5777 -> `docs/about/release-notes.mdx`: Summarized manifest-derived messaging channel support. - NVIDIA#5825 -> `docs/about/release-notes.mdx`: Summarized DeepSeek V4 Flash managed-vLLM defaults for DGX Station. - NVIDIA#5877 -> `docs/about/release-notes.mdx`: Summarized provider switch metadata preservation. - NVIDIA#5932 -> `docs/about/release-notes.mdx`: Summarized transient inference smoke retry behavior. - NVIDIA#5934 -> `docs/about/release-notes.mdx`: Summarized constrained inference smoke retry boundaries. - NVIDIA#5681 -> `docs/about/release-notes.mdx`: Summarized Shields config-hash sealing during auto-restore. - NVIDIA#5682 -> `docs/about/release-notes.mdx`: Summarized sandbox connect process-limit enforcement. - NVIDIA#5683 -> `docs/about/release-notes.mdx`: Summarized JSON agent failure provenance warnings. - NVIDIA#5711 -> `docs/about/release-notes.mdx`: Summarized sparse-source log breadcrumbs. - NVIDIA#5838 -> `docs/about/release-notes.mdx`: Summarized host-authoritative Shields status. - NVIDIA#5880 -> `docs/about/release-notes.mdx`: Summarized policy round-trip documentation updates. - NVIDIA#5886 -> `docs/about/release-notes.mdx`: Summarized network request approval-flow documentation updates. ## 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: doc-only release-notes prose; no runtime behavior changed. - [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: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [ ] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [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) - [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) `npm run docs` passed with 0 errors and the existing Fern light-mode accent contrast warning. `fern check --warnings` reported the same accent-color warning. --- Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added release notes for **v0.0.69**, covering improved sandbox lifecycle recovery (state preservation across destroy/recreate/rebuild/recovery/validation failures), clearer Deep Agents Code terminal/CLI behavior, and safer Hermes messaging/provider switching with manifest-driven channels. * Improved inference setup validation guidance, including handling of local/compatible endpoints and redaction of sensitive validation errors. * Refreshed release-gate documentation with clearer approval examples and validation behavior for NVIDIA API keys vs hosted inference keys. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Why
Nightly openclaw-anthropic-inference-switch-e2e and hermes-anthropic-inference-switch-e2e fail after PR #5869 because the new source-boundary guard correctly refuses cross-provider compatible-Anthropic switches without durable endpoint metadata. This PR keeps that guard intact while giving the switch command a first-class trusted metadata path.
Validation
Related
Summary by CodeRabbit
--endpoint-url,--credential-env, and--inference-apiflags to the Hermes/NemoClaw “inference set” commands.--inference-apivalues, persisting durable rebuild metadata, and synchronizing onboarding settings (includingendpoint-urlnormalization).--endpoint-urlrequirements and allowed--inference-apivalues.