refactor(shields): isolate mutable config repair - #6136
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com> (cherry picked from commit 717d6ef)
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughExtracts mutable OpenClaw config normalization into ChangesMutable Config Normalization Extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Target RecommendationRequired E2E targets: Dispatch required E2E targets:
Full E2E target advisor summaryE2E Target AdvisorBase: Required E2E targets
Optional E2E targets
Relevant changed files
|
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
PR Review Advisor — No blocking findingsMerge posture: No blocking advisor findings Action checklist
Test follow-ups to resolve or justifyIf these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.
This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision. |
PR Review Advisor (Nemotron Ultra) — No blocking findingsMerge posture: No blocking advisor findings Action checklist
Findings index
Review findings by urgency: 0 required fixes, 0 items to resolve/justify, 2 in-scope improvements
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Vitest E2E Target Results — ✅ All requested jobs passedRun: 28542337844
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
Maintainer follow-up on exact head a32d292:
Validation: full pre-commit CLI/integration coverage and pre-push CLI typecheck passed; focused behavior tests passed 49/49; security call-chain tests passed 63/63; Biome and git diff checks passed. Independent runtime probes confirmed the process group is gone before the outer timeout. Commit a32d292 is signed, DCO-signed-off, and GitHub Verified. @coderabbitai review |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd . src/lib/shields -e ts | head -50
echo "---mutable-config-repair.ts---"
cat -n src/lib/shields/mutable-config-repair.ts 2>/dev/null || true
echo "---exec.ts relevant excerpt---"
rg -n "timeout|TERM|KILL|watchdog" src/lib/actions/sandbox/exec.ts 2>/dev/null || true
echo "---normalize_mutable_config_perms.py---"
cat -n scripts/lib/normalize_mutable_config_perms.py 2>/dev/null || trueLength of output: 62936
Everything checks out against the description. I'll kick off a fresh review pass on this head now. ✅ Action performedReview finished.
|
Vitest E2E Target Results — ✅ All requested jobs passedRun: 28549995589
|
|
Advisor follow-up disposition for exact head a32d292:
Both advisors now recommend merge_as_is with zero required findings and zero warnings. CodeRabbit is green with no review threads; all latest exact-head check runs are passing. The only remaining branch-protection gate is the requested human approval. |
<!-- markdownlint-disable MD041 --> ## Summary This follow-up extracts the direct mutable OpenClaw repair invocation from the oversized shields module after NVIDIA#6060 merged. It preserves the trusted-helper command, identity validation, timeouts, and runtime behavior while documenting the existing cross-process lock and first-start recovery-baseline semantics requested by automated review. ## Related Issue Follow-up to NVIDIA#6060 and NVIDIA#6047. ## Changes - Move sandbox UID/GID lookup and the trusted mutable-config normalizer invocation into `src/lib/shields/mutable-config-repair.ts`. - Keep runtime dependency lookup compatible with the existing Vitest spies and module cache behavior. - Document why the timer-bound host lock is the correct cross-process serialization boundary for post-`exec` repair. - Document why a missing recovery baseline is expected and intentionally quiet before the first successful post-override capture. - Pin the extracted privilege boundary with focused tests for sanitized UID/GID probes, exact normalizer argv, invalid identity short-circuiting, and Docker execution failures. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] 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 - [x] Existing tests cover changed behavior — justification: the existing shields-transition, mutable-permission, and post-`exec` cleanup suites exercise the unchanged public path, identity validation, and trusted-helper invocation. - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: this is a behavior-preserving extraction plus implementation comments; the NVIDIA#6060 command and troubleshooting docs remain accurate. - [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: independent read-only review found no security or correctness blocker; helper path, argv, timeout, UID/GID validation, cross-process transition lock, and fail-closed behavior are unchanged from merged NVIDIA#6060. - [ ] 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 - [x] 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) - [ ] 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) ### Evidence - `npx prek run --from-ref origin/main --to-ref HEAD` passed under the repository-required `umask 022`, including the full CLI/integration coverage hook. - The normal push hook passed CLI type-checking and version synchronization. - Focused shields-transition, mutable-config-permission, extracted-repair, and post-`exec` cleanup tests passed 49/49; CLI type-checking, Biome, Python parsing, test-title style, file-size budget, and `git diff --check` passed. - The extracted-repair tests prove `stdin=false` and `sanitizeEnvironment=true` on every privileged call, reject invalid UID/GID values before normalization, assert forwarded Docker argv/options, and propagate normalizer execution failures. - The documentation-writer audit found no doc change necessary; `npm run docs` completed with 0 errors and 2 pre-existing warnings. --- Signed-off-by: Carlos Villela <cvillela@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved mutable configuration-permission repair to run the normalization step inside a privileged sandbox, including sandbox identity discovery and validation (UID/GID) before changes are applied. - Added a time-bound execution wrapper around the normalization command to prevent long-running operations. - **Refactor** - Moved the mutable-config permission normalization into a dedicated, reusable module invoked by the existing repair workflow. - **Tests** - Added coverage for identity validation failures, error propagation, and the exact privileged command invocation sequence. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
This follow-up extracts the direct mutable OpenClaw repair invocation from the oversized shields module after #6060 merged. It preserves the trusted-helper command, identity validation, timeouts, and runtime behavior while documenting the existing cross-process lock and first-start recovery-baseline semantics requested by automated review.
Related Issue
Follow-up to #6060 and #6047.
Changes
src/lib/shields/mutable-config-repair.ts.execrepair.Type of Change
Quality Gates
execcleanup suites exercise the unchanged public path, identity validation, and trusted-helper invocation.Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Evidence
npx prek run --from-ref origin/main --to-ref HEADpassed under the repository-requiredumask 022, including the full CLI/integration coverage hook.execcleanup tests passed 49/49; CLI type-checking, Biome, Python parsing, test-title style, file-size budget, andgit diff --checkpassed.stdin=falseandsanitizeEnvironment=trueon every privileged call, reject invalid UID/GID values before normalization, assert forwarded Docker argv/options, and propagate normalizer execution failures.npm run docscompleted with 0 errors and 2 pre-existing warnings.Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit