Skip to content

fix(rebuild): emit actionable diagnostic on all preflight failures (#7794) - #7812

Open
kagura-agent wants to merge 7 commits into
NVIDIA:mainfrom
kagura-agent:fix/rebuild-preflight-diagnostic
Open

fix(rebuild): emit actionable diagnostic on all preflight failures (#7794)#7812
kagura-agent wants to merge 7 commits into
NVIDIA:mainfrom
kagura-agent:fix/rebuild-preflight-diagnostic

Conversation

@kagura-agent

@kagura-agent kagura-agent commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

When nemoclaw rebuild fails during the preflight phase (e.g. a pending policy transaction or missing sandbox), the command previously exited with code 1 without producing output matching the expected diagnostic pattern /Failed to back up|Aborting rebuild/i. Users only saw the confirmation line and an unexplained exit.

Changes

  1. rebuild-preflight-error.ts: Changed the safety line from "Sandbox is untouched — no data was lost." to "Aborting rebuild — sandbox is untouched, no data was lost." so the output matches the CI assertion pattern.

  2. rebuild-preflight-guards.ts: Routed all four guard functions through printRebuildPreflightFailure instead of raw console.error + bail():

    • getRebuildSandboxEntryOrBail
    • blockRebuildOnPendingBaselineTransition
    • isSingleAgentRebuildSupported
    • acquireRebuildOnboardLock
  3. rebuild-preflight-phase.ts: The assertMcpDestroyNotPending catch block now routes through printRebuildPreflightFailure instead of calling bail() directly.

  4. Gateway schema guard: checkRebuildGatewaySchemaPreflight now routes schema incompatibility through the same structured safe-abort diagnostic before bailing.

  5. Tests: rebuild-preflight-error.test.ts verifies the structured diagnostic and exit-code forwarding. The lock-acquisition regression test verifies that a failed acquisition stops immediately without registering or invoking a release for another operation's lock. Gateway-drift coverage verifies the summary, remediation, safe-abort line, and bail reason with a non-throwing bail.

Result

Every preflight failure path now emits a structured diagnostic:

  Rebuild preflight failed: {reason}
  {actionable detail}
  Aborting rebuild — sandbox is untouched, no data was lost.

This matches the expected /Aborting rebuild/i pattern and tells users their sandbox data is safe. A failed onboarding-lock acquisition also returns before rebuild target preparation or destructive work.

Testing

  • npx vitest run --project cli src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts src/lib/actions/sandbox/rebuild-preflight-error.test.ts src/lib/actions/sandbox/rebuild-baseline-transition-preflight.test.ts src/lib/actions/sandbox/rebuild-shields-finally.test.ts — 4 files and 21 tests passed
  • npx vitest run --project integration test/mcp-bridge-destroy-marker-recovery.test.ts — 1 file and 13 tests passed
  • npm run typecheck:cli — passed
  • Changed-file prek hooks — passed

Closes #7794

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: Existing documentation already states that these preflight conditions stop rebuild before backup or deletion; the change improves diagnostics and enforces the existing lock boundary.
  • 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: Security review refreshed for commit a15e3c9aae91e4d7decb2162e9f0ce8440f44716 against base 87fcfe40db6b0fe72622290866d17af701693e8a; all nine repository categories passed with no findings. The change only standardizes failure reporting, preserves fail-closed control flow and exit behavior, performs no mutation before the abort, and adds no credential, dependency, network, authentication, or authorization surface.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Reviewed commit a15e3c9aae91e4d7decb2162e9f0ce8440f44716. The change standardizes existing preflight failure output without changing the incompatibility condition, remediation, command, configuration, mutation boundary, or rebuild workflow. Existing rebuild documentation already covers safe preflight aborts and gateway-drift recovery. Focused gateway-drift tests passed: 7 tests. git diff --check passed.
  • Agent: Codex Desktop

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal commit and push hooks passed
  • Targeted behavior tests pass for the current change set — 7 focused gateway-drift tests passed at commit a15e3c9aae91e4d7decb2162e9f0ce8440f44716
  • Applicable broad gate passed — not applicable; this is a narrowly scoped preflight control-flow and regression-test change
  • Quality Gates section completed with required justifications
  • No secrets, API keys, or credentials committed

Summary by CodeRabbit

  • Bug Fixes
    • Improved sandbox rebuild validation and failure handling across multiple preflight checks.
    • Added clearer abort guidance and confirmation that the sandbox remains untouched and no data is lost.
    • Improved lock-related diagnostics, including the process ID when available.
    • Added more actionable details for configuration, registry, credential, and pending-operation failures.

Signed-off-by: kagura-agent kagura.agent.ai@gmail.com

@copy-pr-bot

copy-pr-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Rebuild preflight diagnostics

Layer / File(s) Summary
Shared failure reporting
src/lib/actions/sandbox/rebuild-preflight-error.ts, src/lib/actions/sandbox/rebuild-preflight-error.test.ts
The failure reporter now states that the rebuild is aborted and the sandbox is untouched. Tests verify bail invocation and logged summary and detail text.
Guard failure wiring
src/lib/actions/sandbox/rebuild-preflight-guards.ts, src/lib/actions/sandbox/rebuild-preflight-guards.test.ts, src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
Gateway, registry, policy, multi-agent, and onboarding-lock failures use standardized reporting. Tests cover failure and success paths, including lock-holder details and updated message text.
Phase and target failure wiring
src/lib/actions/sandbox/rebuild-preflight-phase.ts, src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
Pending MCP destroy, missing credential binding, and missing registry entry failures use structured diagnostics before returning null.

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

Possibly related PRs

  • NVIDIA/NemoClaw#7840: Modifies rebuild preflight failure handling and abort diagnostics in related sandbox rebuild paths.
  • NVIDIA/NemoClaw#7931: Modifies sandbox rebuild preflight and recovery behavior with related tests.

Suggested reviewers: cv, ericksoa

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes route preflight failures through actionable diagnostics and add tests for failure reasons, safety messaging, and bail handling required by issue #7794.
Out of Scope Changes check ✅ Passed The implementation and tests remain focused on actionable diagnostics for nemoclaw rebuild preflight failures.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: actionable diagnostics for all rebuild preflight failures.
✨ Finishing Touches 💡 2
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch fix/rebuild-preflight-diagnostic
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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/actions/sandbox/rebuild-preflight-error.test.ts`:
- Line 8: Update the describe suite title for printRebuildPreflightFailure to
append the linked issue suffix (`#7794`), preserving the existing title text.
- Around line 18-22: Extend the diagnostic assertions in the rebuild preflight
error test to verify the required sandbox-safety guarantee, matching the
user-facing text that sandbox is untouched and no data was lost. Keep the
existing “Aborting rebuild” and bail assertions unchanged.
🪄 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: b0a32c41-0151-4462-9e27-ee25a7edd5d6

📥 Commits

Reviewing files that changed from the base of the PR and between eeab81c and fbddaf4.

📒 Files selected for processing (5)
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.ts
  • src/lib/actions/sandbox/rebuild-preflight-guards.ts
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts

Comment thread src/lib/actions/sandbox/rebuild-preflight-error.test.ts Outdated
Comment thread src/lib/actions/sandbox/rebuild-preflight-error.test.ts
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Blocking findings reported

Advisor assessment: Blockers require maintainer review
Next action: Review the blockers below.
Findings: 1 blocker · 1 warning · 0 suggestions

Model lanes

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

Advisory only. The primary lane did not select these E2E jobs or targets.

  • rebuild-hermes: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • rebuild-hermes-stale-base: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • gateway-guard-recovery: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — Aborting rebuild at src/lib/actions/sandbox/rebuild-preflight-error.ts:17: Keep `Aborting rebuild`; it is established rebuild diagnostic language.
  • replace — safe-abort at src/lib/actions/sandbox/rebuild-gateway-drift.test.ts:123: Rename the test title to use `preflight failure diagnostic` and state the no-mutation condition when needed.

E2E guidance

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

Recommended E2E: onboard-repair, onboard-resume, rebuild-openclaw, state-backup-restore

Blockers

PRA-1 Blocker — Emit the structured abort diagnostic for target-preflight failures

  • Location: src/lib/actions/sandbox/rebuild-preflight-target-phase.ts:266
  • Category: acceptance
  • Problem: Two reachable target-preflight failure paths call `bail()` directly instead of the shared structured diagnostic helper.
  • Impact: A missing provider credential binding or route-preflight conflict exits with only the bail message. The output omits both required diagnostic patterns, so users cannot determine from the common preflight format that rebuild stopped before mutation.
  • Fix: Route the missing credential-binding and route-preflight failure paths through `printRebuildPreflightFailure` with an actionable detail and the existing bail message.
  • Verification: Read `prepareRebuildTargetPreflights` at lines 264-294 and invoke each failure branch with a non-throwing bail spy to inspect its emitted stderr.
  • Test coverage: Add unit tests that drive the missing credential-binding and route-preflight-conflict branches and assert `Rebuild preflight failed` plus `Aborting rebuild — sandbox is untouched, no data was lost.` appear before bail.
  • Evidence: Issue [All Platforms][CLI&UX] nemoclaw rebuild exits without actionable diagnostic when failing during preflight phase #7794, authored by a COLLABORATOR, requires a `Rebuild preflight failed` diagnostic followed by `Aborting rebuild — sandbox is untouched, no data was lost.` when rebuild fails during preflight. src/lib/actions/sandbox/rebuild-preflight-target-phase.ts:266 calls `bail("Prepared provider reconfiguration is missing its credential binding")`. src/lib/actions/sandbox/rebuild-preflight-target-phase.ts:293 calls `bail(routePreflight.message)`. src/lib/actions/sandbox/rebuild-preflight-confirmation.ts:64-66 prints only the bail message before exit.
1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-2 Warning — Cover the MCP-destroy preflight diagnostic path

  • Location: src/lib/actions/sandbox/rebuild-preflight-phase.ts:102
  • Category: tests
  • Problem: The new catch branch for a pending MCP destroy transaction has no regression test for its structured diagnostic and early-return behavior.
  • Impact: A later change can restore a silent or incomplete failure path for a pending MCP destroy transaction without failing the changed test suite.
  • Recommendation: Add a phase-level test that makes `assertMcpDestroyNotPending` throw and verifies the structured abort diagnostic, the propagated bail message, and that confirmation and target preparation do not run.
  • Verification: Inspect `rebuild-baseline-transition-preflight.test.ts` and search for a test that throws from `assertMcpDestroyNotPending`; none exercises the catch at line 102.
  • Test coverage: Mock `assertMcpDestroyNotPending` to throw, run `runRebuildPreflightPhase`, then assert `Rebuild preflight failed` and `Aborting rebuild` output, the original error text passed to bail, and no confirmation or target preparation.
  • Evidence: src/lib/actions/sandbox/rebuild-preflight-phase.ts:102-110 catches `assertMcpDestroyNotPending` and calls `printRebuildPreflightFailure` before returning null. src/lib/actions/sandbox/rebuild-baseline-transition-preflight.test.ts:59-76 covers the earlier pending-baseline-policy return and asserts the MCP check is not called. The changed test inventory contains no test that makes `assertMcpDestroyNotPending` throw.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@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 29, 2026
@kagura-agent
kagura-agent force-pushed the fix/rebuild-preflight-diagnostic branch from 878fbaf to 2530f58 Compare July 30, 2026 22:14
@kagura-agent

Copy link
Copy Markdown
Contributor Author

Rebased on latest upstream/main to resolve merge conflict.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/actions/sandbox/rebuild-preflight-guards.ts (1)

312-333: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Missing early return after failed lock acquisition lets a non-acquired lock still be "released".

Unlike the other three updated guards in this file (each returns its sentinel immediately after printRebuildPreflightFailure), acquireRebuildOnboardLock falls through when !lock.acquired and still returns a working release closure. If bail doesn't synchronously terminate execution (e.g., a test double, or a future refactor of bail), the caller ends up holding a release function that will call onboardSession.releaseOnboardLock() for a lock this call never actually acquired — potentially releasing the other in-progress run's lock.

🔒 Proposed fix: return a no-op release on failure
   if (!lock.acquired) {
     const pidDetail = lock.holderPid ? ` Lock holder PID: ${lock.holderPid}.` : "";
     printRebuildPreflightFailure(
       `another ${CLI_NAME} onboarding run is already in progress.`,
       `Wait for the other run to finish or remove the stale lock.${pidDetail}`,
       "Could not acquire onboard lock before rebuild",
       bail,
     );
+    return () => {};
   }
🤖 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/actions/sandbox/rebuild-preflight-guards.ts` around lines 312 - 333,
Update acquireRebuildOnboardLock so the !lock.acquired branch returns a no-op
release function immediately after printRebuildPreflightFailure. Ensure the
normal released-guarded closure and process.once("exit", release) registration
remain limited to successfully acquired locks.
🧹 Nitpick comments (1)
src/lib/actions/sandbox/rebuild-preflight-guards.ts (1)

39-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider moving the pure route-decision helpers to a domain module.

normalizedRoute, missingCredentialIdentity, sameRoute, and hardRouteConflict are pure decision functions with no host/process/registry I/O — they mostly wrap ../../inference/gateway-route-compatibility and ../../inference/selection. Per the layering rules, domain modules should own pure decisions while this actions/sandbox file should stay focused on orchestration (locking, load/save). Extracting these helpers alongside gateway-route-compatibility.ts would tighten the dependency direction.

As per path instructions, "src/lib/{actions,domain,adapters,state}/**: ... domain modules make pure decisions ... Flag cross-layer cycles, duplicate sources of truth, and forwarding wrappers that add a new layer without retiring the old owner."

🤖 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/actions/sandbox/rebuild-preflight-guards.ts` around lines 39 - 94,
Move the pure helpers normalizedRoute, missingCredentialIdentity, sameRoute, and
hardRouteConflict out of rebuild-preflight-guards.ts into the domain inference
module alongside gateway-route-compatibility.ts, preserving their current
behavior and dependencies. Update the sandbox orchestration code to import and
use the extracted domain symbols, removing the local definitions so there is one
source of truth.

Source: Path instructions

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

Outside diff comments:
In `@src/lib/actions/sandbox/rebuild-preflight-guards.ts`:
- Around line 312-333: Update acquireRebuildOnboardLock so the !lock.acquired
branch returns a no-op release function immediately after
printRebuildPreflightFailure. Ensure the normal released-guarded closure and
process.once("exit", release) registration remain limited to successfully
acquired locks.

---

Nitpick comments:
In `@src/lib/actions/sandbox/rebuild-preflight-guards.ts`:
- Around line 39-94: Move the pure helpers normalizedRoute,
missingCredentialIdentity, sameRoute, and hardRouteConflict out of
rebuild-preflight-guards.ts into the domain inference module alongside
gateway-route-compatibility.ts, preserving their current behavior and
dependencies. Update the sandbox orchestration code to import and use the
extracted domain symbols, removing the local definitions so there is one source
of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3d01f3f6-40d7-4c8d-9ebc-e5a2388e7a85

📥 Commits

Reviewing files that changed from the base of the PR and between 878fbaf and 2530f58.

📒 Files selected for processing (5)
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.ts
  • src/lib/actions/sandbox/rebuild-preflight-guards.ts
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/actions/sandbox/rebuild-preflight-error.ts

@kagura-agent
kagura-agent force-pushed the fix/rebuild-preflight-diagnostic branch from 2530f58 to bb8d34d Compare July 31, 2026 02:13

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

🧹 Nitpick comments (1)
src/lib/actions/sandbox/rebuild-preflight-guards.test.ts (1)

143-158: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the lock-specific diagnostic and bail message.

The test only checks shared safety text. It does not check the lock holder PID, remediation text, or the bail message. A regression that removes these lock-specific values can pass.

Proposed test assertions
       expect(output).toContain("Aborting rebuild");
       expect(output).toContain("sandbox is untouched, no data was lost.");
+      expect(output).toContain("Wait for the other run to finish or remove the stale lock.");
+      expect(output).toContain("Lock holder PID: 12345.");
+      expect(bail).toHaveBeenCalledWith("Could not acquire onboard lock before rebuild");

As per path instructions, tests must validate observable outcomes through the public boundary.

🤖 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/actions/sandbox/rebuild-preflight-guards.test.ts` around lines 143 -
158, Strengthen the test for acquireRebuildOnboardLock so it asserts the
lock-holder PID and remediation guidance in console.error, and verifies bail was
called with the expected lock-specific message and exit code. Keep the
assertions through the public acquireRebuildOnboardLock boundary and retain the
existing safety-text checks.

Sources: Coding guidelines, Path instructions

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

Nitpick comments:
In `@src/lib/actions/sandbox/rebuild-preflight-guards.test.ts`:
- Around line 143-158: Strengthen the test for acquireRebuildOnboardLock so it
asserts the lock-holder PID and remediation guidance in console.error, and
verifies bail was called with the expected lock-specific message and exit code.
Keep the assertions through the public acquireRebuildOnboardLock boundary and
retain the existing safety-text checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0d80fdf-7a60-4c66-b9bf-98e536b5464b

📥 Commits

Reviewing files that changed from the base of the PR and between 2530f58 and bb8d34d.

📒 Files selected for processing (7)
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.ts
  • src/lib/actions/sandbox/rebuild-preflight-guards.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-guards.ts
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.ts
  • src/lib/actions/sandbox/rebuild-preflight-error.test.ts

@kagura-agent
kagura-agent force-pushed the fix/rebuild-preflight-diagnostic branch 2 times, most recently from f82af63 to c720468 Compare July 31, 2026 02:25
kagura-agent and others added 2 commits August 1, 2026 10:14
…lures (NVIDIA#7794)

Route all preflight failure paths through printRebuildPreflightFailure so
the output consistently includes 'Aborting rebuild', making the diagnostic
actionable and matchable by CI assertions.

Co-Authored-By: Claude <noreply@anthropic.com>
@kagura-agent
kagura-agent force-pushed the fix/rebuild-preflight-diagnostic branch from c720468 to 6de69d1 Compare August 1, 2026 02:15
@apurvvkumaria apurvvkumaria self-assigned this Aug 4, 2026

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed commit 3692bbaf8. acquireRebuildOnboardLock now routes a failed acquisition through printRebuildPreflightFailure, but it does not return afterward. If the injected bail does not terminate, the function registers an exit handler and returns a release closure for a lock it never acquired. That closure can release another onboarding run's lock. Return a no-op release immediately after the failure helper, and add a public-boundary test that proves the failed path does not register or invoke release while retaining the PID, remediation, safety, and bail diagnostics.

Contributor compliance also blocks approval: the PR body has no valid Signed-off-by: declaration. Add the contributor's declaration. The branch has been updated from main; obtain current required CI/E2E evidence and complete a documentation-writer review receipt for the final commit after the code fix.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria

Copy link
Copy Markdown
Collaborator

Addressed the requested lock-failure control-flow issue in the current revision. A failed onboarding-lock acquisition now returns immediately, and the caller stops before target preparation; the regression test proves that no exit handler is registered and no release is invoked for another operation’s lock. I also preserved the requested exit code for pending-policy failures. The focused suite passes 34 tests, CLI type-checking passes, and changed-file hooks pass. The documentation and sensitive-path reviews are recorded in the PR body; fresh CI and E2E are running.

@github-actions github-actions Bot added v0.0.103 Release target and removed v0.0.102 labels Aug 4, 2026
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 v0.0.103 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[All Platforms][CLI&UX] nemoclaw rebuild exits without actionable diagnostic when failing during preflight phase

4 participants