Skip to content

feat(cli): converge readiness checks - #8738

Merged
cv merged 16 commits into
mainfrom
codex/readiness-convergence-7411
Aug 10, 2026
Merged

feat(cli): converge readiness checks#8738
cv merged 16 commits into
mainfrom
codex/readiness-convergence-7411

Conversation

@jyaunches

@jyaunches jyaunches commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Converges host, gateway, onboarding, resume, and rebuild readiness on one canonical report and admission policy. Blocking findings now stop lifecycle effects before credentials, images, gateways, policies, or sandboxes change, while public diagnostics remain observation-only and credential-free.

Related Issue

Fixes #7411

Changes

  • Share stable host and gateway observations, capabilities, findings, evidence, provenance, and exit codes between host probe and onboarding.
  • Resolve one gateway lifecycle authority, validate externally supervised gateways without a standalone fallback, and revalidate live gateway state before resume or rebuild effects.
  • Run readiness subprocesses with a minimal credential-free environment and fail closed on unsupported runtimes, invalid Docker endpoints, missing Jetson NVIDIA runtime support, inconclusive identity, and stale or conflicting gateway state.
  • Preserve current-main platform entries while publishing the complete GPU readiness state contract and the new command and workflow behavior.
  • Route OpenShell resolution through a leaf readiness seam to preserve the zero-cycle source architecture budget; the source-architecture check protects this requirement.

Type of Change

  • 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

  • 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:
  • 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: Independent read-only code audit found no blocker in readiness admission, lifecycle authority, credential-free subprocesses, or rebuild/resume seams; focused security and lifecycle regressions pass.
  • 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: docs-updated
  • Evidence: docs/about/how-it-works.mdx, docs/get-started/windows-preparation.mdx, docs/inference/choose-inference-provider.mdx, docs/reference/commands.mdx, docs/reference/platform-support.mdx, docs/reference/system-readiness.mdx
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: focused readiness/onboarding tests passed 284 cases and the single startup-timeout file passed 8/8 on isolated rerun; split preflight/readiness 167/167; reviewer-adjacent gateway/readiness 50/50; post-extraction preflight/gateway tests 159/159; guardrail-linearized fixtures 141/141; architecture/lifecycle integration 48/48; automated-review readiness fixes 81/81; final review-finding closure passed focused CLI 97/97, integration 3/3, installer 94/94, and process-scanning 14/14 with a host-appropriate timeout; managed-image preflight cleanup contract 18/18; MCP policy stress suite 39/39 with an explicit coverage-load budget; rebuild credential preflight process contracts 2/2; Docker runtime 14/14; hermetic preflight 129/129 with four real-listener cases skipped where the earlier sandbox denied listeners.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: aggregate npm test was attempted locally, but shared macOS parallel temp ownership and Oclif startup contention caused unrelated cross-suite failures; affected [Readiness 5/5] Converge onboarding, gateway diagnostics, and doctor on readiness checks #7411 lanes pass serially and CI will run the aggregate projects in their normal environment.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only) — command/result: passed with 0 errors and 2 Fern warnings.
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Julie Yaunches jyaunches@nvidia.com

@jyaunches jyaunches self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 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

This PR converges host, gateway, onboarding, and rebuild flows on system-readiness reports. It adds read-only gateway probing, readiness admission, persisted gateway-authority checkpoints, stricter rebuild validation, and updated advisory and documentation contracts.

Changes

System readiness and onboarding

Layer / File(s) Summary
System readiness and gateway projection
src/lib/readiness/*
Adds composite host and gateway reports, admission checks, stale-data handling, sanitized evidence, isolated probe environments, and read-only gateway observation.
Readiness-gated onboarding
src/lib/onboard/fatal-runtime-preflight.ts, src/lib/onboard/machine/*, src/lib/onboard/preflight.ts
Replaces direct runtime and CDI gates with readiness admission, refreshes live facts, and defers effectful checks until readiness passes.
Gateway ownership and service validation
src/lib/onboard/gateway-host-runtime.ts, src/lib/onboard/docker-driver-gateway-*.ts, src/lib/onboard.ts
Adds packaged-owner adoption, process identity checks, credential-free probes, external supervision handling, and gateway lifecycle authority wiring.
Rebuild authority handoff
src/lib/actions/sandbox/rebuild-*.ts
Pins the target gateway during readiness, persists checkpointed authority, rejects authority drift, and validates journal state before recreation.
Host probe and contracts
src/commands/host/probe.ts, src/lib/domain/docker-host.ts, src/lib/inference/nim.ts
Updates host:probe to report system readiness and adds structured Docker observations and injectable GPU command transport.
Advisories and documentation
src/lib/advisories/*, docs/*, ci/*, scripts/install.sh
Registers host advisories, removes the unsupported-runtime warning path, updates readiness terminology, and documents gateway-aware readiness behavior.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#7246: Extends gateway lifecycle-authority work across readiness, onboarding, checkpoint, and recovery paths.
  • NVIDIA/NemoClaw#7319: Shares gateway service ownership, lifecycle validation, and readiness integration.
  • NVIDIA/NemoClaw#8682: Shares sandbox gateway recovery, readiness gating, and authority handling.

Suggested labels: area: onboarding, area: architecture, feature

Suggested reviewers: apurvvkumaria, cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.13% 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 implement the linked issue objectives, including canonical readiness reporting, advisory integration, gateway authority, fail-closed admission, and resume validation.
Out of Scope Changes check ✅ Passed The code, tests, documentation, and configuration changes support the linked readiness convergence objectives without unrelated scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: converging readiness checks across the CLI and lifecycle flows.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/readiness-convergence-7411

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

@github-code-quality

github-code-quality Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 89af2e0 in the codex/readiness-conv... branch remains at 96%, unchanged from commit d097a22 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 89af2e0 in the codex/readiness-conv... branch remains at 82%, unchanged from commit d097a22 in the main branch.

Show a code coverage summary of the most impacted files.
File main d097a22 codex/readiness-conv... 89af2e0 +/-
src/lib/policy/...ne-exclusion.ts 92% 87% -5%
src/lib/adapter...ateway-drift.ts 51% 56% +5%
src/lib/onboard...pu-preflight.ts 90% 95% +5%
src/lib/onboard...me-preflight.ts 75% 98% +23%
src/lib/readine...y-production.ts 0% 51% +51%
src/lib/onboard...ay-authority.ts 0% 73% +73%
src/lib/readiness/gateway.ts 0% 89% +89%
src/lib/readiness/probe-env.ts 0% 94% +94%
src/lib/readine...rd-admission.ts 0% 100% +100%
src/lib/readiness/system.ts 0% 100% +100%

Updated August 10, 2026 17:10 UTC

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / low confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: PR review advisor failed: PR review advisor SDK execution failed: session: scope-risk-map-analysis omitted required analysis; turn: scope-risk-map-analysis: scope-risk-map-analysis omitted required analysis

Model lanes

  • GPT-5.6 Terra (primary): Failed
  • Nemotron 3 Ultra (second opinion): Failed

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite against this exact revision.

Recommended E2E: cloud-inference, cloud-onboard, managed-image-multiarch-startup, managed-image-protected-runtime, security-posture, inference-routing, network-policy, onboard-repair, onboard-resume, rebuild-openclaw, state-backup-restore

Workflow run details

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

Comment thread src/lib/onboard/fatal-runtime-preflight.ts Fixed
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Comment thread src/lib/onboard/fatal-runtime-preflight.ts Fixed
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

@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: 19

Caution

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

⚠️ Outside diff range comments (1)
src/lib/onboard/gateway-host-runtime-https.test.ts (1)

82-101: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Restore OPENSHELL_GATEWAY_AUTH_TOKEN after this test.

Line 83 directly mutates process.env.OPENSHELL_GATEWAY_AUTH_TOKEN. The test restores only OPENSHELL_LOCAL_TLS_DIR. A later test can inherit this token.

Capture and restore the original token, or use a test-scoped environment stub.

🤖 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/onboard/gateway-host-runtime-https.test.ts` around lines 82 - 101,
Restore the environment mutation in the gateway attachment test by capturing the
original OPENSHELL_GATEWAY_AUTH_TOKEN before assigning it and restoring that
value during cleanup, alongside OPENSHELL_LOCAL_TLS_DIR. Keep the existing probe
assertions unchanged and ensure the token cannot leak into later tests.

Source: Coding guidelines

🧹 Nitpick comments (10)
src/lib/readiness/gateway-production.ts (2)

173-182: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Read the gateway binary override from the probe environment.

resolveTrustedGatewayBinary reads process.env.NEMOCLAW_OPENSHELL_GATEWAY_BIN directly. Every other resolution in this module takes the sanitized probeEnv that buildGatewayReadinessProbeEnv produced, including resolveTrustedOpenshellBinary. Accept the environment as a parameter so one environment governs the whole readiness probe and tests can control the override without mutating process.env.

🤖 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/readiness/gateway-production.ts` around lines 173 - 182, Update
resolveTrustedGatewayBinary to accept the sanitized probeEnv environment and
read NEMOCLAW_OPENSHELL_GATEWAY_BIN from it instead of process.env. Pass the
same probeEnv produced by buildGatewayReadinessProbeEnv through the readiness
probe call chain, matching resolveTrustedOpenshellBinary, so tests can control
the override without mutating process.env.

342-366: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Reuse the OpenShell status outputs instead of probing three more subprocesses.

observeReuseState runs openshell status, openshell gateway info -g <name>, and openshell gateway info. inspectLegacyCluster runs the same three commands again in the same observeManagedGateway pass, and each command carries the full OPENSHELL_PROBE_TIMEOUT_MS budget. On a slow or wedged OpenShell CLI the readiness probe pays that cost twice. Pass the already captured outputs from observeReuseState into inspectLegacyCluster, and keep only the Docker inspections in the legacy path.

🤖 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/readiness/gateway-production.ts` around lines 342 - 366, Update
observeManagedGateway and inspectLegacyCluster to accept and reuse the openshell
status, named gateway info, and active gateway info captured by
observeReuseState. Remove the duplicate captureReadonly subprocess calls from
inspectLegacyCluster, while preserving its existing health and endpoint-binding
checks; retain only the Docker inspections in the legacy path.
src/lib/onboard/gateway-authority-checkpoint.test.ts (1)

104-127: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the unbound-authority rejection.

adoptPackagedGatewayAuthorityAfterTrustedInstall throws "Trusted gateway installation requires a previously bound gateway authority." when the checkpoint decision is not selected. That fail-closed branch has no test. Add a case that calls the function on a fresh session without a prior bindGatewayAuthorityToCheckpoint call, and assert both the thrown message and that session.checkpoint stays unchanged.

🤖 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/onboard/gateway-authority-checkpoint.test.ts` around lines 104 - 127,
Add a test alongside the existing trusted-install cases that creates a fresh
session without calling bindGatewayAuthorityToCheckpoint, snapshots
session.checkpoint, and invokes
adoptPackagedGatewayAuthorityAfterTrustedInstall. Assert it throws the message
“Trusted gateway installation requires a previously bound gateway authority.”
and that the checkpoint remains equal to the snapshot.
src/lib/adapters/openshell/gateway-drift.ts (1)

433-442: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the installed-version dependency semantics across the three observers.

Line 258 and line 440 now call the injected getter whenever it exists, so an injected null stays null. Line 434 still uses deps.getInstalledOpenshellVersion?.() ?? getInstalledOpenshellVersionOrNull(...), so an injected getter that returns null silently falls back to the production probe. A caller that injects all three getters therefore gets probe execution in getGatewayHostProcessDrift only. Make the resolution rule identical in the three functions.

♻️ Proposed alignment
   const expectedVersion =
-    deps.getInstalledOpenshellVersion?.() ??
-    getInstalledOpenshellVersionOrNull({ timeout: timeoutMs });
+    typeof deps.getInstalledOpenshellVersion === "function"
+      ? deps.getInstalledOpenshellVersion()
+      : getInstalledOpenshellVersionOrNull({ timeout: timeoutMs });
🤖 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/adapters/openshell/gateway-drift.ts` around lines 433 - 442, Update
the installed-version resolution in getGatewayHostProcessDrift to match the
other observers: when deps.getInstalledOpenshellVersion exists, use its result
directly, including null, and only call getInstalledOpenshellVersionOrNull when
the getter is absent. Preserve the existing expectedVersion check and runtime
resolution behavior.
src/lib/readiness/onboard-admission.ts (1)

268-299: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the shared blocking-finding classification loop.

Lines 275-293 repeat the loop at Lines 256-261. Both iterate findings, skip non-blocking entries, call canWaiveFinding, and split the IDs into waivedFindingIds and findingIds. The only difference is the options value.

A shared helper keeps one implementation of the waiver semantics, so a future waiver change cannot apply to one entry point and miss the other.

♻️ Proposed refactor
+function classifyBlockingFindings(
+  report: OnboardReadinessInput,
+  capabilities: ReadonlyMap<string, ReadinessCapability>,
+  options: Readonly<OnboardReadinessAdmissionOptions>,
+  managedGateway: boolean,
+): { findingIds: string[]; waivedFindingIds: string[] } {
+  const findingIds: string[] = [];
+  const waivedFindingIds: string[] = [];
+  for (const finding of report.findings) {
+    if (!isBlocking(finding)) continue;
+    if (canWaiveFinding(finding, capabilities, options, managedGateway)) {
+      waivedFindingIds.push(finding.id);
+    } else findingIds.push(finding.id);
+  }
+  return { findingIds, waivedFindingIds };
+}
+
+const GATEWAY_CHECKPOINT_OPTIONS: OnboardReadinessAdmissionOptions = {
+  explicitlyOptedOutGpuPassthrough: false,
+  allowUnsupportedRuntime: false,
+  allowStorageRemediation: false,
+};
 export function evaluateOnboardGatewayReadinessAdmission(
   report: OnboardReadinessInput,
 ): OnboardReadinessAdmissionDecision {
   const capabilities = new Map(report.capabilities.map((entry) => [entry.id, entry]));
-  const managedGateway = hasManagedGateway(report);
-  const waivedFindingIds: string[] = [];
-  const findingIds: string[] = [];
-  for (const finding of report.findings) {
-    if (!isBlocking(finding)) continue;
-    if (
-      canWaiveFinding(
-        finding,
-        capabilities,
-        {
-          explicitlyOptedOutGpuPassthrough: false,
-          allowUnsupportedRuntime: false,
-          allowStorageRemediation: false,
-        },
-        managedGateway,
-      )
-    ) {
-      waivedFindingIds.push(finding.id);
-    } else {
-      findingIds.push(finding.id);
-    }
-  }
+  const { findingIds, waivedFindingIds } = classifyBlockingFindings(
+    report,
+    capabilities,
+    GATEWAY_CHECKPOINT_OPTIONS,
+    hasManagedGateway(report),
+  );
   const capabilityIds: string[] = [];
   for (const id of GATEWAY_REQUIRED_CAPABILITIES) {
     addUnknownCapability(capabilityIds, capabilities, id);
   }
   return decisionFor(findingIds, capabilityIds, waivedFindingIds);
 }

Apply the same helper inside evaluateOnboardReadinessAdmission.

🤖 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/readiness/onboard-admission.ts` around lines 268 - 299, Extract the
repeated blocking-finding classification logic into a shared helper that
iterates findings, skips non-blocking entries, calls canWaiveFinding with
supplied options, and returns waivedFindingIds and findingIds. Update both
evaluateOnboardReadinessAdmission and evaluateOnboardGatewayReadinessAdmission
to use this helper, passing their respective waiver options while preserving the
existing managedGateway behavior.
src/lib/readiness/host.ts (1)

103-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Convert adaptHostAssessment to an options object.

The function now takes eight positional parameters. Six are optional and adjacent: hostGpuPlatform, nvidiaGpuCount, nvidiaDriverVersion, platformIdentity, wslDockerDesktopGpuProofPassed, plus the new hasNvidiaGpu. The single call site at Lines 196-214 passes nested ternaries positionally, so a future insertion or reorder is easy to get wrong and hard to catch in review.

A named-field argument removes the ordering dependency and makes the call site readable.

♻️ Proposed refactor sketch
+interface AdaptHostAssessmentInput {
+  architecture: string;
+  hasNvidiaGpu: boolean;
+  hostGpuPlatform?: NvidiaPlatform;
+  nvidiaGpuCount?: number;
+  nvidiaDriverVersion?: string;
+  platformIdentity?: PlatformIdentity;
+  wslDockerDesktopGpuProofPassed?: boolean;
+}
+
 function adaptHostAssessment(
   host: Readonly<HostAssessment>,
-  architecture: string,
-  hasNvidiaGpu: boolean,
-  hostGpuPlatform?: NvidiaPlatform,
-  nvidiaGpuCount?: number,
-  nvidiaDriverVersion?: string,
-  platformIdentity?: PlatformIdentity,
-  wslDockerDesktopGpuProofPassed?: boolean,
+  input: Readonly<AdaptHostAssessmentInput>,
 ): HostObservations {

Also applies to: 196-214

🤖 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/readiness/host.ts` around lines 103 - 112, Refactor
adaptHostAssessment to accept a single options object containing host,
architecture, hasNvidiaGpu, and the existing optional GPU/platform fields.
Update its sole call site to pass named properties instead of positional
arguments, preserving the current values and nested-ternary behavior.
src/lib/onboard/runtime-control-flow.ts (1)

122-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the transition logic shared by the projection and the commit.

Lines 122-125 build projectedSession, and lines 139-142 repeat the same two steps inside the updateSession mutator. Re-reading current inside the mutator is correct, so the duplication is intentional in structure but not in logic.

The risk is drift. If one copy gains a step, plan.session no longer predicts what commit() persists, and a caller that renders plan.session shows state that is never written. Extract one local function and call it from both places.

♻️ Proposed extraction
+  const applyTransition = (candidate: Session): Session => {
+    const transitioned = resumeAgentChanged
+      ? deps.clearAgentScopedResumeState(candidate, selectedAgentName)
+      : candidate;
+    return updateSessionAgent(transitioned, input.selectedAgentName, deps);
+  };
   const originalSession = structuredClone(input.session);
-  let projectedSession = structuredClone(input.session);
-  if (resumeAgentChanged) {
-    projectedSession = deps.clearAgentScopedResumeState(projectedSession, selectedAgentName);
-  }
-  projectedSession = updateSessionAgent(projectedSession, input.selectedAgentName, deps);
+  const projectedSession = applyTransition(structuredClone(input.session));
   let committed: Promise<Session> | null = null;
-        return deps.updateSession((current) => {
-          const transitioned = resumeAgentChanged
-            ? deps.clearAgentScopedResumeState(current, selectedAgentName)
-            : current;
-          return updateSessionAgent(transitioned, input.selectedAgentName, deps);
-        });
+        return deps.updateSession(applyTransition);

Also applies to: 138-143

🤖 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/onboard/runtime-control-flow.ts` around lines 122 - 125, Extract the
shared transition steps from the projection and commit paths into one local
helper, covering the resume-state clearing and updateSessionAgent operations.
Use this helper to build projectedSession and inside the updateSession mutator,
passing the mutator’s current session as its input so both plan.session and
committed state apply identical logic.
src/lib/onboard/fatal-runtime-preflight.ts (1)

336-394: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the repeated refresh-admit-compose block.

Lines 342-355 and 384-394 are the same sequence: refresh the gateway projection, admit the gateway, recompute managedGatewayReadiness, compose the composite report, and admit the composite report with an identical options object. The block also reassigns four let bindings across about 50 lines.

The behavior is correct today. The risk is drift: this is a security gate, and a future change applied to only one copy would silently weaken the other. Extract one helper and call it at both points.

♻️ Sketch of the extraction
+async function admitCompositeReadiness(
+  gateway: GatewayReadinessProjection,
+  result: FatalRuntimePreflightResult,
+  options: FatalRuntimePreflightOptions,
+  context: ReadinessGatedRuntimePreflightContext,
+  exitProcess: (code: number) => never,
+): Promise<{
+  gatewayReadiness: GatewayReadinessProjection;
+  managed: boolean;
+  readinessReport: SystemReadinessReport;
+}> {
+  const gatewayReadiness = refreshGatewayReadinessProjection(gateway);
+  assertOnboardGatewayReadiness(gatewayReadiness, exitProcess);
+  const managed = isManagedGatewayReadiness(gatewayReadiness);
+  const readinessReport = composeSystemReadinessReport(result.readinessReport, gatewayReadiness);
+  assertOnboardSystemReadiness(readinessReport, result.host, {
+    explicitlyOptedOutGpuPassthrough:
+      result.sandboxGpuConfig.mode === "0" || options.optedOutGpuPassthrough === true,
+    resuming: context.resuming,
+    allowStorageRemediation: managed,
+    exitProcess,
+  });
+  return { gatewayReadiness, managed, readinessReport };
+}

As per coding guidelines: "Keep function complexity low, follow the Biome configuration".

🤖 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/onboard/fatal-runtime-preflight.ts` around lines 336 - 394, Extract
the repeated gateway and system readiness admission sequence into a helper near
the existing onboarding readiness utilities, accepting the current gateway
readiness, refreshed host result, options, context, and exitProcess dependencies
and returning the updated gateway readiness, managedGatewayReadiness, and
readinessReport values. Replace both post-refresh blocks in the surrounding
preflight flow with calls to this helper, preserving the existing admission
order and identical options, and keep the runtime GPU proof flow’s additional
refresh between those calls unchanged.
src/lib/onboard/openshell-install.ts (1)

292-292: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document when afterSuccessfulInstall runs.

The callback fires after every version, messaging-feature, and maximum-version gate has passed, not immediately after installOpenshell() returns. The option name alone does not convey that ordering, and the ordering matters for a reconciliation callback. Add a short doc comment on the option.

♻️ Proposed refactor to document the callback timing
 export function ensureOpenshellForOnboard(
   deps: OpenShellInstallDeps,
-  options: { afterSuccessfulInstall?(): void } = {},
+  options: {
+    /**
+     * Runs after an install or upgrade succeeded and after every version and
+     * feature gate passed. Does not run when no install was needed.
+     */
+    afterSuccessfulInstall?(): void;
+  } = {},
 ): OpenShellInstallResult {
🤖 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/onboard/openshell-install.ts` at line 292, Add a concise
documentation comment to the option defining afterSuccessfulInstall, stating
that it runs only after installOpenshell completes and all version,
messaging-feature, and maximum-version gates pass. Keep the callback invocation
in the existing installed-success path unchanged.
src/lib/onboard/machine/handlers/preflight.ts (1)

174-201: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the second explicitlyOptedOutGpuPassthrough from the refreshed config.

Line 175 computes explicitlyOptedOutGpuPassthrough from resumeSandboxGpuConfig.mode === "0". Line 196 hardcodes false after line 188 recomputes the config from the fresh detectGpu() result. The two admissions therefore derive the same flag differently.

The hardcoded value is correct while mode === "0" follows only from an explicit disable flag or env override. If resolveSandboxGpuConfig later resolves the "auto" mode to "0" from a detection outcome, the second admission reports the wrong intent. Use the same expression in both places.

The resolve, gateway-admission, and host-admission triplet also repeats in both passes. A small local helper would keep the two admissions aligned by construction.

♻️ Proposed refactor to align both admissions
       await deps.assertGatewayReadiness();
       const wslDockerDesktopGpuProofPassed = resolvedWslDockerDesktopGpuProof(gpu);
       deps.assertOnboardHostReadiness(resumeHost, gpu, {
-        explicitlyOptedOutGpuPassthrough: false,
+        explicitlyOptedOutGpuPassthrough: resumeSandboxGpuConfig.mode === "0",
         observedAt: hostObservedAt,
         now,
         ...(wslDockerDesktopGpuProofPassed === undefined ? {} : { wslDockerDesktopGpuProofPassed }),
         resuming: true,
       });
🤖 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/onboard/machine/handlers/preflight.ts` around lines 174 - 201, Update
the second deps.assertOnboardHostReadiness call in the resume flow to derive
explicitlyOptedOutGpuPassthrough from the refreshed resumeSandboxGpuConfig using
the same expression as the first admission, rather than hardcoding false. Keep
the refreshed resolve, gateway-readiness, and host-admission sequence aligned
with the initial pass; a small local helper may encapsulate the repeated
admission logic if needed.
🤖 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 `@scripts/install.sh`:
- Around line 3045-3050: Update the installer gate around assessHost and
planHostAdvisories to use the canonical readiness report and admission policy
for its exit status. Stop deriving blocking status from blockingActions or
remediation actions, and ensure unsupported runtimes are rejected consistently
with the readiness contract while preserving the existing successful path.

In `@src/lib/domain/docker-host.ts`:
- Around line 28-38: Update the Docker plain-text response parsing around
lowered and reachable to fail closed unless the text is a bare version token or
matches the Server Version format. Preserve acceptance of the existing “Podman
Engine” compatibility fixture, while treating permission and HTTP error messages
as unreachable. Add regression tests covering both error cases and the accepted
output forms.

In `@src/lib/onboard/docker-cdi.ts`:
- Around line 312-318: Update the docker CDI directory handling around
reportedDockerCdiSpecDirs and dockerCdiSpecDirs so the default-directory
fallback is used only when CDI support is confirmed. Preserve an unknown or
unsupported CDI state instead of treating an empty CDISpecDirs response as
supported, and ensure missing-spec findings do not recommend CDI generation for
daemons without confirmed CDI support.

In `@src/lib/onboard/docker-driver-gateway-service.ts`:
- Around line 637-641: Update gateway reuse to call the full trusted service
identity API instead of getTrustedActiveOpenShellGatewayUserServicePid, and
require identity.executablePath to be non-null before accepting a matching
listener PID. Remove the PID-only wrapper and its associated tests, preserving
executable validation for Homebrew and systemd paths.

In `@src/lib/onboard/fatal-runtime-preflight.test.ts`:
- Around line 253-256: Update the second assertOnboardHostReadiness test case to
store its exitProcess mock in a named variable, pass that mock into the call
with explicitlyOptedOutGpuPassthrough enabled, and assert the mock was not
called afterward.

In `@src/lib/onboard/gateway-host-runtime.ts`:
- Around line 183-208: Extract the shared trusted-install transition predicate
near sameGatewayOwner and use it in both adoption functions. In
src/lib/onboard/gateway-host-runtime.ts lines 183-208, replace the inline
transition checks in adoptPackagedGatewayOwnerAfterTrustedInstall; in
src/lib/onboard/gateway-authority-checkpoint.ts lines 74-107, replace the
corresponding checks in adoptPackagedGatewayAuthorityAfterTrustedInstall while
preserving the checkpoint-specific error text. Ensure the predicate captures the
complete permitted transition, including the checkpoint’s packaged-service
source assertion.
- Around line 199-203: Use the same “rerun onboarding” spelling in the Error
message constructed by the gateway authority validation flow, matching the
existing wording in the nearby onboarding message and leaving the rest of the
message unchanged.

In `@src/lib/onboard/machine/handlers/preflight.test.ts`:
- Around line 377-402: Retitle the test to describe that cached resume passes
the host observation timestamp to readiness and stops subsequent checks when
readiness rejects. In the assertOnboardHostReadiness mock, explicitly assert
that options.observedAt is present before parsing it, while preserving the
existing stale-age rejection and detectGpu/bridge non-invocation assertions.

In `@src/lib/onboard/preflight.ts`:
- Around line 758-766: Update the installer’s CDI repair import sources so
getNvidiaCdiSpecPath and isWslDockerDesktopRuntime resolve from their current
modules, or add compatibility re-exports from preflight.js. Ensure
scripts/install.sh can invoke CDI repair without its catch silently skipping the
operation.

In `@src/lib/onboard/runtime-control-flow.ts`:
- Around line 102-112: Add a test covering the public onboarding entrypoint that
invokes the branding flow, mock the onboarding layers as needed, and assert it
reaches planSelectedAgentTransition. Ensure the test verifies the public
boundary no longer depends on applySelectedAgentTransition and preserves the
branding call order after planning.

In `@src/lib/readiness/effects.test.ts`:
- Around line 138-139: Remove the unused startGateway and selectGateway spies
and any assertions against them from the createSystemReadinessReport test setup.
Keep the probeAttachment throwing stub and the observeManagedGateway assertions
that verify reachable gateway behavior.

In `@src/lib/readiness/gateway-production.test.ts`:
- Around line 331-335: Move the getTraceCollector() null assertion in the
probeAttachment test to immediately after await
deps.probeAttachment(externalOwner(gatewayPort)) and before
vi.stubEnv(TRACE_FILE_ENV, ""). Keep the subsequent environment reset and
fs.existsSync(tracePath) assertion unchanged.

In `@src/lib/readiness/gateway-production.ts`:
- Around line 577-585: In observePackagedServiceGatewayBinary, move the
executableAfter and generationAfter reads to after the
getTrustedActiveOpenShellGatewayUserServiceIdentity serviceAfter probe. Keep
executableBefore before the probe, so gatewayExecutableSamplesMatchTrustedBinary
compares samples that bracket the complete identity observation.

In `@src/lib/readiness/host.ts`:
- Around line 466-472: Update the capability logic around
host.gpu.container_toolkit_available to distinguish Jetson runtime applicability
from Docker evidence usability: return the Jetson runtime state when the check
is evaluable, return unknown when Jetson applies but dockerEvidenceUsable is
false, and retain the existing non-Jetson containerToolkitApplies behavior.
Apply the same evaluability guard to the related observation and
host.gpu.nvidia_runtime_missing finding so an unevaluable Jetson runtime reports
unknown without emitting an absent finding.

In `@src/lib/readiness/openshell-resolver.ts`:
- Line 4: Update the resolveOpenshell re-export in the readiness resolver module
to include the .js extension, and apply the same extension to the relative
re-export specifiers in the readiness system module. Preserve the existing
exports and paths otherwise.

In `@src/lib/readiness/platform-qualification.ts`:
- Around line 511-521: Align the severity of WSL findings with admission
behavior in the platform qualification flow: either mark reachable native Docker
and inconclusive WSL runtime findings as blocking, or explicitly exclude those
warning states from the host.platform.unsupported fallback so admission remains
advisory. Preserve other unsupported-platform blocking behavior and add coverage
for the selected path.

In `@src/lib/readiness/probe-env.ts`:
- Line 80: Validate controls.gatewayName before assigning it to
OPENSHELL_GATEWAY, using the same NUL, carriage-return, and line-feed rejection
already applied to localTlsDir. Preserve the existing conditional assignment
while returning the established clear readiness failure for invalid values
instead of passing them to the environment.
- Around line 112-118: Update the spawnSync invocation in the readiness probe
executor to provide a bounded default timeout and maxBuffer, while preserving
caller overrides by spreading spawnOptions after the defaults. Keep the existing
encoding, environment, shell, and stdio behavior unchanged.

In `@src/lib/readiness/system.test.ts`:
- Around line 170-178: Update the readiness test assertion around
report.capabilities to first require a non-empty array, then retain the existing
every-state check ensuring all capabilities are "unknown". Use the existing
report.capabilities collection so the stale-report behavior cannot pass when no
capabilities are emitted.

---

Outside diff comments:
In `@src/lib/onboard/gateway-host-runtime-https.test.ts`:
- Around line 82-101: Restore the environment mutation in the gateway attachment
test by capturing the original OPENSHELL_GATEWAY_AUTH_TOKEN before assigning it
and restoring that value during cleanup, alongside OPENSHELL_LOCAL_TLS_DIR. Keep
the existing probe assertions unchanged and ensure the token cannot leak into
later tests.

---

Nitpick comments:
In `@src/lib/adapters/openshell/gateway-drift.ts`:
- Around line 433-442: Update the installed-version resolution in
getGatewayHostProcessDrift to match the other observers: when
deps.getInstalledOpenshellVersion exists, use its result directly, including
null, and only call getInstalledOpenshellVersionOrNull when the getter is
absent. Preserve the existing expectedVersion check and runtime resolution
behavior.

In `@src/lib/onboard/fatal-runtime-preflight.ts`:
- Around line 336-394: Extract the repeated gateway and system readiness
admission sequence into a helper near the existing onboarding readiness
utilities, accepting the current gateway readiness, refreshed host result,
options, context, and exitProcess dependencies and returning the updated gateway
readiness, managedGatewayReadiness, and readinessReport values. Replace both
post-refresh blocks in the surrounding preflight flow with calls to this helper,
preserving the existing admission order and identical options, and keep the
runtime GPU proof flow’s additional refresh between those calls unchanged.

In `@src/lib/onboard/gateway-authority-checkpoint.test.ts`:
- Around line 104-127: Add a test alongside the existing trusted-install cases
that creates a fresh session without calling bindGatewayAuthorityToCheckpoint,
snapshots session.checkpoint, and invokes
adoptPackagedGatewayAuthorityAfterTrustedInstall. Assert it throws the message
“Trusted gateway installation requires a previously bound gateway authority.”
and that the checkpoint remains equal to the snapshot.

In `@src/lib/onboard/machine/handlers/preflight.ts`:
- Around line 174-201: Update the second deps.assertOnboardHostReadiness call in
the resume flow to derive explicitlyOptedOutGpuPassthrough from the refreshed
resumeSandboxGpuConfig using the same expression as the first admission, rather
than hardcoding false. Keep the refreshed resolve, gateway-readiness, and
host-admission sequence aligned with the initial pass; a small local helper may
encapsulate the repeated admission logic if needed.

In `@src/lib/onboard/openshell-install.ts`:
- Line 292: Add a concise documentation comment to the option defining
afterSuccessfulInstall, stating that it runs only after installOpenshell
completes and all version, messaging-feature, and maximum-version gates pass.
Keep the callback invocation in the existing installed-success path unchanged.

In `@src/lib/onboard/runtime-control-flow.ts`:
- Around line 122-125: Extract the shared transition steps from the projection
and commit paths into one local helper, covering the resume-state clearing and
updateSessionAgent operations. Use this helper to build projectedSession and
inside the updateSession mutator, passing the mutator’s current session as its
input so both plan.session and committed state apply identical logic.

In `@src/lib/readiness/gateway-production.ts`:
- Around line 173-182: Update resolveTrustedGatewayBinary to accept the
sanitized probeEnv environment and read NEMOCLAW_OPENSHELL_GATEWAY_BIN from it
instead of process.env. Pass the same probeEnv produced by
buildGatewayReadinessProbeEnv through the readiness probe call chain, matching
resolveTrustedOpenshellBinary, so tests can control the override without
mutating process.env.
- Around line 342-366: Update observeManagedGateway and inspectLegacyCluster to
accept and reuse the openshell status, named gateway info, and active gateway
info captured by observeReuseState. Remove the duplicate captureReadonly
subprocess calls from inspectLegacyCluster, while preserving its existing health
and endpoint-binding checks; retain only the Docker inspections in the legacy
path.

In `@src/lib/readiness/host.ts`:
- Around line 103-112: Refactor adaptHostAssessment to accept a single options
object containing host, architecture, hasNvidiaGpu, and the existing optional
GPU/platform fields. Update its sole call site to pass named properties instead
of positional arguments, preserving the current values and nested-ternary
behavior.

In `@src/lib/readiness/onboard-admission.ts`:
- Around line 268-299: Extract the repeated blocking-finding classification
logic into a shared helper that iterates findings, skips non-blocking entries,
calls canWaiveFinding with supplied options, and returns waivedFindingIds and
findingIds. Update both evaluateOnboardReadinessAdmission and
evaluateOnboardGatewayReadinessAdmission to use this helper, passing their
respective waiver options while preserving the existing managedGateway behavior.
🪄 Autofix

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: 9f184c47-19e9-4fa0-ab8b-87aaad7cfba9

📥 Commits

Reviewing files that changed from the base of the PR and between acf810d and 7cf47be.

📒 Files selected for processing (105)
  • ci/platform-matrix.json
  • ci/source-architecture-budget.json
  • ci/source-shape-test-budget.json
  • ci/test-file-size-budget.json
  • docs/about/how-it-works.mdx
  • docs/inference/choose-inference-provider.mdx
  • docs/reference/commands.mdx
  • docs/reference/platform-support.mdx
  • docs/reference/system-readiness.mdx
  • scripts/install.sh
  • src/commands/host/probe.test.ts
  • src/commands/host/probe.ts
  • src/lib/actions/sandbox/gateway-target.ts
  • src/lib/actions/sandbox/rebuild-destroy-phase.test.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/rebuild-hermes-accepted-target.test.ts
  • src/lib/actions/sandbox/rebuild-onboard-dependencies.ts
  • src/lib/actions/sandbox/rebuild-pipeline.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.ts
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-reasoning.test.ts
  • src/lib/actions/sandbox/rebuild-resume-snapshot.test.ts
  • src/lib/actions/sandbox/rebuild-shields-finally.test.ts
  • src/lib/actions/sandbox/rebuild-target-runtime.ts
  • src/lib/adapters/openshell/gateway-drift.test.ts
  • src/lib/adapters/openshell/gateway-drift.ts
  • src/lib/advisories/checks/host/docker.test.ts
  • src/lib/advisories/checks/host/docker.ts
  • src/lib/advisories/checks/host/index.test.ts
  • src/lib/advisories/checks/host/runtime.test.ts
  • src/lib/advisories/checks/host/runtime.ts
  • src/lib/advisories/registry.test.ts
  • src/lib/advisories/registry.ts
  • src/lib/domain/docker-host.test.ts
  • src/lib/domain/docker-host.ts
  • src/lib/inference/nim.ts
  • src/lib/onboard.ts
  • src/lib/onboard/authoritative-rebuild-target.test.ts
  • src/lib/onboard/authoritative-rebuild-target.ts
  • src/lib/onboard/bridge-dns-preflight.ts
  • src/lib/onboard/docker-cdi.ts
  • src/lib/onboard/docker-driver-gateway-env.ts
  • src/lib/onboard/docker-driver-gateway-process-identity.test.ts
  • src/lib/onboard/docker-driver-gateway-process-identity.ts
  • src/lib/onboard/docker-driver-gateway-runtime.ts
  • src/lib/onboard/docker-driver-gateway-service-version-gate.test.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • src/lib/onboard/fatal-runtime-preflight.test.ts
  • src/lib/onboard/fatal-runtime-preflight.ts
  • src/lib/onboard/gateway-authority-checkpoint.test.ts
  • src/lib/onboard/gateway-authority-checkpoint.ts
  • src/lib/onboard/gateway-host-runtime-https.test.ts
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/onboard/gateway-host-runtime.ts
  • src/lib/onboard/gateway-http-readiness.ts
  • src/lib/onboard/machine/handlers/preflight.test.ts
  • src/lib/onboard/machine/handlers/preflight.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/machine/initial-flow-phases.ts
  • src/lib/onboard/openshell-cli.ts
  • src/lib/onboard/openshell-install.test.ts
  • src/lib/onboard/openshell-install.ts
  • src/lib/onboard/preflight-cdi.test.ts
  • src/lib/onboard/preflight-docker-host.test.ts
  • src/lib/onboard/preflight-messages.test.ts
  • src/lib/onboard/preflight-messages.ts
  • src/lib/onboard/preflight-readiness.test.ts
  • src/lib/onboard/preflight.test.ts
  • src/lib/onboard/preflight.ts
  • src/lib/onboard/remediation.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/runtime-provider/docker.test.ts
  • src/lib/onboard/runtime-provider/docker.ts
  • src/lib/onboard/sandbox-gpu-preflight.ts
  • src/lib/readiness/effects.test.ts
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts
  • src/lib/readiness/gateway.test.ts
  • src/lib/readiness/gateway.ts
  • src/lib/readiness/host-production.test.ts
  • src/lib/readiness/host.test.ts
  • src/lib/readiness/host.ts
  • src/lib/readiness/index.ts
  • src/lib/readiness/onboard-admission.test.ts
  • src/lib/readiness/onboard-admission.ts
  • src/lib/readiness/openshell-resolver.ts
  • src/lib/readiness/platform-qualification.test.ts
  • src/lib/readiness/platform-qualification.ts
  • src/lib/readiness/presentation.test.ts
  • src/lib/readiness/presentation.ts
  • src/lib/readiness/probe-env.test.ts
  • src/lib/readiness/probe-env.ts
  • src/lib/readiness/sanitize.ts
  • src/lib/readiness/system.test.ts
  • src/lib/readiness/system.ts
  • test/helpers/rebuild-flow-harness.ts
  • test/helpers/rebuild-flow-test-harness.ts
  • test/install-preflight.test.ts
  • test/mcp-destroy-lifecycle.test.ts

Comment thread scripts/install.sh
Comment thread src/lib/domain/docker-host.ts
Comment thread src/lib/onboard/docker-cdi.ts
Comment thread src/lib/onboard/docker-driver-gateway-service.ts
Comment thread src/lib/onboard/fatal-runtime-preflight.test.ts
Comment thread src/lib/readiness/openshell-resolver.ts Outdated
Comment thread src/lib/readiness/platform-qualification.ts
Comment thread src/lib/readiness/probe-env.ts Outdated
Comment thread src/lib/readiness/probe-env.ts
Comment thread src/lib/readiness/system.test.ts

@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/onboard.ts`:
- Around line 1405-1406: Remove the duplicate collectOnboardGatewayReadiness
declarations in src/lib/onboard.ts, retaining exactly one implementation that
delegates to preflightGatewayAuthority.collectOnboardGatewayReadiness with the
existing gatewayName, gatewayPort, resolveOwner, and probeAttachment arguments.

In `@src/lib/onboard/machine/preflight-gateway-authority.ts`:
- Around line 59-71: Apply the canonical gateway-readiness admission to the
refreshed gateway projection before computing externallySupervised or invoking
failFastOnForeignGatewayPortConflict in the preflight flow. Ensure blocking,
conflicting, or inconclusive refreshed states fail closed and prevent reuse and
lifecycle handling. Add coverage verifying a blocking refreshed projection stops
processing before those operations run.
🪄 Autofix

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: a38ddd7d-b4e4-46b9-9628-a602039d1fd5

📥 Commits

Reviewing files that changed from the base of the PR and between 7cf47be and 1de4e7b.

📒 Files selected for processing (9)
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/fatal-runtime-preflight.test.ts
  • src/lib/onboard/machine/handlers/preflight.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/machine/preflight-gateway-authority.ts
  • src/lib/onboard/runtime-provider/docker.test.ts
  • src/lib/readiness/gateway-production.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.test.ts
  • src/lib/onboard/runtime-provider/docker.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts

Comment thread src/lib/onboard.ts
Comment thread src/lib/onboard/machine/preflight-gateway-authority.ts

@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/onboard/fatal-runtime-preflight.ts (1)

342-355: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the repeated refresh-and-admit block.

Lines 342-355 and Lines 384-394 repeat the same five steps: refresh the gateway projection, assert gateway admission, recompute managedGatewayReadiness, compose the system report, and assert system admission. One helper that takes the current gatewayReadiness and refreshedResult and returns the composed report plus the managed flag would remove the duplication and keep the two gates identical if the policy changes.

Also applies to: 384-394

🤖 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/onboard/fatal-runtime-preflight.ts` around lines 342 - 355, The
refresh-and-admit sequence is duplicated in the onboarding flow. Extract a
helper near the existing readiness logic that accepts the current
gatewayReadiness and refreshedResult, performs
refreshGatewayReadinessProjection, assertOnboardGatewayReadiness, managed
readiness calculation, composeSystemReadinessReport, and
assertOnboardSystemReadiness, then returns the composed report and
managedGatewayReadiness; replace both blocks around the current and resumed
paths with this helper while preserving their existing options and context.
🤖 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/onboard/fatal-runtime-preflight.ts`:
- Around line 342-355: The refresh-and-admit sequence is duplicated in the
onboarding flow. Extract a helper near the existing readiness logic that accepts
the current gatewayReadiness and refreshedResult, performs
refreshGatewayReadinessProjection, assertOnboardGatewayReadiness, managed
readiness calculation, composeSystemReadinessReport, and
assertOnboardSystemReadiness, then returns the composed report and
managedGatewayReadiness; replace both blocks around the current and resumed
paths with this helper while preserving their existing options and context.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fee0bb32-8dd8-4dac-b485-3534710f3d26

📥 Commits

Reviewing files that changed from the base of the PR and between acf810d and 1de4e7b.

📒 Files selected for processing (106)
  • ci/platform-matrix.json
  • ci/source-architecture-budget.json
  • ci/source-shape-test-budget.json
  • ci/test-file-size-budget.json
  • docs/about/how-it-works.mdx
  • docs/inference/choose-inference-provider.mdx
  • docs/reference/commands.mdx
  • docs/reference/platform-support.mdx
  • docs/reference/system-readiness.mdx
  • scripts/install.sh
  • src/commands/host/probe.test.ts
  • src/commands/host/probe.ts
  • src/lib/actions/sandbox/gateway-target.ts
  • src/lib/actions/sandbox/rebuild-destroy-phase.test.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/rebuild-hermes-accepted-target.test.ts
  • src/lib/actions/sandbox/rebuild-onboard-dependencies.ts
  • src/lib/actions/sandbox/rebuild-pipeline.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.ts
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-reasoning.test.ts
  • src/lib/actions/sandbox/rebuild-resume-snapshot.test.ts
  • src/lib/actions/sandbox/rebuild-shields-finally.test.ts
  • src/lib/actions/sandbox/rebuild-target-runtime.ts
  • src/lib/adapters/openshell/gateway-drift.test.ts
  • src/lib/adapters/openshell/gateway-drift.ts
  • src/lib/advisories/checks/host/docker.test.ts
  • src/lib/advisories/checks/host/docker.ts
  • src/lib/advisories/checks/host/index.test.ts
  • src/lib/advisories/checks/host/runtime.test.ts
  • src/lib/advisories/checks/host/runtime.ts
  • src/lib/advisories/registry.test.ts
  • src/lib/advisories/registry.ts
  • src/lib/domain/docker-host.test.ts
  • src/lib/domain/docker-host.ts
  • src/lib/inference/nim.ts
  • src/lib/onboard.ts
  • src/lib/onboard/authoritative-rebuild-target.test.ts
  • src/lib/onboard/authoritative-rebuild-target.ts
  • src/lib/onboard/bridge-dns-preflight.ts
  • src/lib/onboard/docker-cdi.ts
  • src/lib/onboard/docker-driver-gateway-env.ts
  • src/lib/onboard/docker-driver-gateway-process-identity.test.ts
  • src/lib/onboard/docker-driver-gateway-process-identity.ts
  • src/lib/onboard/docker-driver-gateway-runtime.ts
  • src/lib/onboard/docker-driver-gateway-service-version-gate.test.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • src/lib/onboard/fatal-runtime-preflight.test.ts
  • src/lib/onboard/fatal-runtime-preflight.ts
  • src/lib/onboard/gateway-authority-checkpoint.test.ts
  • src/lib/onboard/gateway-authority-checkpoint.ts
  • src/lib/onboard/gateway-host-runtime-https.test.ts
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/onboard/gateway-host-runtime.ts
  • src/lib/onboard/gateway-http-readiness.ts
  • src/lib/onboard/machine/handlers/preflight.test.ts
  • src/lib/onboard/machine/handlers/preflight.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/machine/initial-flow-phases.ts
  • src/lib/onboard/machine/preflight-gateway-authority.ts
  • src/lib/onboard/openshell-cli.ts
  • src/lib/onboard/openshell-install.test.ts
  • src/lib/onboard/openshell-install.ts
  • src/lib/onboard/preflight-cdi.test.ts
  • src/lib/onboard/preflight-docker-host.test.ts
  • src/lib/onboard/preflight-messages.test.ts
  • src/lib/onboard/preflight-messages.ts
  • src/lib/onboard/preflight-readiness.test.ts
  • src/lib/onboard/preflight.test.ts
  • src/lib/onboard/preflight.ts
  • src/lib/onboard/remediation.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/runtime-provider/docker.test.ts
  • src/lib/onboard/runtime-provider/docker.ts
  • src/lib/onboard/sandbox-gpu-preflight.ts
  • src/lib/readiness/effects.test.ts
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts
  • src/lib/readiness/gateway.test.ts
  • src/lib/readiness/gateway.ts
  • src/lib/readiness/host-production.test.ts
  • src/lib/readiness/host.test.ts
  • src/lib/readiness/host.ts
  • src/lib/readiness/index.ts
  • src/lib/readiness/onboard-admission.test.ts
  • src/lib/readiness/onboard-admission.ts
  • src/lib/readiness/openshell-resolver.ts
  • src/lib/readiness/platform-qualification.test.ts
  • src/lib/readiness/platform-qualification.ts
  • src/lib/readiness/presentation.test.ts
  • src/lib/readiness/presentation.ts
  • src/lib/readiness/probe-env.test.ts
  • src/lib/readiness/probe-env.ts
  • src/lib/readiness/sanitize.ts
  • src/lib/readiness/system.test.ts
  • src/lib/readiness/system.ts
  • test/helpers/rebuild-flow-harness.ts
  • test/helpers/rebuild-flow-test-harness.ts
  • test/install-preflight.test.ts
  • test/mcp-destroy-lifecycle.test.ts
🚧 Files skipped from review as they are similar to previous changes (99)
  • src/lib/onboard/bridge-dns-preflight.ts
  • src/lib/onboard/openshell-install.test.ts
  • src/lib/advisories/checks/host/docker.test.ts
  • scripts/install.sh
  • ci/source-shape-test-budget.json
  • docs/reference/commands.mdx
  • src/lib/actions/sandbox/rebuild-shields-finally.test.ts
  • src/lib/readiness/presentation.test.ts
  • src/lib/advisories/checks/host/docker.ts
  • src/lib/onboard/docker-driver-gateway-env.ts
  • src/lib/actions/sandbox/gateway-target.ts
  • src/lib/onboard/preflight-messages.ts
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/advisories/checks/host/index.test.ts
  • src/lib/readiness/probe-env.test.ts
  • src/lib/onboard/preflight-messages.test.ts
  • src/lib/onboard/remediation.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/onboard/docker-cdi.ts
  • docs/about/how-it-works.mdx
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.test.ts
  • src/commands/host/probe.ts
  • src/lib/onboard/openshell-cli.ts
  • src/lib/readiness/host-production.test.ts
  • ci/test-file-size-budget.json
  • src/lib/readiness/effects.test.ts
  • src/lib/domain/docker-host.test.ts
  • src/lib/actions/sandbox/rebuild-target-runtime.ts
  • src/lib/onboard/machine/handlers/preflight.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.test.ts
  • src/lib/onboard/docker-driver-gateway-service.test.ts
  • src/lib/actions/sandbox/rebuild-onboard-dependencies.ts
  • src/lib/readiness/index.ts
  • src/lib/actions/sandbox/rebuild-pipeline.ts
  • src/lib/onboard/runtime-provider/docker.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/onboard/authoritative-rebuild-target.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/actions/sandbox/rebuild-hermes-accepted-target.test.ts
  • test/mcp-destroy-lifecycle.test.ts
  • docs/inference/choose-inference-provider.mdx
  • src/lib/onboard/docker-driver-gateway-service-version-gate.test.ts
  • src/lib/onboard/preflight-docker-host.test.ts
  • src/lib/onboard/machine/handlers/preflight.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
  • src/lib/readiness/openshell-resolver.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/advisories/checks/host/runtime.test.ts
  • src/lib/onboard/preflight-cdi.test.ts
  • src/lib/advisories/registry.test.ts
  • src/lib/onboard/docker-driver-gateway-service.ts
  • src/lib/actions/sandbox/rebuild-recreate-journal.ts
  • src/lib/readiness/onboard-admission.ts
  • test/install-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-reasoning.test.ts
  • src/lib/readiness/sanitize.ts
  • src/lib/onboard/gateway-host-runtime.ts
  • src/lib/advisories/registry.ts
  • src/lib/actions/sandbox/rebuild-resume-snapshot.test.ts
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway.ts
  • src/lib/onboard/gateway-authority-checkpoint.test.ts
  • src/lib/onboard/machine/preflight-gateway-authority.ts
  • src/lib/inference/nim.ts
  • src/lib/readiness/platform-qualification.ts
  • src/lib/actions/sandbox/rebuild-destroy-phase.test.ts
  • src/commands/host/probe.test.ts
  • src/lib/onboard/openshell-install.ts
  • src/lib/onboard/docker-driver-gateway-runtime.ts
  • src/lib/readiness/host.test.ts
  • src/lib/onboard/docker-driver-gateway-process-identity.test.ts
  • src/lib/readiness/platform-qualification.test.ts
  • src/lib/onboard/authoritative-rebuild-target.test.ts
  • src/lib/readiness/gateway.test.ts
  • src/lib/onboard/gateway-authority-checkpoint.ts
  • src/lib/onboard/machine/initial-flow-phases.ts
  • src/lib/onboard/fatal-runtime-preflight.test.ts
  • src/lib/onboard/runtime-provider/docker.ts
  • src/lib/onboard/gateway-http-readiness.ts
  • docs/reference/platform-support.mdx
  • src/lib/advisories/checks/host/runtime.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/preflight.test.ts
  • src/lib/readiness/presentation.ts
  • ci/source-architecture-budget.json
  • src/lib/onboard/preflight.ts
  • src/lib/adapters/openshell/gateway-drift.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/onboard/gateway-host-runtime-https.test.ts
  • src/lib/onboard/preflight-readiness.test.ts
  • src/lib/readiness/host.ts
  • test/helpers/rebuild-flow-test-harness.ts
  • src/lib/onboard.ts
  • ci/platform-matrix.json
  • src/lib/adapters/openshell/gateway-drift.ts
  • src/lib/onboard/sandbox-gpu-preflight.ts
  • test/helpers/rebuild-flow-harness.ts
  • src/lib/readiness/system.ts
  • src/lib/domain/docker-host.ts

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

@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: 1

🤖 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 `@test/rebuild-credential-preflight.test.ts`:
- Around line 54-55: Update the gateway startup flow in the rebuild credential
preflight test to request an operating-system-assigned port by starting the
child with port 0. Read the assigned port from the readiness marker, then derive
gatewayName, registry data, and command mocks from that assigned port instead of
process.pid and gatewayPortSequence.
🪄 Autofix

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: 7bb6119c-08bd-49f8-9221-fd5d7b0a727b

📥 Commits

Reviewing files that changed from the base of the PR and between 1de4e7b and fed4590.

📒 Files selected for processing (1)
  • test/rebuild-credential-preflight.test.ts

Comment thread test/rebuild-credential-preflight.test.ts Outdated
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Comment thread test/rebuild-credential-preflight.test.ts Fixed
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

@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: 3

🧹 Nitpick comments (1)
src/lib/onboard/machine/preflight-gateway-authority.ts (1)

39-43: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Tie gatewayPort to GatewayOwner.

The current caller passes the same value to both parameters, but the contract permits divergence. Derive the port from the resolved owner to make this invariant explicit, and test that the conflict check uses owner.gatewayPort.

🤖 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/onboard/machine/preflight-gateway-authority.ts` around lines 39 - 43,
Update EarlyGatewayPortConflictDeps and its conflict-check flow to derive the
port from resolveOwner()’s returned GatewayOwner instead of accepting a separate
gatewayPort value. Use owner.gatewayPort when invoking the conflict check,
remove the redundant dependency field, and add coverage verifying the owner’s
port is used.
🤖 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/onboard/machine/preflight-gateway-authority.ts`:
- Around line 45-54: Remove the legacy early port fast-fail helper
failFastOnEarlyGatewayPortConflict and its duplicate invocation from
preparePreflightGatewayAuthority, allowing collectOnboardGatewayReadiness to
perform canonical admission and emit structured gateway findings. Do not retain
the readiness-path exit unless a bounded compatibility window, retirement issue,
and exit criteria are explicitly documented.

In `@test/gateway-state-reconcile-2276.test.ts`:
- Line 294: Update the gateway fixture setup around gatewayPort and the listener
binding to use an ephemeral port (0), then read the listener’s assigned port and
consistently pass that value to the registry, gateway fixtures, and Docker
inspection response instead of hard-coding 8080.
- Around line 290-299: Update the docker inspect stub in the inspect branch to
parse the requested container target, accept only the expected gateway
container, and reject unexpected targets. Also validate the requested format
before returning each mocked gateway value, preserving the existing responses
only for recognized target-and-format combinations.

---

Nitpick comments:
In `@src/lib/onboard/machine/preflight-gateway-authority.ts`:
- Around line 39-43: Update EarlyGatewayPortConflictDeps and its conflict-check
flow to derive the port from resolveOwner()’s returned GatewayOwner instead of
accepting a separate gatewayPort value. Use owner.gatewayPort when invoking the
conflict check, remove the redundant dependency field, and add coverage
verifying the owner’s port is used.
🪄 Autofix

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: 6b4a3a98-7b02-42ff-973f-37463151c789

📥 Commits

Reviewing files that changed from the base of the PR and between 8c18ba6 and 9d3cc5c.

📒 Files selected for processing (6)
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/machine/preflight-gateway-authority.ts
  • test/exit-code-user-error-surfaces.test.ts
  • test/gateway-state-reconcile-2276.test.ts
  • test/onboard-inference-reconciliation.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/onboard.ts

Comment thread src/lib/onboard/machine/preflight-gateway-authority.ts Outdated
Comment thread test/gateway-state-reconcile-2276.test.ts Outdated
Comment thread test/gateway-state-reconcile-2276.test.ts Outdated
@cv
cv merged commit f042117 into main Aug 10, 2026
75 of 79 checks passed
@cv
cv deleted the codex/readiness-convergence-7411 branch August 10, 2026 17:44
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: networking DNS, proxy, TLS, ports, host aliases, or connectivity area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images platform: jetson Affects Jetson AGX Thor or Orin labels Aug 10, 2026
jyaunches added a commit that referenced this pull request Aug 11, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Installer host preflight adopted canonical readiness admission in #8738
but hardcoded storage remediation off. Managed Docker
overlayfs/containerd hosts therefore exited before onboarding could
build the documented `fuse-overlayfs` replacement image. This change
derives the waiver from canonical gateway lifecycle authority, keeps
external, invalid, and non-remediable states blocked, and reports
bounded admission IDs when preflight fails.

The first manual PR E2E run then exposed a separate parser mismatch
after installer preflight: the generic GPU host reported valid NVIDIA
driver `595.84`, while the detector required exactly three numeric
components. The bounded follow-up accepts two- or three-component NVIDIA
versions without changing the minimum, resolver, schema, or supported
surface.

## Changes

- Allow the installer storage exception only when the canonical
gateway-management declaration is valid and absent or explicitly
`nemoclaw-managed`; normal onboarding revalidates that authority before
lifecycle effects.
- Print deduplicated finding and capability IDs that satisfy the
readiness schema's stable-ID grammar and length limit.
- Cover absent and explicit managed authority, external supervision,
invalid authority, non-remediable storage, onboarding continuation, and
unsafe diagnostic input in installer integration tests.
- Accept bounded two- or three-component NVIDIA driver versions while
retaining numeric comparison, identical multi-GPU inventory, and
fail-closed malformed-input behavior.

## 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
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: this restores the documented
managed-only storage remediation path and accepts a valid NVIDIA driver
form above the existing documented `580.65.06` minimum. It adds no
command, configuration, schema, minimum, or support claim.
- [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: an independent Codex
Desktop review of exact head `4d78d7355` on base `acda7aa22` passed all
nine security categories with no findings. It verified canonical
authority parsing and revalidation, managed-only lifecycle effects,
fail-closed external/invalid/non-remediable states, sanitized admission
IDs, and strict bounded driver parsing.
- [ ] 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: `no-docs-needed`
- Evidence: `docs/get-started/prerequisites.mdx`,
`docs/reference/system-readiness.mdx`, and
`docs/deployment/gateway-lifecycle-authority.mdx` already document
managed storage remediation and external lifecycle authority.
`docs/inference/set-up-llama-cpp.mdx` already requires NVIDIA driver
version `580.65.06` or later; accepting valid two- or three-component
versions restores that contract. The generic Linux preset remains
explicit-only and experimental.
- Agent: Codex Desktop
<!-- docs-review-head-sha: 4d78d73 -->
<!-- docs-review-agents-blob-sha: fca0e02 -->

## 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 validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result:
- `npm exec -- vitest run --project installer-integration
test/install-preflight.test.ts --maxWorkers=4` — exact reviewed patch
passed 98/99; the unrelated five-second release-tag fixture timed out,
then passed alone 1/1. The six changed readiness cases passed, and the
byte-identical pre-merge candidate passed 99/99 under the same worker
limit.
- `npm exec -- vitest run --project cli
src/lib/inference/nim-driver-version.test.ts
src/lib/inference/llama-cpp/managed-selection.test.ts
src/lib/inference/serving/resolver.test.ts` — 49/49 passed.
- `npm exec -- vitest run --project e2e-support
test/e2e/support/base-image-publication.test.ts` — 39/39 passed after
merging upstream repairs #8771 and #8772.
- `npm run test:changed` — passed; the clean checkout selected no CLI,
plugin, or E2E-support source tests and the integrated growth contract
passed 4/4.
- `npm run validate:pr` — passed all pre-commit, commit-message, and
pre-push checks at exact head.
- The requested `npm exec -- vitest run --project integration
test/install-preflight.test.ts` reports no matching tests because
project membership assigns this file to `installer-integration`; the
owning lane is recorded above.
- Ordinary manual PR E2E [run
31444706504](https://github.com/NVIDIA/NemoClaw/actions/runs/31444706504)
passed six of the seven installer-path jobs at the prior head.
`llama-cpp-generic-gpu` passed installer preflight and exposed the
two-component driver parser mismatch fixed here. Exact-head E2E is
pending.
- [ ] 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 these
bounded installer-admission and driver-parser changes; targeted
installer and CLI suites plus required CI are the applicable evidence.
- [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)

---

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Installer preflight now limits storage remediation to supported,
explicitly managed gateway configurations.
- Host-admission failures provide validated, deduplicated finding and
capability identifiers alongside existing diagnostics.
- Installer onboarding behavior and failure reporting are now more
consistent across gateway lifecycle states.
- NVIDIA driver detection more reliably handles repeated version output
and rejects malformed or contaminated results.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
cv pushed a commit that referenced this pull request Aug 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary

This refactor removes five formatter exemptions that survived the
entrypoint-budget work in #8738. It moves the default OpenShell
installation and readiness/gateway-authority dependency assembly into
the existing modules that own those contracts.

The install, trusted authority checkpoint, readiness, port-conflict, and
gateway-reuse order is unchanged. `src/lib/onboard.ts` becomes one line
smaller, its measured fan-out falls from 211 to 210, and no
configuration or supported behavior changes.

## Changes

- Add a typed OpenShell onboarding binding for the existing install and
binary-presence paths.
- Add a typed preflight gateway-authority binding for the existing
readiness, authority, port-conflict, and reuse paths.
- Preserve the existing readiness-collector override seam through
explicit dependency injection.
- Replace compressed `onboard.ts` wiring with formatted calls and remove
five growth-guardrail formatter suppressions.
- Add focused tests for lazy dependency resolution, trusted-owner
persistence, dynamic gateway values, custom rebuild exit handling, and
the preserved preflight event order.
- Route authoritative rebuild through the same readiness-authority seam
instead of retaining a parallel fatal-preflight call.

The current consumers are the standard onboarding preflight and
authoritative rebuild readiness paths. Existing owner modules now
assemble their canonical dependencies; no new extension or configuration
surface is introduced.

## 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
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: No flag, environment
variable, default, output, public API, persistence schema, lifecycle
effect, or failure order changes.
- [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: Codex Desktop completed
the exact-head nine-category review with PASS in every category and no
findings:
#8909 (comment)
- [ ] 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: `no-docs-needed`
- Evidence: Existing system-readiness, command-reference, recovery, and
troubleshooting pages already document the preserved install,
authority-recording, readiness, port-conflict, and reuse order; the
follow-up only completes the internal readiness-authority cutover.
- Agent: Codex Desktop
<!-- docs-review-head-sha: a1dad11 -->
<!-- docs-review-agents-blob-sha: c4923a3 -->

## 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 validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — 82 focused assertions passed across
OpenShell install, gateway-authority preflight, fatal readiness,
readiness presentation, gateway sequence, checkpoint, and host-runtime
contracts; the exact-head authority unit test passes 2/2 and proves the
rebuild exit handler reaches the canonical preflight context; `npm run
build:cli`, `npm run typecheck:cli`, source architecture, source shape,
and test-size checks passed. The existing macOS integration test
advances past the readiness-collector regression and then encounters an
unrelated host Homebrew trust probe; the Linux CI rerun is
authoritative.
- [ ] 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
focused internal dependency-wiring refactor.
- [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)

---
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

---------

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
prekshivyas added a commit that referenced this pull request Aug 18, 2026
…9325)

<!-- markdownlint-disable MD041 -->
## Summary

A readiness collection stamped its start time, so a probe slower than
the 30-second reuse window aged out the facts it had just gathered, and
no retry could succeed. Rebuild then had no working path at all: a
running gateway failed the readiness gate, and a stopped gateway failed
the route check, because a gateway that could not answer was treated as
a route mismatch. The window now starts when collection finishes, the
preflight checkpoints collect gateway facts again instead of rescoring
an old snapshot, and only a genuine provider or model mismatch stops a
rebuild.

## Related Issue

Fixes #9310

## Changes

- Measure the host and gateway reuse window from collection completion.
`collectGatewayObservations` and `collectHostObservations` record
`completedAt`, and `projectGatewayReadiness` and `projectHostReadiness`
measure age from it. An observation set held past the window while
another collection runs is still rejected.
- Replace `refreshGatewayReadinessProjection` with a real collection at
both preflight checkpoints in `runReadinessGatedRuntimePreflight`. The
removed function rescored the original snapshot against a newer clock,
so it could only ever downgrade a projection and never re-observe. This
costs two extra gateway collections per onboarding or rebuild run.
- Separate a gateway that cannot answer the route query from one that
answers with another provider and model. `readInferenceRouteState`
returns `matched`, `mismatched`, or `unanswered`, and
`preflightAuthoritativeRebuildTarget` stops only on `mismatched`. An
unanswerable gateway defers to authoritative onboarding, which
configures and verifies the recorded route before it recreates the
sandbox.
- Remove the `reusable` snapshot flag from both collectors. No collector
ever set it to `true`, so the staleness guard that read it was
unconditional and its exemption was unreachable. Removing it changes no
behavior.
- Record the measured age and the applied window on `host.probe.stale`
and `gateway.probe.stale`, and the gateway collection duration as
`collectionMs` on `gateway.owner`. The previous report stated only that
the window was exceeded, which left the reported failure undiagnosable.
- Add `src/lib/readiness/observation-age.ts`. Its current consumers are
`src/lib/readiness/gateway.ts` and `src/lib/readiness/host.ts`, which
applied the same window rule and emitted the same evidence separately.
`src/lib/readiness/gateway.test.ts`, `src/lib/readiness/host.test.ts`,
and `src/lib/readiness/system.test.ts` protect the shared behavior.

- Synchronize the branch with current `main` and pass the messaging
dependency object through recorded-channel reuse. This fixes the
TypeScript failure from the merged #9296 interaction; the affected
messaging tests protect the dependency contract.
- Retain raw host and gateway snapshots through runtime admission,
project both against one final clock, recollect host facts that age out
during gateway collection, and fail closed if the paired gateway facts
then age out. The readiness-gated preflight tests cover both outcomes.

This reverses the slow-collection rejection introduced by #8738, which
closed #7411. That issue converges onboarding, gateway diagnostics, and
doctor on shared readiness checks; it requires revalidating
non-resume-safe facts before effects, and does not require rejecting a
collection for its own duration. Both of that issue's freshness
requirements still hold. One property does change: a collection whose
probes span longer than the window carries that much skew between its
first and last fact, and no longer stops the run. `collectionMs` reports
that duration instead.

## Type of Change

- [ ] Code change (feature, bug fix, or refactor)
- [x] 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
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [x] 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:

## 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 validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: `npx
vitest run --project cli src/lib/readiness/
src/lib/onboard/inference-route.test.ts
src/lib/onboard/authoritative-rebuild-target.test.ts
src/lib/onboard/fatal-runtime-preflight.test.ts` — 283 passed, 14 files.
`npx vitest run --project integration
test/rebuild-credential-preflight.test.ts
test/rebuild-credential-hydration.test.ts
test/onboard-inference-reconciliation.test.ts
test/onboard-pre-destructive-intent.test.ts` — 31 passed. `npx tsc -p
tsconfig.cli.json` — clean. Follow-up repair: `npm run build:cli` —
passed; `npx vitest run --project cli
src/lib/onboard/fatal-runtime-preflight.test.ts
src/lib/onboard/machine/preflight-gateway-authority.test.ts
src/lib/onboard/machine/handlers/sandbox-messaging.test.ts` — 60 passed;
`npm run checks:repository` — passed.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [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)
- [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)

---
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
  * Improved sandbox rebuild validation for inference route changes.
* Rebuilds can proceed when route information is temporarily
unavailable, with recovery setup verifying the recorded provider and
model.
* Improved runtime readiness by recollecting expired host and gateway
observations.
* Slow readiness checks now use collection completion time to reduce
false staleness reports.

* **Documentation**
* Updated rebuild and system-readiness guidance for route correction and
the 30-second observation reuse window.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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: networking DNS, proxy, TLS, ports, host aliases, or connectivity area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images platform: jetson Affects Jetson AGX Thor or Orin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Readiness 5/5] Converge onboarding, gateway diagnostics, and doctor on readiness checks

4 participants