Skip to content

fix(cli): translate the shields exit sentinel into a clean exit code - #7421

Merged
cv merged 4 commits into
mainfrom
fix/7382-shields-sentinel-exit
Jul 26, 2026
Merged

cv merged 4 commits into
mainfrom
fix/7382-shields-sentinel-exit

Conversation

@Dongni-Yang

@Dongni-Yang Dongni-Yang commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

nemoclaw <sandbox> shields up / shields down crash with a raw Node traceback (unhandled DeferredShieldsExit) whenever a shields transition fails — the first symptom in #7382.

The shields library deliberately throws a DeferredShieldsExit sentinel instead of calling process.exit inside 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 pass throwOnError: true, NemoClawCommand has no catch override, the public-grammar dispatcher rethrows errors without an oclif.exit, and the CLI entry promise has no .catch — so the sentinel reaches Node's unhandled-rejection handler and prints a raw stack.

Fix

  • New leaf module src/lib/shields/deferred-exit.ts holding the DeferredShieldsExit class and a name-keyed isDeferredShieldsExit guard (name-keyed so dist/src dual-loads still match; leaf so the CLI base command doesn't load the shields coordinator, and tests that mock lib/shields keep the real guard).
  • NemoClawCommand.catch override: a sentinel becomes setExitCode(error.exitCode) with no reprint (every throw site already printed its failure lines via console.error); everything else delegates to oclif's default handler unchanged.

Because oclif's Command._run resolves when catch() 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 via sandbox destroy (wipeAndHardenLiveSandbox) and snapshot restore (deleteSandboxForRestore), which call shieldsUp(..., { 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.json when .config-hash is 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/ShieldsDownCommand with 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

  • Bug Fixes
    • Improved shields-related CLI failure handling by translating deferred shields exit signals into the correct oclif exit codes.
    • Suppressed unnecessary error tracebacks and stderr output for these shields-related failures.
    • Preserved existing default error handling for non-shields failures.
  • Tests
    • Added coverage validating shields sentinel exit codes, ensuring stderr suppression, correct exitCode propagation, and expected behavior for non-sentinel errors.

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>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6a852f07-af47-4c52-b6a0-3e3685a3ff99

📥 Commits

Reviewing files that changed from the base of the PR and between 9187ee2 and dea8386.

📒 Files selected for processing (1)
  • src/commands/sandbox/oclif-command-adapters.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/commands/sandbox/oclif-command-adapters.test.ts

📝 Walkthrough

Walkthrough

Adds a shared DeferredShieldsExit sentinel, translates it in NemoClawCommand.catch, preserves normal error handling, and adds coverage for shields adapters and exit-code behavior.

Changes

Deferred shields exit handling

Layer / File(s) Summary
Exit sentinel and shields wiring
src/lib/shields/deferred-exit.ts, src/lib/shields/index.ts
Defines the shared sentinel error and shape-based type guard, then imports the sentinel into shields command handling.
Command-level exit translation
src/lib/cli/nemoclaw-oclif-command.ts
Maps deferred shields exits to process.exitCode and delegates other errors to oclif’s default handler.
Exit behavior tests
src/lib/cli/nemoclaw-oclif-command.test.ts, src/commands/sandbox/oclif-command-adapters.test.ts
Covers sentinel exit codes, suppressed stderr output, adapter behavior, and regular failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#7395 — Also translates DeferredShieldsExit into process.exitCode in shields command flows.

Suggested labels: integration: openclaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: converting the shields exit sentinel into a clean exit code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/7382-shields-sentinel-exit

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 2cc00f7 in the fix/7382-shields-sen... branch remains at 96%, unchanged from commit ccf3dd4 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 2cc00f7 in the fix/7382-shields-sen... branch remains at 80%, unchanged from commit ccf3dd4 in the main branch.

Show a code coverage summary of the most impacted files.
File main ccf3dd4 fix/7382-shields-sen... 2cc00f7 +/-
src/lib/shields/index.ts 72% 71% -1%
src/lib/cli/nem...clif-command.ts 100% 100% 0%
src/lib/messagi...nnels/policy.ts 100% 100% 0%
src/lib/sandbox...rce-identity.ts 87% 87% 0%
src/lib/securit...ntial-filter.ts 93% 93% 0%
src/lib/platform.ts 84% 89% +5%
src/lib/onboard...ndbox-create.ts 83% 91% +8%
src/lib/onboard...-create-plan.ts 75% 88% +13%
src/lib/onboard...ndbox-create.ts 33% 83% +50%
src/lib/shields...eferred-exit.ts 0% 100% +100%

Updated July 24, 2026 05:59 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d13e34a and 7e1262e.

📒 Files selected for processing (5)
  • src/commands/sandbox/oclif-command-adapters.test.ts
  • src/lib/cli/nemoclaw-oclif-command.test.ts
  • src/lib/cli/nemoclaw-oclif-command.ts
  • src/lib/shields/deferred-exit.ts
  • src/lib/shields/index.ts

Comment thread src/lib/cli/nemoclaw-oclif-command.test.ts
Comment thread src/lib/shields/index.ts Outdated
Comment on lines 767 to 776
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);

@coderabbitai coderabbitai Bot Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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*\(' src

Repository: 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.ts

Repository: 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.ts

Repository: 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/*.ts

Repository: 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.ts

Repository: NVIDIA/NemoClaw

Length of output: 895


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,260p' src/lib/state/mcp-lifecycle-lock-acquisition.ts

Repository: 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 2 warnings · 1 suggestion
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 2 more warnings, 1 more suggestion.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: credential-sanitization, security-posture

1 optional E2E recommendation
  • shields-config

Workflow run details

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>
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression labels Jul 23, 2026
jyaunches added a commit that referenced this pull request Jul 24, 2026
…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>
@cv
cv merged commit 1895f14 into main Jul 26, 2026
54 checks passed
@cv
cv deleted the fix/7382-shields-sentinel-exit branch July 26, 2026 01:26
@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
12 of 23 tasks
apurvvkumaria pushed a commit that referenced this pull request Jul 27, 2026
<!-- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants