fix(rebuild): name the shields-down step before the post-rebuild mcp restart - #10886
fix(rebuild): name the shields-down step before the post-rebuild mcp restart#10886Dreamstick9 wants to merge 1 commit into
Conversation
…restart When a rebuild starts with shields up, it relocks them before it reports an incomplete managed MCP restoration, then tells the user to run `mcp restart`. The Hermes and OpenClaw MCP adapters refuse that restart while shields are up, so the printed recovery step could not run as written (NVIDIA#10751). The same gap existed in the Hermes rebuild recovery and managed MCP docs. Pass the pre-rebuild shields posture into the post-restore phase and, when the rebuild restores lockdown for a Hermes or OpenClaw sandbox, print the `shields down --timeout 15m --reason "MCP maintenance"` step before the `mcp restart` guidance and the `shields up` step after it. Deep Agents keeps the single-line guidance because its adapter does not check shields. The rebuild and managed MCP docs now state the same precondition. Fixes NVIDIA#10751 Signed-off-by: Kushagar Garg <dreamstick909@gmail.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 (8)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. 📝 WalkthroughWalkthroughThe rebuild pipeline now tracks the pre-rebuild shield state. Hermes and OpenClaw MCP recovery output includes shield-down and shield-up commands when required. Tests and sandbox documentation cover the updated recovery flow. ChangesMCP shield recovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR updates rebuild recovery instructions to place shield changes around managed MCP restart while preserving existing enforcement. The change is localized and merge-ready after normal checks, with no actionable merge-blocking risk remaining. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes address issue Full details: Out of Scope Changes checkExplanation The changes remain within the rebuild MCP recovery scope. OpenClaw coverage extends the same recovery behavior, Deep Agents behavior remains unchanged, and the documentation and tests support the stated objective. Full details: Docstring CoverageExplanation Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
PR Review Advisor finished for commit |
|
PR #10722 removed Shields from the core. Thus this pull request is not necessary. Thank you for the review. The approval came approximately 85 minutes before the merge of PR #10722. PR #10722 made this pull request out of date. The review is not the cause. This pull request adds a shields-down step before the |
Outcome
Before: a rebuild that started with shields up relocked them, then told the user to run
nemoclaw <sandbox> mcp restartfor an incomplete managed MCP restoration, and that command refused withhas shields up or an unreadable shields posture.After: the same guidance names
shields down --timeout 15m --reason "MCP maintenance"before the restart andshields upafter it for Hermes and OpenClaw sandboxes, and the Hermes rebuild recovery and managed MCP docs state the same precondition.Reason
Issue #10751 reports that rebuild re-locks shields and leaves the documented
mcp restartrecovery step unable to run.The refusal is the documented contract for
mcp add,mcp restart, andmcp remove, and the relock restores the pre-rebuild posture.The defect is the guidance: rebuild and two docs pages prescribe
mcp restartwithout its shields precondition, so the issue's second expected result applies (the tool tells the user that a shields-down step is needed first).Related issues
Fixes #10751
Changes
src/lib/actions/sandbox/rebuild-mcp-phase.ts:printMcpRestoreRecoverytakesmcpRestartNeedsShieldsDownand prints the shields-down and shields-up steps after the existingmcp restartline.src/lib/actions/sandbox/rebuild-post-restore-phase.ts: new inputshieldsUpBeforeRebuild;mcpRestartNeedsShieldsDownis true for Hermes and OpenClaw targets, whosehermes-configandmcporteradapters refuse config mutation while shields are up, and false for Deep Agents, whose adapter does not check shields. All three guidance call sites pass it, including the Hermes cron-gate failure path that prints before the pipeline relock.src/lib/actions/sandbox/rebuild-pipeline.ts: forwardsrebuildShieldsWindow.wasLockedat both post-restore call sites. A stale or prepared recovery recreate keepsfalsebecause the recreated sandbox starts unlocked and already prints theshields upreminder.rebuild-mcp-phase.test.tscovers the guidance lines;rebuild-post-restore-phase.test.tscovers OpenClaw and Hermes rebuilds that restore lockdown, a rebuild that started with shields down, a Deep Agents rebuild, and the cron-gate path ordering;rebuild-flow-recovery.test.tscovers the pipeline pass-through with a locked window.docs/manage-sandboxes/recover-rebuild-sandboxes.mdx(Hermes recovery paragraphs) anddocs/manage-sandboxes/manage-mcp-servers.mdx(OpenClaw and Hermes variant block).The only added mechanism is one boolean phase input; its consumer is the post-restore guidance and the tests above protect it.
Verification
Every command ran on an Ubuntu 26.04 x86_64 host from a worktree at upstream
main19bb9860aplus this change.npx vitest run --project cli src/lib/actions/sandbox/rebuildwith an isolatedHOME— passed, 63 of 63 test files. An earlier run against the host's sharedHOMEfailed 8 tests withFailed to acquire lock on /home/soul/.nemoclaw-portable-host.lock after 120 retriesand 5 s timeouts inrebuild-shields-finally.test.ts; that is lock contention on the shared host, not this change.npm run typecheck:cli— passed, 0 errors.npm run checks:repository— passed (exit 0).npx oxfmt --checkonrebuild-mcp-phase.ts,rebuild-post-restore-phase.ts,rebuild-pipeline.ts, andrebuild-flow-recovery.test.ts— passed (exit 0).npx oxfmt --checkonrebuild-mcp-phase.test.tsandrebuild-post-restore-phase.test.ts— fails, and the unchanged upstreammaincopies of both files fail the same check. Runningnpx oxfmton this branch's copies reproduces the fully formatted files byte for byte (md51d6936e0…andf9506e77…), so the added lines are formatted and only pre-existing lines differ. The repository hooktools/lint/format-added-files.shformats added files only, so the pre-existing lines stay as they are onmain.npx oxlinton the six changed TypeScript files — passed, 0 warnings and 0 errors.npm run validate:pron a throwaway commit with this title — passed (exit 0): the pre-commit stage (repository checks, env-var documentation gate, gitleaks, source-shape test budget, growth guardrails, TypeScript CLI), commitlint, and the pre-push stage.npm run docs— passed (exit 0): Fern check found 0 errors, andcheck-docs-published-routesreported OK for 69 guarded pages.Review notes
mcp restartrefusal while shields are up and the rebuild relock. Both are documented contracts, so the issue's first expected result would be a product decision.hermesMcpReconciliationRemediationLinesinsrc/lib/actions/sandbox/mcp-bridge-hermes-reconciliation.tsalso prescribesmcp restartwithout the shields precondition fromconnectandgateway restart. It is outside the rebuild scope of [Ubuntu 26.04][Agent&Skills] rebuild re-locks shields, leaving the documented mcp restart recovery step unable to run #10751 and inside the hunks of open PR refactor(mcp): bind lifecycle to recorded runtime #10815.RebuildPostRestorePhaseInputand a line to the secondrunRebuildPostRestorePhasecall.Signed-off-by: Kushagar Garg dreamstick909@gmail.com
Summary by CodeRabbit