fix(credentials): recover reset from attached-provider FailedPrecondition (#5560)#5573
Conversation
|
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 (2)
📝 WalkthroughWalkthroughThe credentials ChangesCredential Reset Recovery Flow
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8fef6cb to
0ddc062
Compare
…tion (NVIDIA#5560) `credentials reset <provider>` ran a raw `provider delete` and, when the provider was still attached to a sandbox, surfaced the OpenShell FailedPrecondition ("provider attached to sandbox(es): <name>") with no way forward. After onboarding Brave Search the provider is `<sandbox>-brave-search`, which is not a messaging bridge, so it fell straight through to that dead end: the only fix was destroying the sandbox. Route the delete through the existing deleteProviderWithRecovery helper, which detaches the listed sandboxes and retries the delete once (already used by the onboard provider-replace path). On residual failure, surface the still-attached sandboxes with a detach hint instead of the raw diagnostic. Extract formatResetOutcome so the success / still-attached / env-var-name-hint output is unit tested without the oclif command harness. Note: the upstream complaint that the Brave placeholder (openshell:resolve:env:v<id>_BRAVE_API_KEY) regenerates a new id on every read and never resolves is an OpenShell credential-resolver scoping issue and is out of scope here; this change only removes the NemoClaw-side reset dead end. Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
0ddc062 to
95fca32
Compare
…tion (NVIDIA#5560) (NVIDIA#5573) ## Summary `credentials reset <provider>` ran a raw `provider delete` and, when the provider was still attached to a sandbox, surfaced the OpenShell `FailedPrecondition: provider attached to sandbox(es): <name>` with no way forward. After onboarding Brave Search the provider is `<sandbox>-brave-search`, which is not a messaging bridge, so it fell straight through to that dead end and the only fix was destroying and recreating the sandbox. ## Related Issue Fixes NVIDIA#5560 ## Changes - Route the delete in `src/commands/credentials/reset.ts` through the existing `deleteProviderWithRecovery` helper, which detaches the listed sandboxes and retries the delete once (the same recovery path the onboard provider-replace flow already uses). - On residual failure, surface the still-attached sandboxes with a `openshell sandbox provider detach` hint instead of the raw diagnostic. - Extract `formatResetOutcome` so the success / still-attached / env-var-name-hint output is unit tested without the oclif command harness, and add `test/credentials-reset-outcome.test.ts`. Out of scope: the report also notes the Brave placeholder `openshell:resolve:env:v<id>_BRAVE_API_KEY` regenerates a new id on every read and never resolves. That scoping behavior lives in the OpenShell credential resolver (NemoClaw emits the unscoped placeholder), so it is better tracked there. This change removes the NemoClaw-side reset dead end so a stuck provider can be cleared without recreating the sandbox. ## Type of Change - [x] Code change (feature, bug fix, or refactor) ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [ ] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed Ran: `npx vitest run test/credentials-reset-outcome.test.ts test/sandbox-provider-cleanup.test.ts` (29 passed), `npm run build:cli`, and `biome check` on the touched files (clean). The full-suite `test-cli`/`test-plugin` commit and push hooks were skipped because they trip on a pre-existing collection error in `test/ssrf-parity.test.ts` (0 tests collected) that also fails on a clean `main` checkout and is unrelated to this change. CI runs the full gate. --- Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved error messaging and handling when resetting provider credentials. * Enhanced support for cases where a provider remains attached to sandboxes, including helpful recovery instructions. * Better input validation to detect when credential names appear to be environment variables rather than provider names. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
Summary
credentials reset <provider>ran a rawprovider deleteand, when the provider was still attached to a sandbox, surfaced the OpenShellFailedPrecondition: provider attached to sandbox(es): <name>with no way forward. After onboarding Brave Search the provider is<sandbox>-brave-search, which is not a messaging bridge, so it fell straight through to that dead end and the only fix was destroying and recreating the sandbox.Related Issue
Fixes #5560
Changes
src/commands/credentials/reset.tsthrough the existingdeleteProviderWithRecoveryhelper, which detaches the listed sandboxes and retries the delete once (the same recovery path the onboard provider-replace flow already uses).openshell sandbox provider detachhint instead of the raw diagnostic.formatResetOutcomeso the success / still-attached / env-var-name-hint output is unit tested without the oclif command harness, and addtest/credentials-reset-outcome.test.ts.Out of scope: the report also notes the Brave placeholder
openshell:resolve:env:v<id>_BRAVE_API_KEYregenerates a new id on every read and never resolves. That scoping behavior lives in the OpenShell credential resolver (NemoClaw emits the unscoped placeholder), so it is better tracked there. This change removes the NemoClaw-side reset dead end so a stuck provider can be cleared without recreating the sandbox.Type of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesRan:
npx vitest run test/credentials-reset-outcome.test.ts test/sandbox-provider-cleanup.test.ts(29 passed),npm run build:cli, andbiome checkon the touched files (clean). The full-suitetest-cli/test-plugincommit and push hooks were skipped because they trip on a pre-existing collection error intest/ssrf-parity.test.ts(0 tests collected) that also fails on a cleanmaincheckout and is unrelated to this change. CI runs the full gate.Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com
Summary by CodeRabbit
Release Notes