You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): reject MCP credential collisions before rebuild (#9401)
<!-- markdownlint-disable MD041 -->
## Summary
Sandbox rebuild now rejects an attached provider that supplies a
credential key reserved by managed MCP before changing MCP state. Forced
host-side recovery repeats the collision check before sandbox deletion.
The credential guide documents recovery that preserves the provider and
stored credential.
## Related Issue
Fixes#9388
## Changes
- Run the attached-provider credential collision check during ordinary
live-sandbox rebuild preparation.
- Repeat the collision check before forced host-side recovery deletes
the sandbox.
- Add regression tests for ordinary rebuild, forced recovery, and a
collision introduced after preflight.
- Verify collision failures do not detach providers or change policy,
agent adapter, or registry state.
- Document sandbox-scoped provider detach recovery and the destructive
scope of `credentials reset`.
- Record the completed documentation writer review: `docs-updated`, with
no actionable findings.
## Type of Change
- [ ] Code change (feature, bug fix, or refactor)
- [x] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Quality Gates
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: The implementation
review covered credential custody, attachment ownership, fail-closed
metadata errors, rollback boundaries, and secret handling. Regression
tests verify collision failures do not mutate managed MCP state.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:
## DGX Station Hardware Evidence
- [ ] Tested on DGX Station
- Tested commit:
- Station profile/scenario:
- Result:
- Supporting evidence:
## 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:
- `npx vitest run --project integration
test/mcp-destroy-lifecycle.test.ts
test/mcp-add-crash-consistency.test.ts
test/mcp-restart-policy-order.test.ts` — 62 tests passed.
- `npx vitest run --project cli
src/lib/actions/sandbox/mcp-bridge-provider.test.ts` — 18 tests passed.
- `npm run test:changed` — 572 tests and 22 growth checks passed.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [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)
- [ ] 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)
- Documentation validation: `npm run docs:sync-agent-variants` and `npm
run docs` passed. Fern reported 0 errors and 2 warnings.
---
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Prevented sandbox rebuilds, restarts, and provider additions when
attached providers have credential-key conflicts.
* Prevented partial changes to providers, policies, adapters, or
sandboxes while preserving conflicting provider attachments.
* Added consistent collision checks across standard, host-side, and
recovery flows.
* Updated recovery guidance to detach the conflicting provider before
retrying; credential resets warn that stored credentials and provider
access are removed globally.
* **Documentation**
* Documented credential-collision handling and recovery steps.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Co-authored-by: Senthil Ravichandran <senthilr@nvidia.com>
Copy file name to clipboardExpand all lines: docs/security/credential-storage.mdx
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,19 @@ Use this precedence to:
121
121
122
122
Managed MCP is an exception: `$$nemoclaw <name> mcp add` always creates and attaches an OpenShell provider, and `--env KEY` supplies only the transient input value.
123
123
For that credential boundary, refer to [About Managed MCP Servers](../manage-sandboxes/mcp-servers/about-managed-mcp-servers).
124
+
Before an ordinary live-sandbox rebuild or forced host-side recovery changes managed MCP state, NemoClaw compares the credential keys for every provider attached to the sandbox.
125
+
If another provider supplies a credential key that a managed MCP server reserves, rebuild stops before it changes the managed provider attachment, generated policy, or agent adapter.
126
+
The collision check does not delete either provider or its stored credential value.
127
+
Forced host-side recovery repeats the check before sandbox deletion.
128
+
Detach only the conflicting provider from the affected sandbox:
This command keeps the provider and stored credential in OpenShell and does not change its attachments to other sandboxes.
135
+
Rerun the original rebuild command.
136
+
Do not run `$$nemoclaw credentials reset <PROVIDER_NAME>` unless you intend to detach that provider from every sandbox and delete its stored credential from OpenShell.
124
137
125
138
When the host environment is empty, day-two operations such as `$$nemoclaw <name> rebuild` and remote-provider updates can reuse the credential already registered with the OpenShell gateway.
`Credential key '${credentialKey}' is already supplied by attached provider '${collision.name}' with ID '${collision.providerId??"missing"}'. Refusing to reserve the key for MCP before provider activation.`,
`Credential key '${credentialKey}' is already supplied by attached provider '${collision.name}' with ID '${collision.providerId??"missing"}'. Refusing to continue managed MCP while this sandbox receives that key from another provider.`,
`Could not retain the prior OpenShell credential revision for provider '${entry.providerName}'.`,
@@ -213,7 +217,13 @@ export async function restoreExistingMcpBridgeRuntime(
213
217
`OpenShell provider '${entry.providerName}' is missing. Runtime restoration refuses to create or rotate credentials; run explicit MCP restart after exporting '${entry.env[0]}'.`,
0 commit comments