Skip to content

refactor(onboard): centralize review recovery wiring - #8906

Merged
cv merged 2 commits into
mainfrom
codex/audit-8724-onboard-growth
Aug 12, 2026
Merged

cv merged 2 commits into
mainfrom
codex/audit-8724-onboard-growth

Conversation

@cjagwani

@cjagwani cjagwani commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This refactor removes four formatter exemptions that survived the line-budget work in #8724. It moves the default entry-option, reserved-name, and Ollama provider-review dependency wiring into the existing modules that own those contracts.

The resume, sandbox-name validation, provider-review recovery, process-exit, logging, and Ollama proxy behaviors are unchanged. src/lib/onboard.ts becomes two lines smaller, and its measured dependency fan-out falls from 211 to 210.

Changes

  • Add default entry-option and reserved-name adapters to onboard/entry-options.ts.
  • Add the canonical Ollama provider-review adapter to onboard/setup-inference.ts.
  • Replace the compressed onboard.ts call sites with formatted calls and remove four growth-guardrail formatter suppressions.
  • Lower the checked source-architecture fan-out budget to the new measured value.

The current consumers are the onboarding entry, truthful review recovery, and resumed-session reserved-name paths. Existing focused tests protect those contracts; no new abstraction or configuration surface is introduced.

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: 108 focused assertions cover entry options, provider review recovery, non-interactive flow, onboarding selection, and Ollama autostart; this change only relocates their canonical dependency assembly.
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: Commands, flags, environment variables, defaults, output, persistence, and failure behavior do not change.
  • 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: Codex Desktop completed the nine-category review with PASS in every category and no findings, then confirmed the protected-branch sync left the PR delta unchanged: refactor(onboard): centralize review recovery wiring #8906 (comment) and refactor(onboard): centralize review recovery wiring #8906 (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 command, Ollama setup, and troubleshooting pages already own the preserved resume, reserved-name, proxy lifecycle, and proxy recovery contracts.
  • 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 — 108 focused assertions passed across entry options, provider review recovery, non-interactive flow, onboarding selection, and Ollama autostart; npm run typecheck:cli, npm run build:cli, source architecture, source shape, and test-size checks passed.
  • 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.
  • 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)
  • Doc pages follow the style guide (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>
@copy-pr-bot

copy-pr-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change moves default onboarding option and provider review dependency wiring into dedicated modules. It adds reserved sandbox-name validation for resumed sessions, removes obsolete imports, preserves sandbox creation arguments, and lowers the onboarding fan-out budget.

Changes

Onboarding wiring

Layer / File(s) Summary
Default entry-option resolution
src/lib/onboard/entry-options.ts, src/lib/onboard.ts
resolveDefaultRunEntryOptions now supplies default onboarding dependencies. assertDefaultSandboxNameAllowed rejects reserved sandbox names and exits with code 1.
Provider review dependency factory
src/lib/onboard/setup-inference.ts, src/lib/onboard.ts
createDefaultProviderReviewDeps wires Ollama proxy operations, process.exit, and console.error into provider review setup.
Onboarding composition cleanup
src/lib/onboard.ts, ci/source-architecture-budget.json
Obsolete imports are removed. Sandbox creation arguments remain unchanged. The fan-out budget changes from 211 to 210.

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

Possibly related PRs

  • NVIDIA/NemoClaw#8407: Refactors onboarding composition and default dependency wiring with fan-out budget reductions.
  • NVIDIA/NemoClaw#8724: Introduces related entry-option and provider-review wiring changes.
  • NVIDIA/NemoClaw#8761: Modifies onboarding entrypoint changes and source architecture budget constraints.

Suggested labels: refactor, area: onboarding

Suggested reviewers: cv, yimoj, ericksoa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: centralizing onboarding review and recovery dependency wiring.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/audit-8724-onboard-growth

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

@cjagwani

Copy link
Copy Markdown
Collaborator Author

Sensitive-path security review (exact head bb7e037): PASS with no findings. Reviewed the complete diff across all nine required categories: (1) input validation and trust boundaries—existing option, name, and recovery validation is unchanged; (2) credentials and secrets—Ollama token retrieval/persistence/probing is only rewired to the same functions, with no new logging or storage; (3) network exposure and SSRF—the same proxy topology and probe functions are invoked with unchanged arguments; (4) command execution and injection—no commands or interpolation changed; (5) permissions and privilege boundaries—no permission behavior changed; (6) sandbox isolation—the same onboarding and resumed-sandbox paths remain; (7) injection classes—no parser, shell, URL, HTML, SQL, or template sink changed; (8) dependencies and supply chain—no dependency or artifact changed; (9) data exposure and logging—the same console.error and process.exit callbacks preserve existing messages and failure behavior. Import-time dependencies were also checked: the moved modules were already loaded by onboard.ts, and the new adapters add no side effects or public configuration surface.

@github-code-quality

github-code-quality Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit dcb13c3 in the codex/audit-8724-onb... branch remains at 96%, unchanged from commit 5313eee in the main branch.


Updated August 12, 2026 15:39 UTC

@cjagwani
cjagwani marked this pull request as ready for review August 12, 2026 15:29

@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.ts`:
- Around line 3732-3738: Add public-entrypoint tests covering fresh, resumed,
and provider-review onboarding flows. In src/lib/onboard.ts:3732-3738, verify
public flows use resolveDefaultRunEntryOptions; in src/lib/onboard.ts:4074-4077,
verify provider-review uses createDefaultProviderReviewDeps and preserves
expected failure behavior. Add corresponding boundary coverage around
setup-inference.ts:70-86 and entry-options.ts:104-118, including default
dependency behavior and failures without changing the lower-level resolver
tests.
🪄 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: e16c0070-9c32-4308-9be7-7d9fbde7fbf6

📥 Commits

Reviewing files that changed from the base of the PR and between 9b79f3e and bb7e037.

📒 Files selected for processing (4)
  • ci/source-architecture-budget.json
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.ts
  • src/lib/onboard/setup-inference.ts

Comment thread src/lib/onboard.ts
Comment on lines +3732 to +3738
const entryOptions = onboardEntryOptions.resolveDefaultRunEntryOptions(
opts,
onboardSession.loadSession()?.status ?? null,
validateName,
);
const { fresh, nonInteractive, cannotPrompt, resume } = entryOptions;
const { requestedFromDockerfile, requestedSandboxName } = entryOptions;

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline src/lib/onboard.ts --match runOnboard --view expanded

rg -n -C 3 \
  --glob '*.{test,spec}.ts' \
  'runOnboard|resolveDefaultRunEntryOptions|createDefaultProviderReviewDeps|resolveOnboardRunEntryOptions|createProviderReviewDeps' \
  .

rg -n -C 3 \
  'resolveDefaultRunEntryOptions|createDefaultProviderReviewDeps|resolveOnboardRunEntryOptions|createProviderReviewDeps' \
  src

Repository: NVIDIA/NemoClaw

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- relevant files ---'
git ls-files \
  'src/lib/onboard*' \
  'test/*onboard*' \
  'src/lib/actions/*onboard*' \
  'src/commands/*onboard*' |
  rg '(entry-options|setup-inference|onboard(\.test)?|lifecycle|resume|inference|provider)' |
  head -200

printf '%s\n' '--- exact symbol references in source and tests ---'
rg -n --glob '*.ts' \
  'resolveDefaultRunEntryOptions|createDefaultProviderReviewDeps|resolveOnboardRunEntryOptions|createProviderReviewDeps' \
  src test

printf '%s\n' '--- runOnboard definitions and calls ---'
rg -n -C 8 --glob '*.ts' \
  'function runOnboard|const runOnboard|wrapOnboard\(runOnboard|createDefaultProviderReviewDeps' \
  src/lib/onboard.ts src/lib/onboard test src/commands

printf '%s\n' '--- focused test filenames ---'
git ls-files '*test.ts' |
  while read -r f; do
    if rg -q 'resolveDefaultRunEntryOptions|createDefaultProviderReviewDeps|resolveOnboardRunEntryOptions|createProviderReviewDeps' "$f"; then
      printf '%s\n' "$f"
    fi
  done

Repository: NVIDIA/NemoClaw

Length of output: 9447


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- entry-options implementation ---'
cat -n src/lib/onboard/entry-options.ts | sed -n '1,180p'

printf '%s\n' '--- setup-inference implementation ---'
cat -n src/lib/onboard/setup-inference.ts | sed -n '1,130p'

printf '%s\n' '--- runOnboard entry wiring ---'
cat -n src/lib/onboard.ts | sed -n '3690,3765p'
cat -n src/lib/onboard.ts | sed -n '4035,4105p'

printf '%s\n' '--- exact symbol references ---'
rg -n --glob '*.ts' \
  'resolveDefaultRunEntryOptions|createDefaultProviderReviewDeps|resolveOnboardRunEntryOptions|createProviderReviewDeps' \
  src test || true

printf '%s\n' '--- candidate direct onboarding tests ---'
for f in \
  src/lib/onboard/entry-options.test.ts \
  src/lib/onboard/setup-inference.test.ts \
  src/lib/onboard/command.test.ts \
  src/lib/onboard/command-support.test.ts \
  src/commands/onboard.test.ts \
  src/lib/actions/onboard.test.ts \
  test/onboard-lifecycle.test.ts
do
  if [ -f "$f" ]; then
    printf '\n--- %s ---\n' "$f"
    rg -n -C 5 \
      'fresh|resume|provider|inference|entry|factory|dependency|runOnboard|onboard' \
      "$f" | head -240 || true
  fi
done

Repository: NVIDIA/NemoClaw

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- lifecycle test structure and assertions ---'
rg -n -C 4 \
  'describe|it\(|runOnboardEntrypoint|resume|fresh|provider|inference|sandboxName|mode|calls|events' \
  test/onboard-lifecycle.test.ts | head -320 || true

printf '%s\n' '--- entry-options test imports and test list ---'
sed -n '1,330p' src/lib/onboard/entry-options.test.ts |
  rg -n '^(import|describe|  it|  it\.each|  \}\)|export)|resolveDefault|resolveOnboard' || true

printf '%s\n' '--- setup-inference test imports and test list ---'
cat -n src/lib/onboard/setup-inference.test.ts | sed -n '1,190p'

printf '%s\n' '--- provider-review recovery test references ---'
rg -n -C 8 \
  'createProviderReviewDeps|providerReviewDeps|prepareLocalProviderForInference|checkpointSandboxIdentity' \
  src/lib/onboard/machine/handlers/provider-review-recovery.test.ts || true

printf '%s\n' '--- targeted diff summary ---'
git diff --stat -- src/lib/onboard.ts src/lib/onboard/entry-options.ts src/lib/onboard/setup-inference.ts \
  src/lib/onboard/entry-options.test.ts src/lib/onboard/setup-inference.test.ts || true

Repository: NVIDIA/NemoClaw

Length of output: 27071


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

symbols = (
    "resolveDefaultRunEntryOptions",
    "createDefaultProviderReviewDeps",
    "resolveOnboardRunEntryOptions",
    "createProviderReviewDeps",
)

for symbol in symbols:
    refs = []
    for path in Path("src").rglob("*.ts"):
        text = path.read_text(encoding="utf-8")
        for line_no, line in enumerate(text.splitlines(), 1):
            if re.search(rf"\b{re.escape(symbol)}\b", line):
                refs.append(f"{path}:{line_no}")
    print(f"{symbol}:")
    for ref in refs:
        print(f"  {ref}")
    if not refs:
        print("  <none>")
PY

Repository: NVIDIA/NemoClaw

Length of output: 1098


Add public-entrypoint coverage for the default onboarding factories.

Existing tests cover lower-level resolvers and lifecycle behavior, but they do not prove that public fresh, resumed, and provider-review flows use resolveDefaultRunEntryOptions and createDefaultProviderReviewDeps. Add boundary assertions for their default dependencies and failure behavior.

📍 Affects 3 files
  • src/lib/onboard.ts#L3732-L3738 (this comment)
  • src/lib/onboard/entry-options.ts#L104-L118
  • src/lib/onboard/setup-inference.ts#L70-L86
  • src/lib/onboard.ts#L4074-L4077
🤖 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.ts` around lines 3732 - 3738, Add public-entrypoint tests
covering fresh, resumed, and provider-review onboarding flows. In
src/lib/onboard.ts:3732-3738, verify public flows use
resolveDefaultRunEntryOptions; in src/lib/onboard.ts:4074-4077, verify
provider-review uses createDefaultProviderReviewDeps and preserves expected
failure behavior. Add corresponding boundary coverage around
setup-inference.ts:70-86 and entry-options.ts:104-118, including default
dependency behavior and failures without changing the lower-level resolver
tests.

Source: Path instructions

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

Copy link
Copy Markdown
Collaborator Author

Final-head security receipt for dcb13c3: PASS with no findings. The signed merge only brings the published branch to current main; its tree is byte-identical to the already reviewed rebased head a4e2cf3, and the PR delta remains the same four-file wiring refactor reviewed across all nine security categories above.

@cv
cv merged commit 971811c into main Aug 12, 2026
89 of 90 checks passed
@cv
cv deleted the codex/audit-8724-onboard-growth branch August 12, 2026 15:48
@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions

Model lanes

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

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

  • onboard-managed-image-buildless-e2e: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • ollama-auth-proxy: 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.

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: managed-image-multiarch-startup, network-policy, onboard-repair, onboard-resume, cloud-onboard
The manual PR workflow does not run these selectors for the commit under review. Run them from reviewed code on main.

1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Add production-adapter regression coverage

  • Location: src/lib/onboard/entry-options.ts:81
  • Category: tests
  • Problem: The PR adds production default adapters, but the checked-in tests exercise only the injectable entry-option and provider-review factories.
  • Impact: A future change can break production onboarding dependency wiring while the injected-factory tests still pass.
  • Recommendation: Add direct tests for both default adapters. Verify non-interactive reserved-name rejection through `resolveDefaultRunEntryOptions`; verify Ollama proxy startup, token retrieval, and persistence ordering through `createDefaultProviderReviewDeps`.
  • Verification: Read `entry-options.test.ts` and `setup-inference.test.ts` to confirm the new default adapters are imported and exercised.
  • Test coverage: Add unit tests that invoke both default adapters and assert the preserved failure and success paths without replacing their production dependencies.
  • Evidence: src/lib/onboard/entry-options.ts:81-96 defines `resolveDefaultRunEntryOptions` as the production adapter. src/lib/onboard/setup-inference.ts:67-84 defines `createDefaultProviderReviewDeps` as the production adapter. src/lib/onboard/entry-options.test.ts:1-230 imports and tests injectable entry-option functions, not `resolveDefaultRunEntryOptions`. src/lib/onboard/setup-inference.test.ts:1-118 imports and tests `createProviderReviewDeps`, not `createDefaultProviderReviewDeps`.

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 the refactor PR restructures code without intended behavior change label Aug 25, 2026
@wscurran wscurran added area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening provider: ollama Ollama local model provider behavior labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: providers Inference provider integrations and provider behavior area: security Security controls, permissions, secrets, or hardening provider: ollama Ollama local model provider behavior refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants