Skip to content

fix(onboard): preserve truthful review recovery - #8724

Open
yimoj wants to merge 17 commits into
mainfrom
fix/8686-onboard-cancellation-status
Open

fix(onboard): preserve truthful review recovery#8724
yimoj wants to merge 17 commits into
mainfrom
fix/8686-onboard-cancellation-status

Conversation

@yimoj

@yimoj yimoj commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Onboarding now reports configuration-review cancellation as incomplete and preserves interrupted review state for resume. A no-TTY onboard --resume --yes reuses the saved selection without an inappropriate prompt, while interactive resume presents the review again.

Related Issue

Fixes #8686
Fixes #8687

Changes

  • Return a nonzero status when the user rejects configuration review, and keep explicit rejection separate from SIGINT and EOF.
  • Persist the selected sandbox, provider, and model before review so SIGINT leaves a coherent resumable session.
  • Reuse interrupted review state on resume. Interactive resume shows review again; no-TTY resume with --yes auto-confirms it.
  • Keep no-TTY auto-confirm behavior scoped to resume. Fresh onboarding and unrelated commands retain their existing interaction policy.
  • Prepare local Ollama proxy state only after review acceptance. The accepted path starts, reads, persists, and probes once; provider setup consumes that prepared token, while recovery callers without prepared state retain a bounded fallback.
  • Add regression coverage for interactive acceptance and rejection, SIGINT, EOF, no-TTY auto-confirm, session identity, resume conflicts, installer status propagation, and fail-closed Ollama proxy preparation.
  • Large-change flag: +1,191/-159 across 28 files; most of the increase is recovery-state and production-wiring test coverage.

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: Existing headless-server documentation already uses the corrected no-TTY --resume --yes-i-accept-third-party-software --yes workflow. No flag, command, default, or documented workflow changed.
  • 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: The completed nine-category review found no issues: fix(onboard): preserve truthful review recovery #8724 (comment)
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: Existing documentation already covers configuration review and decline, resumable selections, headless resume, and the Ollama proxy lifecycle. The final change only defers proxy preparation until review acceptance and removes duplicate lifecycle operations. npm run docs:sync-agent-variants passed; npm run docs completed with 0 errors and 2 existing Fern warnings.
  • 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 — the final affected suite passed 160 tests and the focused proxy/review lifecycle suite passed 30 tests; CLI type-checking, Biome, test-size, source-shape, conditional-structure, repository, commit-message, and pre-push gates passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: the earlier broad run completed 27,693 tests with 78 unrelated integration failures; the current branch must still pass all required GitHub gates before merge
  • 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) — the build completed with 0 errors and 2 existing Fern warnings unrelated to this change
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Yimo Jiang yimoj@nvidia.com

Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
@yimoj yimoj 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

Onboarding now derives resume and non-interactive state, persists sandbox identity asynchronously, records rejected provider selections as failed sessions, and recovers provider reviews before inference setup. Tests cover TTY, resume, rejection, checkpoint ordering, and Ollama preparation.

Changes

Onboarding recovery

Layer / File(s) Summary
Entry and resume classification
src/lib/core/non-interactive.test.ts, src/lib/onboard/entry-options.ts, src/lib/onboard/entry-options.test.ts, src/lib/onboard.ts
Resume and non-interactive state now use persisted session status, auto-yes options, environment values, and terminal capabilities.
Sandbox identity checkpointing
src/lib/onboard/sandbox-agent.ts, src/lib/onboard/session-bootstrap.ts, src/lib/onboard/resume-config.ts, src/lib/onboard/*test.ts, test/onboard-inference-reconciliation.test.ts
Sandbox identity persistence is asynchronous. Resume logic uses canonical checkpoint identity and supports persisted agent identities.
Rejected provider-selection state
src/lib/state/onboard-session.ts, src/lib/state/onboard-session.test.ts, src/lib/onboard/machine/runtime.ts, src/lib/onboard/runtime-boundary.ts, src/lib/onboard/*boundary.test.ts
Provider-selection rejection clears related state, marks the session failed, disables resumability, and propagates through runtime recorders.
Provider review and inference recovery
src/lib/onboard/machine/handlers/provider-inference.ts, src/lib/onboard/setup-inference.ts, src/lib/onboard.ts, src/lib/onboard/machine/handlers/*test*, src/lib/onboard/machine/*test.ts
Provider selections are persisted before setup, rejected reviews exit with status 1, recovered reviews finalize after successful setup, and local Ollama preparation runs before inference.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant runOnboard
  participant ProviderInference
  participant SessionState
  participant OllamaProxy
  Operator->>runOnboard: start or resume onboarding
  runOnboard->>ProviderInference: pass review context and dependencies
  ProviderInference->>SessionState: checkpoint sandbox and provider selection
  ProviderInference->>SessionState: record rejection or accepted selection
  ProviderInference->>OllamaProxy: prepare local provider when configured
  OllamaProxy-->>ProviderInference: return prepared inference route
Loading

Suggested reviewers: cv, apurvvkumaria, ericksoa

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.55% 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 address interrupted-review exit status and no-TTY resume auto-confirmation requirements from issues [#8686] and [#8687].
Out of Scope Changes check ✅ Passed The implementation and tests remain focused on onboarding review recovery, session persistence, resume behavior, and related provider setup.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preserving accurate onboarding review recovery behavior.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/8686-onboard-cancellation-status

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 ed7271d in the fix/8686-onboard-can... branch remains at 96%, unchanged from commit 0cddc38 in the main branch.


Updated August 11, 2026 08:32 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/onboard/session-bootstrap.ts (1)

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

Prefix the retained unused parameter.

The changed recovery logic no longer reads agent. Rename the parameter on Line 86 to _agent if the three-argument API must remain compatible.

As per coding guidelines, “prefix intentionally unused variables with _.”

Proposed fix
 export function getCheckpointedSandboxName(
   resume: boolean,
-  agent: { name?: string } | null,
+  _agent: { name?: string } | null,
   session: Session | null,
 ): string | null {
🤖 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/session-bootstrap.ts` at line 95, Rename the unused agent
parameter in the recovery function to _agent while preserving the existing
three-argument API and behavior.

Source: Coding guidelines

🤖 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 4189-4204: Make prepareLocalProviderForInference the only Ollama
proxy preparation path: remove or bypass the proxy startup in
startProxyOrAnnounceDirect and the
ensureOllamaAuthProxy/persistAndProbeOllamaProxy calls in
setupOllamaLocalInference. Ensure proxy preparation occurs only after
configuration review acceptance through the existing
prepareLocalProviderForInference hook.
- Around line 3770-3807: Add public CLI coverage for the onboarding entry flow
around isOnboardAutoYesNonInteractive: exercise onboard --resume --yes with
stdin/stdout reported as non-TTY, and verify fresh --yes behavior without a TTY.
Do not pass --non-interactive in these cases, and assert the resulting mode and
behavior through the public CLI interface.

---

Nitpick comments:
In `@src/lib/onboard/session-bootstrap.ts`:
- Line 95: Rename the unused agent parameter in the recovery function to _agent
while preserving the existing three-argument API and 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: e7f3c176-57b9-49be-9fbf-92ea467636de

📥 Commits

Reviewing files that changed from the base of the PR and between b414e22 and a29cebe.

📒 Files selected for processing (21)
  • src/lib/core/non-interactive.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/machine/core-flow-phases.test.ts
  • src/lib/onboard/machine/handlers/provider-inference-route-containment.test.ts
  • src/lib/onboard/machine/handlers/provider-inference.test-support.ts
  • src/lib/onboard/machine/handlers/provider-inference.test.ts
  • src/lib/onboard/machine/handlers/provider-inference.ts
  • src/lib/onboard/machine/runtime.ts
  • src/lib/onboard/no-tty-auto-yes.test.ts
  • src/lib/onboard/no-tty-auto-yes.ts
  • src/lib/onboard/resume-config.test.ts
  • src/lib/onboard/resume-config.ts
  • src/lib/onboard/runtime-boundary.test.ts
  • src/lib/onboard/runtime-boundary.ts
  • src/lib/onboard/sandbox-agent.test.ts
  • src/lib/onboard/sandbox-agent.ts
  • src/lib/onboard/session-bootstrap.test.ts
  • src/lib/onboard/session-bootstrap.ts
  • src/lib/state/onboard-session.test.ts
  • src/lib/state/onboard-session.ts

Comment thread src/lib/onboard.ts Outdated
Comment thread src/lib/onboard.ts Outdated
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

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

Advisory only. These are normalized differences from the primary terminology receipt.

  • review recovery at src/lib/onboard/machine/handlers/provider-review-recovery.test.ts:11: primary classified it as replace; the second opinion classified it as define.
1 additional E2E selection from the second opinion

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

  • spark-install: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

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

2 semantic terminology decisions

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

  • define — configuration review at src/lib/onboard/machine/handlers/provider-inference.ts:70: Define configuration review at its first explanatory use as the user confirmation stage after provider selection and before inference setup.
  • replace — review recovery at src/lib/onboard/machine/handlers/provider-review-recovery.test.ts:11: Use "provider inference recovery after configuration review" as the test-suite title.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: managed-image-protected-runtime, inference-routing

Manual-only E2E: cloud-onboard, managed-image-multiarch-startup, network-policy, onboard-repair, onboard-resume
The manual PR workflow does not run these selectors for the commit under review. Run them from reviewed code on main.

1 optional E2E recommendation
  • ollama-auth-proxy

Workflow run details

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

@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: local-models Local model providers, downloads, launch, or connectivity area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression platform: dgx-spark Affects DGX Spark hardware or workflows labels Aug 10, 2026
yimoj added 2 commits August 11, 2026 02:18
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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/machine/handlers/provider-inference.test.ts (1)

1451-1483: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the replacement selection outcome.

This test passes if handleProviderInferenceState calls setupNim but returns without configuring a replacement inference route. Assert that the result contains the newly selected provider and model. Also assert that setupInference runs for that replacement. Keep the negative assertion for the rejected selection.

Proposed test strengthening
-    await handleProviderInferenceState({
+    const result = await handleProviderInferenceState({
       ...baseOptions(deps, session),
       resume: true,
       sandboxName: "rejected-review",
     });

     expect(calls.setupNim).toHaveBeenCalled();
+    expect(calls.setupInference).toHaveBeenCalled();
+    expect(result).toMatchObject({
+      provider: "nvidia-prod",
+      model: "nvidia/test",
+    });
     expect(calls.setupInference).not.toHaveBeenCalledWith(

As per path instructions, “Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions.”

🤖 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/provider-inference.test.ts` around lines
1451 - 1483, Strengthen the test around handleProviderInferenceState by
capturing its returned result and asserting it contains the newly selected
provider and model. Verify setupInference is called for that replacement
selection, while retaining the existing negative assertion that it is not called
with the explicitly rejected provider/model.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/lib/onboard/machine/handlers/provider-inference.test.ts`:
- Around line 1451-1483: Strengthen the test around handleProviderInferenceState
by capturing its returned result and asserting it contains the newly selected
provider and model. Verify setupInference is called for that replacement
selection, while retaining the existing negative assertion that it is not called
with the explicitly rejected provider/model.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ff9807aa-783c-4d01-9e6b-97cabb001c6f

📥 Commits

Reviewing files that changed from the base of the PR and between 5e3a38e and 838f0e7.

📒 Files selected for processing (22)
  • src/lib/core/non-interactive.test.ts
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/machine/core-flow-phases.test.ts
  • src/lib/onboard/machine/handlers/provider-inference-route-containment.test.ts
  • src/lib/onboard/machine/handlers/provider-inference.test-support.ts
  • src/lib/onboard/machine/handlers/provider-inference.test.ts
  • src/lib/onboard/machine/handlers/provider-inference.ts
  • src/lib/onboard/machine/runtime.ts
  • src/lib/onboard/no-tty-auto-yes.test.ts
  • src/lib/onboard/no-tty-auto-yes.ts
  • src/lib/onboard/provider-review-wiring.ts
  • src/lib/onboard/resume-config.test.ts
  • src/lib/onboard/resume-config.ts
  • src/lib/onboard/runtime-boundary.test.ts
  • src/lib/onboard/runtime-boundary.ts
  • src/lib/onboard/sandbox-agent.test.ts
  • src/lib/onboard/sandbox-agent.ts
  • src/lib/onboard/session-bootstrap.test.ts
  • src/lib/onboard/session-bootstrap.ts
  • src/lib/state/onboard-session.test.ts
  • src/lib/state/onboard-session.ts
🚧 Files skipped from review as they are similar to previous changes (21)
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/no-tty-auto-yes.ts
  • src/lib/onboard/no-tty-auto-yes.test.ts
  • src/lib/state/onboard-session.test.ts
  • src/lib/core/non-interactive.test.ts
  • src/lib/onboard/sandbox-agent.ts
  • src/lib/onboard/sandbox-agent.test.ts
  • src/lib/onboard/resume-config.ts
  • src/lib/onboard/runtime-boundary.test.ts
  • src/lib/onboard/machine/core-flow-phases.test.ts
  • src/lib/onboard/resume-config.test.ts
  • src/lib/state/onboard-session.ts
  • src/lib/onboard/machine/handlers/provider-inference-route-containment.test.ts
  • src/lib/onboard/session-bootstrap.test.ts
  • src/lib/onboard/runtime-boundary.ts
  • src/lib/onboard/machine/runtime.ts
  • src/lib/onboard/session-bootstrap.ts
  • src/lib/onboard.ts
  • src/lib/onboard/provider-review-wiring.ts
  • src/lib/onboard/machine/handlers/provider-inference.ts
  • src/lib/onboard/machine/handlers/provider-inference.test-support.ts

Signed-off-by: Yimo Jiang <yimoj@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: 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/machine/handlers/provider-review-recovery.test.ts`:
- Around line 66-81: In both test cases in
src/lib/onboard/machine/handlers/provider-review-recovery.test.ts (lines 66-81
and 121-136), add an assertion verifying checkpointSandboxIdentity is called
before promptYesNoOrDefault. Preserve the existing behavioral assertions while
covering the required checkpoint ordering for both prompted identity paths.

In `@src/lib/onboard/setup-inference.ts`:
- Around line 29-58: Complete the provider-preparation cutover by removing the
proxy-start and ensure/persist calls from setup-nim-ollama.ts and
inference-providers/ollama-local.ts, unless an explicitly bounded recovery
window is required. Route Ollama preparation through
createProviderReviewDeps.prepareLocalProviderForInference, and add a
production-wiring test that exercises createProviderReviewDeps rather than only
mocked handlers.
🪄 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: 199aa907-c9de-4779-b676-a6dfe23684a1

📥 Commits

Reviewing files that changed from the base of the PR and between 838f0e7 and d4584db.

📒 Files selected for processing (7)
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/entry-options.ts
  • src/lib/onboard/machine/handlers/provider-inference.test.ts
  • src/lib/onboard/machine/handlers/provider-review-recovery.test.ts
  • src/lib/onboard/setup-inference.ts
  • test/onboard-inference-reconciliation.test.ts
💤 Files with no reviewable changes (1)
  • src/lib/onboard/machine/handlers/provider-inference.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/onboard.ts

Comment thread src/lib/onboard/machine/handlers/provider-review-recovery.test.ts
Comment thread src/lib/onboard/setup-inference.ts Outdated
Signed-off-by: Yimo Jiang <yimoj@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 `@src/lib/onboard/entry-options.ts`:
- Around line 67-70: Update resolveOnboardEntryOptions so resume auto-confirm
treats either non-TTY stream as non-interactive, matching the cannotPrompt
predicate rather than checking only stdinIsTty. Preserve existing explicit --yes
and environment-based behavior, and add tests covering both mixed-stream cases
where exactly one of stdin or stdout is not a TTY.
🪄 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: a325b990-32a7-4ac7-9832-2ea2b2abce9d

📥 Commits

Reviewing files that changed from the base of the PR and between d4584db and 52c7607.

📒 Files selected for processing (4)
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/entry-options.ts
  • src/lib/onboard/setup-inference.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/setup-inference.ts

Comment thread src/lib/onboard/entry-options.ts
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
yimoj added 4 commits August 11, 2026 04:04
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
Signed-off-by: Yimo Jiang <yimoj@nvidia.com>
@apurvvkumaria apurvvkumaria added the v0.0.107 Release target label Aug 11, 2026
@apurvvkumaria apurvvkumaria assigned apurvvkumaria and unassigned yimoj Aug 11, 2026

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

src/lib/onboard/setup-inference.ts:48-56 and src/lib/onboard/machine/handlers/provider-inference.ts:1118 add a second Ollama proxy preparation owner. After this hook starts the proxy and persists and probes its token, src/lib/onboard/inference-providers/ollama-local.ts:68-79 persists and probes it again. src/lib/onboard/setup-nim-ollama.ts:309,355 also still starts the detached proxy before configuration review. An accepted Ollama flow therefore performs duplicate reachability work, increasing latency and transient-failure exposure, while a declined review still leaves host proxy state despite the new post-acceptance contract. Make one path own proxy startup, token persistence, and reachability probing, or define a bounded fallback that does not repeat successful work. Add production-wiring regression evidence that rejection creates no proxy state and acceptance performs each operation once; the current tests mock prepareLocalProviderForInference and cannot detect either path.

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

Copy link
Copy Markdown
Collaborator

Security review

Verdict: PASS — no findings.

I reviewed branch revision 68dd02a53 and the complete onboarding recovery, session-state, provider-review, proxy-preparation, and test change.

  1. Secrets and credentials — PASS. Provider credentials remain staged in memory until review acceptance. Rejection clears persisted provider, endpoint, credential-environment, reasoning, proxy-container, and sandbox-selection state; no credential value is logged.
  2. Input validation and sanitization — PASS. Existing sandbox-name, provider, model, endpoint, and resume-conflict validators remain authoritative. Checkpoint identities are used only after the existing typed decision guard.
  3. Authentication and authorization — PASS. Gateway ownership, route compatibility, and reservation checks remain in place. Review recovery does not grant a new authorization path or bypass route validation.
  4. Dependencies and third-party libraries — PASS. No dependency, lockfile, image, registry, download, or third-party execution change is introduced by the effective PR diff.
  5. Error handling and logging — PASS. Explicit rejection now exits nonzero and makes the session non-resumable. Interrupted accepted selections stay recoverable without being represented as completed inference. Logged errors contain no credential material.
  6. Cryptography and data protection — PASS. No cryptographic primitive or data-protection boundary changes. Session persistence continues through the existing safe-update and redaction paths.
  7. Configuration and security headers — PASS. Non-interactive auto-confirm is limited to resume with --yes or NEMOCLAW_YES=1 and non-TTY input. Fresh onboarding does not inherit that behavior.
  8. Security testing — PASS. Tests cover rejection, SIGINT/EOF recovery, state ordering, public non-TTY entry behavior, proxy startup failure, missing proxy tokens, and prevention of proxy persistence on either failure. The affected suite passes 226 tests plus 4 focused proxy tests. One host Homebrew trust-probe failure reproduces unchanged on current main before the PR logic.
  9. System security — PASS. Ollama proxy preparation moves after configuration acceptance and fails closed before inference setup. Sandbox identity checkpointing is awaited, preventing an interrupted process from racing durable recovery state.

Large-change flag: +1,060/−132 across 24 files. The size is primarily recovery-state coverage; no large generated or dependency payload is added. All contributor and maintainer commits are signed off, and GitHub marks the current maintainer merge Verified.

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

Copy link
Copy Markdown
Collaborator

Security review — PASS

Reviewed branch revision ed7271d04 against current main. The onboarding recovery changes preserve the existing credential and gateway boundaries, defer Ollama proxy mutation until configuration review is accepted, and remove duplicate successful proxy lifecycle work. I found no security vulnerability or merge-blocking security concern.

Large-change flag: 28 files, +1,191/-159. The review surface is substantial and requires the full repository gates plus maintainer rereview before merge.

Findings

No findings.

Category review

  1. Secrets and credentials — PASS. Staged credentials remain in memory until acceptance; decline performs no proxy start, token read, persistence, or probe. The prepared proxy token stays in process memory, is not logged, and is handed directly to provider registration.
  2. Input validation and sanitization — PASS. Resume, review, TTY, provider, model, and sandbox state continue through typed validation and canonical session transitions. No new parser, command construction, URL trust, or deserialization boundary is introduced.
  3. Authentication and authorization — PASS. The user must accept the reviewed configuration before the normal local-provider preparation path mutates host proxy state. Recovery authority and gateway route ownership checks remain intact.
  4. Dependencies and third-party libraries — PASS. No dependency, image, registry, or lockfile change.
  5. Error handling and logging — PASS. Proxy startup and missing-token failures stop setup before provider registration; decline exits without claiming completion or exposing staged credentials.
  6. Cryptography and data protection — PASS. No new cryptographic operation. Existing proxy token generation, owner-only persistence, and credential transport remain unchanged.
  7. Configuration and security headers — PASS. No endpoint exposure, network policy, CORS, security-header, container privilege, or image configuration change.
  8. Security testing — PASS. Production-wiring tests prove review decline performs zero proxy operations and acceptance performs startup, token retrieval, persistence, and probing once. Recovery, mixed-TTY, session, route-containment, and fail-closed proxy tests remain green.
  9. Holistic security posture — PASS. One normal owner now prepares the proxy after acceptance. Provider setup consumes the prepared token without repeating successful work, while recovery callers that lack prepared state retain a bounded fail-closed fallback.

Files reviewed

src/lib/core/non-interactive.test.ts, src/lib/onboard.ts, src/lib/onboard/entry-options.test.ts, src/lib/onboard/entry-options.ts, src/lib/onboard/inference-providers/ollama-local.ts, src/lib/onboard/machine/core-flow-phases.test.ts, src/lib/onboard/machine/handlers/provider-inference-route-containment.test.ts, src/lib/onboard/machine/handlers/provider-inference.test-support.ts, src/lib/onboard/machine/handlers/provider-inference.test.ts, src/lib/onboard/machine/handlers/provider-inference.ts, src/lib/onboard/machine/handlers/provider-review-recovery.test.ts, src/lib/onboard/machine/runtime.ts, src/lib/onboard/resume-config.test.ts, src/lib/onboard/resume-config.ts, src/lib/onboard/runtime-boundary.test.ts, src/lib/onboard/runtime-boundary.ts, src/lib/onboard/sandbox-agent.test.ts, src/lib/onboard/sandbox-agent.ts, src/lib/onboard/session-bootstrap.test.ts, src/lib/onboard/session-bootstrap.ts, src/lib/onboard/setup-inference.test.ts, src/lib/onboard/setup-inference.ts, src/lib/onboard/setup-nim-ollama.test.ts, src/lib/onboard/setup-nim-ollama.ts, src/lib/state/onboard-session.test.ts, src/lib/state/onboard-session.ts, test/onboard-inference-reconciliation.test.ts, and test/onboard-selection.test.ts.

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: local-models Local model providers, downloads, launch, or connectivity area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression platform: dgx-spark Affects DGX Spark hardware or workflows v0.0.107 Release target

Projects

None yet

4 participants