fix(cli): translate the shields exit sentinel into a clean exit code - #7421
Conversation
Refs #7382 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Dongni Yang <dongniy@nvidia.com>
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a shared ChangesDeferred shields exit handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in commit 2cc00f7 in the TypeScript / code-coverage/cliThe overall coverage in commit 2cc00f7 in the Show a code coverage summary of the most impacted files.
Updated |
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/cli/nemoclaw-oclif-command.test.ts`:
- Around line 140-153: Update the sentinel tests around
ShieldsSentinelCommand.run and DriftSentinelCommand.run to preserve and restore
the prior process.exitCode, and restore the console.error spy created by
vi.spyOn. Use try/finally blocks so both globals are restored even when
assertions or command execution fails.
In `@src/lib/shields/index.ts`:
- Around line 767-776: Update failShieldsCommand to always throw the
DeferredShieldsExit sentinel instead of terminating the process, preserving
deferred exit handling for shieldsStatus paths reached while
withSandboxMutationLock is held. Keep NemoClawCommand.catch responsible for
translating the sentinel into the exit code, and retain the existing message and
status code.
🪄 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: 0331785e-b729-4e98-a6a1-9544a55aca4f
📒 Files selected for processing (5)
src/commands/sandbox/oclif-command-adapters.test.tssrc/lib/cli/nemoclaw-oclif-command.test.tssrc/lib/cli/nemoclaw-oclif-command.tssrc/lib/shields/deferred-exit.tssrc/lib/shields/index.ts
| const { | ||
| DeferredShieldsExit, | ||
| }: typeof import("./deferred-exit") = require("./deferred-exit"); | ||
|
|
||
| function failShieldsCommand(message: string, _shouldThrow?: boolean): never { | ||
| // Never terminate while a transition-lock callback is active: process.exit | ||
| // skips finally blocks and would strand the canonical lock. Public command | ||
| // wrappers translate this sentinel only after the lock has been released. | ||
| // skips finally blocks and would strand the canonical lock. NemoClawCommand | ||
| // translates this sentinel into an exit code after the lock has been | ||
| // released (isDeferredShieldsExit in ./deferred-exit). | ||
| throw new DeferredShieldsExit(message, 1); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
ast-grep outline src/lib/shields/index.ts --items all
rg -n -A5 -B5 '\b(completeDeferredShieldsExit|failShieldsCommand)\s*\(|\bprocess\.exit\s*\(' src/lib/shields/index.ts
rg -n -A3 -B3 '\bcompleteDeferredShieldsExit\s*\(' srcRepository: NVIDIA/NemoClaw
Length of output: 18549
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## completeDeferredShieldsExit callers\n'
rg -n -A4 -B4 '\bcompleteDeferredShieldsExit\s*\(' src
printf '\n## DeferredShieldsExit handling and sentinel translation\n'
rg -n -A4 -B4 '\bDeferredShieldsExit\b|\bisDeferredShieldsExit\b|catch\s*\(' src/commands src/lib | sed -n '1,260p'
printf '\n## shields command entrypoints\n'
rg -n -A4 -B4 '\bshields(Status|Up|Down)\s*\(' src/commands src/lib | sed -n '1,260p'Repository: NVIDIA/NemoClaw
Length of output: 35837
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## command files mentioning shields\n'
git ls-files 'src/commands/**/*.ts' 'src/lib/**/*.ts' | rg 'shields|NemoClawCommand|deferred-exit|command'Repository: NVIDIA/NemoClaw
Length of output: 6723
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## withSandboxMutationLock\n'
rg -n -A8 -B8 '\bwithSandboxMutationLock\s*\(' src/lib src/commands | sed -n '1,220p'
printf '\n## NemoClawCommand catch/fail path\n'
rg -n -A10 -B10 '\bclass NemoClawCommand\b|\bcatch\(' src/lib/cli/nemoclaw-oclif-command.ts src/commands/root/*.ts src/commands/sandbox/shields/*.ts | sed -n '1,260p'
printf '\n## shields status command implementation\n'
cat -n src/commands/sandbox/shields/status.tsRepository: NVIDIA/NemoClaw
Length of output: 20815
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## shields deferred-exit module\n'
cat -n src/lib/shields/deferred-exit.tsRepository: NVIDIA/NemoClaw
Length of output: 1771
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## shieldsStatus implementation\n'
sed -n '3315,3340p' src/lib/shields/index.ts
printf '\n## failShieldsCommand usage inside shields module\n'
rg -n -A2 -B2 '\bfailShieldsCommand\s*\(' src/lib/shields/index.ts
printf '\n## DeferredShieldsExit usage in shields module\n'
rg -n -A2 -B2 '\bDeferredShieldsExit\b|\bisDeferredShieldsExit\b' src/lib/shields/index.ts src/lib/shields/*.tsRepository: NVIDIA/NemoClaw
Length of output: 10316
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## withSandboxMutationLock implementation\n'
rg -n -A80 -B10 '\bfunction withSandboxMutationLock\b|\basync function withSandboxMutationLock\b' src/lib/state/mcp-lifecycle-lock.ts src/lib/state/*.ts src/lib/**/*.ts | sed -n '1,220p'
printf '\n## shields command tests around DeferredShieldsExit and locks\n'
rg -n -A6 -B6 'DeferredShieldsExit|process\.exit|setExitCode|withSandboxMutationLock\(' src/lib/shields/*.test.ts src/commands/sandbox/shields/*.ts | sed -n '1,260p'Repository: NVIDIA/NemoClaw
Length of output: 196
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat -n src/lib/state/mcp-lifecycle-lock.tsRepository: NVIDIA/NemoClaw
Length of output: 895
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,260p' src/lib/state/mcp-lifecycle-lock-acquisition.tsRepository: NVIDIA/NemoClaw
Length of output: 8937
Keep shields exits deferred through the CLI src/lib/shields/index.ts:779-783 — shieldsStatus() can reach this path while withSandboxMutationLock() is still held, so process.exit() here can skip lock cleanup. Re-throw the sentinel for CLI callers and let NemoClawCommand.catch set the exit code.
🤖 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/shields/index.ts` around lines 767 - 776, Update failShieldsCommand
to always throw the DeferredShieldsExit sentinel instead of terminating the
process, preserving deferred exit handling for shieldsStatus paths reached while
withSandboxMutationLock is held. Keep NemoClawCommand.catch responsible for
translating the sentinel into the exit code, and retain the existing message and
status code.
Source: Path instructions
There was a problem hiding this comment.
Agreed this path is real, but it predates this PR and is deliberately out of scope here: this change moves the sentinel class to a leaf module and adds the missing CLI translation without touching completeDeferredShieldsExit or any transition semantics. The shieldsStatus in-lock process.exit strands the MCP lifecycle lock only until the stale-lock self-heal reclaims it, and rerouting status's exit path through the sentinel changes behavior for non-oclif callers — that deserves its own reviewed change rather than riding a targeted traceback fix for #7382. Happy to file it as a follow-up issue.
There was a problem hiding this comment.
@Dongni-Yang, agreed. This is a valid follow-up concern, but it should not expand this focused #7382 traceback fix or alter non-oclif behavior incidentally.
Would you like me to open a GitHub follow-up issue for the shieldsStatus() deferred-exit/lock-cleanup path, assigned to you?
✏️ Learnings added
Learnt from: Dongni-Yang
Repo: NVIDIA/NemoClaw PR: 7421
File: src/lib/shields/index.ts:0-0
Timestamp: 2026-07-23T04:21:12.671Z
Learning: In `src/lib/shields/index.ts`, `shieldsStatus()` can call `completeDeferredShieldsExit()` while a shields mutation lock is active. The resulting `process.exit()` can strand the lock until stale-lock self-healing reclaims it. Routing this through `NemoClawCommand.catch` would change behavior for non-oclif callers, so it requires a separately reviewed follow-up rather than being folded into targeted CLI traceback fixes.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: 1 optional E2E recommendation
This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
Refs #7382 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Dongni Yang <dongniy@nvidia.com>
…nt on shields lock (#7467) ## Summary `nemoclaw <sandbox> shields up` / `shields down` destroy the sandbox's OpenClaw config when `/sandbox/.openclaw/.config-hash` is missing — the second defect in #7382 (the raw-traceback defect was fixed separately in #7421). On lock-from-mutable, `_snapshot_raw_pair` requires both `openclaw.json` and `.config-hash`, so a missing hash stat-fails three times; `_force_fail_closed_lock` then fails the same pair capture (`targets=None`) and severs `openclaw.json` by renaming it to `.nemoclaw-rejected-openclaw.json-<32 hex>`, and the subsequent rollback re-lock fails on the now-absent config — the exact `CRITICAL: OpenClaw lock rollback could not restore the trusted posture … [stat-failed] … after 3 pair attempts` cascade from the issue. The sandbox is then unrecoverable without `rebuild --yes` (the bytes survive under the quarantine name, but nothing reports that name). This is inconsistent by design: on lock-from-mutable the guard never trusts on-disk `.config-hash` *content* — `_canonical_targets` regenerates it as `sha256(openclaw.json)` from the captured config bytes, so a hash full of garbage locks cleanly today. In mutable posture the sandbox owns both files, so *absence* carries strictly less signal than tolerated garbage, yet only absence triggered the destructive sever. ## Fix `scripts/openclaw-config-guard.py`: - **`_repair_absent_hash_for_lock`** — on lock-from-mutable, after `_freeze` (tree root:root 0700, inside the exclusive flock mutation mutex) and journal settlement, a truly absent `.config-hash` is synthesized from the captured `openclaw.json` bytes via the existing `_force_replace_bytes` primitive (fresh `O_EXCL|O_NOFOLLOW` inode, root:root 0444). Repair fires only on true `ENOENT` (`follow_symlinks=False`): a planted symlink, directory, fifo, or hardlink at the name is seen as existing and falls through to today's fail-closed rejections. Directory posture is re-verified before the repair. No trust expansion: the sealed content is byte-identical to what any mutable→lock already produces via `_canonical_targets`; only the co-file's existence changes. Lock-from-locked and unlock stay fail-stop, and both-files-absent stays fail-closed (characterization-tested). - **Non-destructive fail-closed containment** — when `_force_fail_closed_lock` cannot capture the pair, it now first attempts a config-only fresh publish (`_snapshot_file` + `_force_replace_bytes` for both names + `_snapshot_pair` verification) and reserves the rename-sever for the truly-uncapturable case. Note the publish must use `_force_replace_bytes`, not `_install_stored_pair` — the latter begins with `_snapshot_raw_pair` and re-raises on the absent hash. - **Sever reporting** — every quarantine rename now appends `<name>: quarantined as <rejected>` to the existing `; fail-closed issues: ` detail channel, so operators can recover the preserved bytes instead of rebuilding blind. - **Observability** — a synthesized hash is recorded as an optional `"hashSynthesized": true` key on the ok result record, so silent self-repair is visible in the guard protocol. Unknown result keys are ignored by the known-key validator in older CLIs, so this is skew-safe in both directions. `src/lib/shields/openclaw-config-lock.ts`: - The inline printable-ASCII filter used for schema issue paths is extracted into `printableExcerpt()` and now also applied to guard issue `code`/`path`/`detail` before they are embedded in user-facing error strings (caps 64/256/2048) — defense in depth, since this change routes quarantine filenames and more exception text through `detail`. - `hashSynthesized` is validated and propagated on `OpenClawConfigGuardResult`. ## Rollout The container-baked helper (`/usr/local/lib/nemoclaw/openclaw-config-guard.py`) wins the capability probe, so the fix reaches new, rebuilt, and upgraded sandboxes; existing running sandboxes keep the old helper until rebuild. Docs now state the recovery ordering (upgrade CLI first, then rebuild — rebuilding with an old CLI restages the old guard) and the quarantine-name recovery path: - `docs/reference/troubleshooting.mdx` — new entry for the missing-hash / quarantined-config case - `docs/inference/set-up-sub-agent.mdx` — the documented hand-edit workflow is exactly how users lose `.config-hash` - `docs/manage-sandboxes/recover-rebuild-sandboxes.mdx` — quarantine recovery guidance No changelog entry here: per `docs/CONTRIBUTING.md` the dated changelog file is created by the pre-tag release-note PR. ## Scope boundary The repair is deliberately wired into lock-from-mutable only. On lock-from-locked and unlock, the hash is the tamper-evidence seal of a root-sealed tree and its absence *is* a signal, so those paths stay fail-stop — pinned by characterization tests, and the docs state the asymmetry explicitly (`shields down` does not synthesize; run `shields up` or regenerate the hash first). ## Tests New `test/openclaw-config-guard-absent-hash.test.ts` (real-python3 harness, self-contained shim; the existing guard test file is at 1491/1500 lines of its budget): - mutable + absent hash → lock succeeds, config preserved 0444, hash re-created with the correct sha256 record, `hashSynthesized: true`, no quarantine artifacts (fails at HEAD with the exact issue signature) - idempotent relock after a synthesized-hash lock: inode-stable, no `hashSynthesized` - pristine lock → no `hashSynthesized` marker - both-absent → still fail-closed `stat-failed`, nothing severed (characterization; passes before and after) - planted symlink at `.config-hash` → repair refuses (lstat sees it as existing), lock fails closed `unsafe-config-file`, containment republishes a fresh regular pair, config bytes preserved - **dangling** symlink at `.config-hash` → same fail-closed outcome (regression test for a `follow_symlinks` bug caught by adversarial review during development: a follow-`stat` probe treated a dangling symlink as truly absent and repaired it) - unlock with absent hash → fail-closed `stat-failed`, nothing severed (pins the lock-only asymmetry) - locked-posture relock with the hash removed → fail-closed `stat-failed`, no repair, nothing severed - hash vanishes mid-transition (fault hook) → config-only publish preserves `openclaw.json` through the failed lock (fails at HEAD: config was severed) - forced last-resort sever → `quarantined as .nemoclaw-rejected-…` reported and the quarantine copy holds the original bytes (fails at HEAD: no reporting) `src/lib/shields/openclaw-config-lock.test.ts`: sanitizer strips non-printables and caps oversized issue text; `hashSynthesized` propagates on ok results and stays absent otherwise. All new behavior tests fail at HEAD and pass with the fix. Shields suite 253/253, `tsc` and Biome clean; the 16 restart-seal tests in the pre-existing guard suite fail identically at HEAD and with this change on hosts where `node_modules/json5` is not root-owned (local-env limitation, unrelated paths). Closes #7382 Signed-off-by: Dongni Yang <dongniy@nvidia.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Expanded guidance on refreshing/regenerating the configuration integrity record after manual config edits. - Added recovery workflows for missing integrity records, failed shield transitions, and sandbox rebuilds, including quarantine/upgrade steps. - **Bug Fixes** - Improved lock recovery when the integrity record is absent by safely regenerating it from the current config. - Strengthened fail-closed behavior and improved diagnostics by sanitizing and truncating unsafe/overly verbose issue details. - **New Features** - Exposes whether integrity record synthesis occurred via an optional result marker. - **Tests** - Added coverage for missing-record and transition failure scenarios, including quarantine handling and permission/idempotency guarantees. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Dongni Yang <dongniy@nvidia.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Julie Yaunches <jyaunches@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary Add the canonical `docs/changelog/2026-07-25.mdx` release entry with the exact `## v0.0.96` heading. The entry reconciles all 90 first-parent commits since v0.0.95 with all 92 merged PRs in the live `v0.0.96` label ledger and groups the user-visible changes by operator journey. ## Changes - Add the parser-safe dated MDX changelog entry for v0.0.96 with root-absolute links to the focused user guides. - Source summary: - [#7194](#7194) -> `docs/changelog/2026-07-25.mdx`: Document persistent baseline network policy exclusions and their inspection, rebuild, and snapshot behavior. - [#7188](#7188), [#7427](#7427), and [#7546](#7546) -> `docs/changelog/2026-07-25.mdx`: Document DNS-backed HTTPS inference routing, keyless loopback endpoints, and provider-marker isolation. - [#7238](#7238) -> `docs/changelog/2026-07-25.mdx`: Document blueprint sandbox and provider identifier validation before state writes or OpenShell calls, with bounded terminal-safe rejection previews. - [#7319](#7319), [#7274](#7274), [#7528](#7528), [#7353](#7353), and [#7560](#7560) -> `docs/changelog/2026-07-25.mdx`: Document the managed default gateway service, onboarding readiness, and container-runtime identity safeguards. - [#7349](#7349), [#7498](#7498), [#7406](#7406), [#7196](#7196), [#7559](#7559), [#7421](#7421), [#7510](#7510), [#7295](#7295), and [#7565](#7565) -> `docs/changelog/2026-07-25.mdx`: Document gateway-scoped status, lifecycle diagnostics, managed MCP recovery, delete-edge safeguards, and fail-closed CLI prompt and command output. - [#7591](#7591) -> `docs/changelog/2026-07-25.mdx`: Document opt-in authenticated MCP tool-name discovery, its bounded and names-only contract, probe interaction, and rebuild requirement. - [#7305](#7305), [#7480](#7480), [#7471](#7471), [#7365](#7365), and [#7541](#7541) -> `docs/changelog/2026-07-25.mdx`: Document installer version checks, version-tag reporting, license guidance, WSL Ollama selection, and DGX Station vLLM detection. - [#7482](#7482), [#7466](#7466), [#7208](#7208), [#7434](#7434), and [#7586](#7586) -> `docs/changelog/2026-07-25.mdx`: Document Ollama resource details, reasoning precedence, Hermes onboarding behavior, and preserved managed Hermes BuildKit failures. - [#6830](#6830), [#7492](#7492), [#7563](#7563), and [#7582](#7582) -> `docs/changelog/2026-07-25.mdx`: Document the authoritative OpenClaw production lock, fixed managed-image dependencies, immutable Hermes base adoption, and Hermes image-size reduction. - [#7505](#7505), [#7530](#7530), [#7547](#7547), [#7508](#7508), [#7548](#7548), [#7549](#7549), [#7537](#7537), [#7534](#7534), [#7515](#7515), [#7511](#7511), [#7551](#7551), [#7562](#7562), [#7575](#7575), [#7496](#7496), [#7594](#7594), [#7595](#7595), and [#7599](#7599) -> `docs/changelog/2026-07-25.mdx`: Summarize release validation, transient and bounded dispatch reconciliation, exact pre-tag qualification, identity revalidation, npm-audit retry, sharding, image reuse, timeout, telemetry, and workflow-hardening changes. - Reconciled without separate changelog prose: - [#7539](#7539), [#7526](#7526), [#7507](#7507), [#7506](#7506), [#7519](#7519), [#7516](#7516), [#7396](#7396), [#7254](#7254), [#7583](#7583), [#7596](#7596), and [#7598](#7598): Test-harness or fixture-only changes. - [#7403](#7403), [#7161](#7161), [#6877](#6877), [#7531](#7531), [#7525](#7525), [#7522](#7522), [#7536](#7536), [#7552](#7552), [#7566](#7566), [#7553](#7553), [#7561](#7561), [#7577](#7577), [#7569](#7569), [#7585](#7585), [#7584](#7584), [#7592](#7592), [#7580](#7580), [#7571](#7571), [#7517](#7517), [#7589](#7589), [#7402](#7402), [#7558](#7558), [#7544](#7544), and [#7601](#7601): Dependency, internal recovery, validation, contributor-workflow, E2E optimization, telemetry, or CI trust changes with no separate user-facing release claim. - [#7556](#7556), [#7573](#7573), [#7576](#7576), and [#7578](#7578): Experimental repository-maintainer conflict automation with no canonical user documentation surface. ## 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 - [x] Existing tests cover changed behavior — justification: `test/changelog-docs.test.ts` validates dated changelog structure, version headings, and published links. - [ ] Tests not applicable — justification: - [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: ## Documentation Writer Review - [x] Documentation writer subagent reviewed the completed changes - Result: `docs-updated` - Evidence: Reviewed `docs/changelog/2026-07-25.mdx` at exact head `0f5dedb47` against 90 first-parent release commits and 92 merged PRs labeled `v0.0.96`. Verified parser-safe MDX SPDX, the exact version heading, literal CLI names, writing style, skip terms, all 20 root-absolute published links, and the accepted #7591 opt-in authenticated discovery bounds. #7544, #7599, and #7601 remain internal or CI-only release-ledger entries. Changelog tests passed 6/6, the docs build passed with 0 errors and two pre-existing Fern warnings, and `npm run check:diff` plus the final diff check passed. - Agent: Codex Desktop documentation-writer subagent <!-- docs-review-head-sha: 0f5dedb --> <!-- docs-review-agents-blob-sha: be20a09 --> ## 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 check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `npx vitest run test/changelog-docs.test.ts`: 6/6 passed. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: Not applicable to this prose-only changelog entry. - [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) — the build passed with 0 errors and 2 existing Fern warnings; the published-route check passed. - [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) — native changelog files use the required parser-safe MDX SPDX comment and no frontmatter. --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Persistent network policy exclusions with consistent restore/exclusion reporting across rebuilds/snapshots. * Opt-in MCP tool discovery via `mcp status --tools` with bounded, redacted authenticated traffic. * Improved HTTPS inference switching for custom endpoints and refreshed onboarding/model menu details. * Refined OpenShell gateway defaults for port `8080`, including more reliable readiness checks. * **Bug Fixes** * Prevent incorrect provider/model restoration after compatible-provider update failures. * Preserve managed MCP state after exec loss and tighten gateway/doctor status scoping. * **Tests** * Stronger, fail-closed release validation with hardened evidence/artifact handoff and bounded timeouts/retries. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Summary
nemoclaw <sandbox> shields up/shields downcrash with a raw Node traceback (unhandledDeferredShieldsExit) whenever a shields transition fails — the first symptom in #7382.The shields library deliberately throws a
DeferredShieldsExitsentinel instead of callingprocess.exitinside a transition-lock callback (an exit there would strand the canonical lock), with the stated contract that "public command wrappers translate this sentinel only after the lock has been released." That translation was never implemented: the shields commands passthrowOnError: true,NemoClawCommandhas nocatchoverride, the public-grammar dispatcher rethrows errors without anoclif.exit, and the CLI entry promise has no.catch— so the sentinel reaches Node's unhandled-rejection handler and prints a raw stack.Fix
src/lib/shields/deferred-exit.tsholding theDeferredShieldsExitclass and a name-keyedisDeferredShieldsExitguard (name-keyed so dist/src dual-loads still match; leaf so the CLI base command doesn't load the shields coordinator, and tests that mocklib/shieldskeep the real guard).NemoClawCommand.catchoverride: a sentinel becomessetExitCode(error.exitCode)with no reprint (every throw site already printed its failure lines viaconsole.error); everything else delegates to oclif's default handler unchanged.Because oclif's
Command._runresolves whencatch()returns, the rejection never reaches the entry promise — on both the public-grammar and native dispatch routes. The base-class placement also fixes the same latent crash viasandbox destroy(wipeAndHardenLiveSandbox) and snapshot restore (deleteSandboxForRestore), which callshieldsUp(..., { throwOnError: true })with no catch.Behavior after the fix, on the #7382 repro: the existing error lines (
CRITICAL: OpenClaw lock rollback ...,Recovery: ...) print exactly as today, followed by a clean exit 1 — no traceback.This PR does not change any transition/rollback semantics. The second #7382 defect (the failed rollback quarantining
openclaw.jsonwhen.config-hashis missing) is a separate guard-side fix pending maintainer design review on the issue.Tests
src/lib/cli/nemoclaw-oclif-command.test.ts: sentinel → resolves +process.exitCode === 1+ no reprint; code-2 sentinel fidelity; non-sentinel errors still reject through the default handler.src/commands/sandbox/oclif-command-adapters.test.ts:ShieldsUpCommand/ShieldsDownCommandwith the shields mock throwing the sentinel → clean exit code, no traceback, no reprint.All new tests fail at HEAD and pass with the fix.
Fixes the traceback symptom of #7382 (Refs #7382 — the config-quarantine defect remains open there).
Signed-off-by: Dongni Yang dongniy@nvidia.com
🤖 Generated with Claude Code
Summary by CodeRabbit