Skip to content

fix(onboard): auto-detect resume from an in_progress session - #5487

Merged
cv merged 6 commits into
mainfrom
fix/5470-onboard-resume-autodetect
Jun 22, 2026
Merged

cv merged 6 commits into
mainfrom
fix/5470-onboard-resume-autodetect

Conversation

@Dongni-Yang

@Dongni-Yang Dongni-Yang commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resume mode was keyed only off the --resume flag, so re-running nemoclaw onboard after an interrupted attempt — where ~/.nemoclaw/onboard-session.json has status:"in_progress" — started over instead of resuming (no (resume mode) banner, no resume preflight). This auto-detects resume from the persisted in_progress status.

Related Issue

Refs #5470

Changes

  • src/lib/onboard/entry-options.ts: resolveOnboardEntryOptions now auto-detects resume from a persisted in_progress session (new optional persistedSessionStatus input) when --fresh is not set. --fresh always wins; the explicit --resume/--fresh conflict guard is unchanged (applies only to the explicit flags).
  • src/lib/onboard.ts: pass the persisted session status into the resolver.
  • src/lib/onboard/entry-options.test.ts: red→green coverage for auto-detect, plus no-regression guards (--fresh wins; non-in_progress statuses).
  • test/e2e/test-onboard-resume.sh: add a Phase 3.5 implicit-resume scenario (plain onboard on an in_progress session) and a --fresh suppression check.

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)

Verification

  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
Layer Result
Unit (entry-options.test.ts) Resume auto-detect → true for in_progress; --fresh and non-in_progress (incl. pending / "") → no resume. Core case is a true red→green. ✅
Real openshell CLI gateway --help lacks start / destroy ⇒ supportsLifecycleCommands=false (host-process model — the bug-capable branch). ✅
In-process (real fns) classifyGatewayPortReuse(healthy, lifecycle=false, container=missing) ⇒ reuse; container never probed, no cleanup; reuse is openshell status-driven, no containerId read. ✅
Live onboard (Ubuntu 20.04, containerized-compat gateway) Plain onboard (no --resume) on an in_progress session prints (resume mode) (the fix), then [resume] Skipping gateway (running) against a healthy :8080 gateway with no stale-cleanup sequence — reproducing both the fix and the unfixed half end-to-end. ✅
onboard-resume-e2e (Ubuntu 24.04 CI) Explicit --resume plus the new Phase 3.5 implicit-resume + --fresh-suppression assertions all pass. ✅

Scope / notes: NemoClaw writes/reads no gateway.json or containerId in the onboard reuse path (grep-confirmed) — that artifact is OpenShell-owned, so the stale-gateway cleanup symptom is upstream. It also can't be tightened naively without regressing #4520 (the inverse "false-stale → :8080 collision" bug, whose fix deliberately made reuse more trusting). Hence Refs, not Closes. The cloud-onboard-e2e failure is the inference-provider credential/env issue the report itself calls "environmental and separate from this bug" (it fails on a fresh onboard at [3/8], where this change's resume path never runs).


Signed-off-by: Dongni Yang dongniy@nvidia.com

Summary by CodeRabbit

  • New Features
    • Onboarding can now auto-select resume mode when a persisted onboarding session is marked in_progress, reducing manual --resume usage.
    • --fresh still overrides auto-resume and prevents resume mode even if the persisted session is in_progress.
  • Tests / Quality
    • Added unit tests covering resume auto-detection for persisted states (in_progress, complete, failed, null/undefined) and validating --fresh suppression.
    • Added an end-to-end “implicit resume” scenario to verify cached-step skipping in resume mode and fast preflight failure in --fresh mode.

Resume mode was keyed only off the --resume flag (entry-options.ts), so
re-running `nemoclaw onboard` after an interrupted attempt — where
~/.nemoclaw/onboard-session.json has status:"in_progress" — started over
instead of resuming: no "(resume mode)" banner and no resume preflight.

Auto-detect resume from the persisted in_progress status when --fresh is not
set. --fresh always wins, and the explicit --resume/--fresh conflict guard is
unchanged (it applies only to the explicit flags), so no existing flow regresses.

Scope: this resolves the resume-detection symptom of #5470. The stale
gateway.json reuse symptom is rooted in OpenShell's package-managed gateway
lifecycle — gateway.json is OpenShell-owned and NemoClaw reuses on live
`openshell status` health, so forcing a teardown would regress the legitimate
host-process reuse path. Left out deliberately; hence Refs (not Closes).

Local pre-commit Test (CLI) hook skipped via --no-verify (operator-approved):
it fails only on environment-flaky tests (ollama proxy 5s timeout, /tmp symlink)
unrelated to this change; entry-options 9/9 and the onboard suite 1876/1876 pass,
typecheck and biome clean. CI re-runs all hooks on the PR.

Refs #5470

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f6989d74-b01d-4b1d-b021-738f492f2f8a

📥 Commits

Reviewing files that changed from the base of the PR and between 970a832 and ffd05a3.

📒 Files selected for processing (1)
  • src/lib/onboard.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/onboard.ts

📝 Walkthrough

Walkthrough

OnboardEntryOptionsInput gains an optional persistedSessionStatus field. resolveOnboardEntryOptions now auto-enables resume when that field equals "in_progress" and --fresh is not set, adjusting the --resume/--fresh conflict guard accordingly. onboard() supplies the value from onboardSession.loadSession()?.status. Unit and e2e tests cover all new auto-resume paths.

Changes

Persisted Session Auto-Resume

Layer / File(s) Summary
Input contract and resume resolution logic
src/lib/onboard/entry-options.ts
Adds optional persistedSessionStatus?: string | null to OnboardEntryOptionsInput. Updates resolveOnboardEntryOptions to compute explicitResume, restricts the --resume/--fresh conflict guard to when both are explicitly set, and infers resume: true from persistedSessionStatus === "in_progress" when fresh is absent.
Wire persistedSessionStatus in onboard()
src/lib/onboard.ts
Passes persistedSessionStatus: onboardSession.loadSession()?.status ?? null into the resolveOnboardEntryOptions call inside onboard().
Unit tests for auto-resume scenarios
src/lib/onboard/entry-options.test.ts
Adds three test cases: "in_progress" triggers auto-resume without explicit --resume; --fresh suppresses auto-resume even when status is "in_progress"; statuses "complete", "failed", null, and undefined do not trigger auto-resume. Reorders import destructuring alongside test additions.
E2E tests for auto-resume behavior
test/e2e/test-onboard-resume.sh
Adds Phase 3.5 coverage verifying implicit resume activation when the persisted session status is "in_progress" without requiring explicit --resume, asserts cached steps are skipped, and confirms --fresh suppresses auto-resume behavior even with "in_progress" status.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • NVIDIA/NemoClaw#5161: Modifies the same onboard.ts→resolveOnboardEntryOptions delegation path and extends the --resume/--fresh mutual-exclusion logic that this PR further updates.
  • NVIDIA/NemoClaw#5158: Refactors onboard() to use the resolveOnboardEntryOptions resolver that this PR extends with persistedSessionStatus support.

Suggested labels

area: onboarding, area: e2e

🐇 A session was sleeping, its status half-done,
So I peeked at its state and let resume be won.
If --fresh waves its flag, auto-resume must yield,
But "in_progress" whispers: the path stands revealed!
Hop, hop — the onboarding flows smooth as a bun! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: auto-detection of resume mode from an in_progress session status, which is the core fix implemented across all modified files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/5470-onboard-resume-autodetect

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

@github-code-quality

github-code-quality Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the fix/5470-onboard-res... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/5470-onboard-res... ffd05a3 +/-
nemoclaw/src/se...cret-scanner.ts — 100% —
nemoclaw/src/commands/slash.ts — 100% —
nemoclaw/src/li...bprocess-env.ts — 100% —
nemoclaw/src/bl...eprint/state.ts — 98% —
nemoclaw/src/onboard/config.ts — 98% —
nemoclaw/src/bl...int/snapshot.ts — 97% —
nemoclaw/src/bl...print/runner.ts — 95% —
nemoclaw/src/co...ration-state.ts — 94% —
nemoclaw/src/bl...ate-networks.ts — 94% —
nemoclaw/src/index.ts — 94% —

TypeScript / code-coverage/cli

The overall coverage in the fix/5470-onboard-res... branch is 46%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/5470-onboard-res... ffd05a3 +/-
src/lib/state/o...oard-session.ts — 91% —
src/lib/inference/local.ts — 76% —
src/lib/sandbox/config.ts — 72% —
src/lib/actions...dbox/rebuild.ts — 67% —
src/lib/onboard/preflight.ts — 64% —
src/lib/actions...licy-channel.ts — 56% —
src/lib/state/sandbox.ts — 55% —
src/lib/policy/index.ts — 49% —
src/lib/onboard...er-gpu-patch.ts — 44% —
src/lib/onboard.ts — 18% —

Updated June 22, 2026 00:36 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: onboard-resume-e2e
Optional E2E: onboard-negative-paths-e2e, cloud-onboard-e2e

Dispatch hint: onboard-resume-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • onboard-resume-e2e (medium): Required because the PR directly changes onboard resume detection and extends test/e2e/test-onboard-resume.sh to validate implicit resume and --fresh suppression. This is the existing end-to-end coverage for interrupted onboarding/session resume behavior, sandbox reuse, skipped cached steps, and completed session state.

Optional E2E

  • onboard-negative-paths-e2e (medium): Optional adjacent confidence for CLI onboarding entry validation and non-interactive failure paths, since resolveOnboardEntryOptions changed --resume/--fresh precedence and prompt-availability behavior remains nearby.
  • cloud-onboard-e2e (medium): Optional broader smoke of the normal cloud onboarding path to confirm the new persisted-session lookup does not perturb a clean first-time onboard run.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: .github/workflows/nightly-e2e.yaml
  • jobs input: onboard-resume-e2e

@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: onboard-resume-vitest
Optional Vitest E2E scenarios: ubuntu-repo-cloud-openclaw

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-resume-vitest

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • onboard-resume-vitest: The PR changes onboard entry option resolution to auto-detect resume from a persisted in_progress session and updates resume coverage. The wired free-standing Vitest onboard-resume job is the closest live scenario for interrupted onboarding, persisted session handling, resume mode, cached-step skips, and completion after resume.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-resume-vitest

Optional Vitest E2E scenarios

  • ubuntu-repo-cloud-openclaw: Optional baseline live onboarding smoke for the no-existing-session path, since the changed entry-option logic is invoked by ordinary cloud OpenClaw onboarding as well as resume flows.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field scenarios=ubuntu-repo-cloud-openclaw

Relevant changed files

  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.ts
  • test/e2e/test-onboard-resume.sh

@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor

Review posture: Resolve findings before merge
Action expectation: Address required items before merge. Resolve or explicitly justify warnings. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up.
Findings: 0 required fixes, 2 items to resolve/justify, 0 in-scope improvements
Top item: Align implicit resume detection with the resumable-session predicate

Review findings by urgency: 0 required fixes, 2 items to resolve/justify, 0 in-scope improvements

🚨 Required before merge

Address these before merging unless a maintainer explicitly overrides the advisor with rationale.

  • None.

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

  • Source-of-truth review needed: Implicit onboarding resume detection from persisted session state: The advisor marked localized patch analysis as needs_followup.
    • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
    • Recommendation: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
    • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
    • Verification hint: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
    • Missing regression test: Add a test that creates an `in_progress` but non-resumable persisted session and verifies plain `onboard` does not auto-select resume unless the bootstrap would accept the same session.
    • Evidence: `src/lib/onboard.ts` passes only `onboardSession.loadSession()?.status ?? null`; `entry-options.ts` checks only `persistedSessionStatus === "in_progress"`; `session-bootstrap.ts` rejects `session.resumable === false`.
  • Align implicit resume detection with the resumable-session predicate (src/lib/onboard/entry-options.ts:63): The new resolver auto-detects resume when `persistedSessionStatus === "in_progress"`, but the authoritative resume path in `prepareResumeSession` rejects `!session || session.resumable === false`. That means a contradictory persisted session such as `{ status: "in_progress", resumable: false }` now makes plain `nemoclaw onboard` enter resume mode and then fail with “No resumable onboarding session was found,” whereas before this PR a plain onboard would have proceeded as a fresh run.
    • Impact: A stale or corrupted session file can turn the no-flag onboarding command into a dead-end resume attempt. This is especially confusing because the E2E setup itself has to set both `status = "in_progress"` and `resumable = true`, showing that status alone is not the full source of truth for resumability.
    • Recommendation: Make the auto-resume decision use the same predicate as the bootstrap path, for example by loading the session once in `onboard.ts` and passing a boolean like `persistedSessionCanResume: session?.status === "in_progress" && session.resumable !== false`, or by extending the resolver input with resumability and checking both fields. Keep `--fresh` as the explicit override.
    • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
    • Verification hint: Read `src/lib/onboard/entry-options.ts` around the `sessionInProgress` calculation and `src/lib/onboard/session-bootstrap.ts` in `prepareResumeSession`, where `session.resumable === false` is rejected.
    • Missing regression test: Add a resolver or bootstrap-level test named like “plain onboard does not auto-resume an in_progress session marked non-resumable” that constructs `status: "in_progress", resumable: false` and verifies the chosen behavior is intentional and aligned with `prepareOnboardSession`.
    • Evidence: `entry-options.ts` computes `const sessionInProgress = input.persistedSessionStatus === "in_progress"; const resume = !fresh && (explicitResume || sessionInProgress);`, while `session-bootstrap.ts` rejects resume when `session.resumable === false`. The new E2E helper explicitly flips both `data.status = "in_progress"` and `data.resumable = true` before testing implicit resume.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Simplification opportunities: 1 possible cut

These are safe simplification checks only. Do not remove validation, security controls, data-loss prevention, or required tests.

  • shrink (src/lib/onboard/entry-options.ts:63): The status-only resolver input as the durable-session source of truth.
    • Replacement: Pass a precomputed `persistedSessionCanResume` boolean or a small session eligibility object from `onboard.ts` using the same `status === "in_progress" && resumable !== false` predicate as bootstrap.
    • Safety boundary: Do not weaken explicit `--fresh` override behavior, explicit `--resume --fresh` rejection, session normalization, credential hash validation, or resume conflict checks.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • Runtime validation — plain onboard does not auto-resume an in_progress session marked non-resumable. This changes onboarding runtime behavior in host/session glue. The changed unit tests cover resolver decisions, and the changed shell E2E covers a real implicit-resume path, but the source-of-truth edge case around non-resumable persisted sessions is not covered.
  • Runtime validation — implicit resume uses the same resumable predicate as prepareOnboardSession. This changes onboarding runtime behavior in host/session glue. The changed unit tests cover resolver decisions, and the changed shell E2E covers a real implicit-resume path, but the source-of-truth edge case around non-resumable persisted sessions is not covered.
  • Acceptance clause — No deterministic linked issue clauses were provided by the review context. — add test evidence or identify existing coverage. The validation context reported `linkedIssues: []`. The PR body references `Refs [All Platforms][Onboard] Onboard resume mode fails to clean up stale gateway metadata when host-level gateway still owns port 8080 #5470`, but no linked issue body or comments were available to extract literal acceptance clauses from trusted deterministic context.
  • Implicit onboarding resume detection from persisted session state — Add a test that creates an `in_progress` but non-resumable persisted session and verifies plain `onboard` does not auto-select resume unless the bootstrap would accept the same session.. `src/lib/onboard.ts` passes only `onboardSession.loadSession()?.status ?? null`; `entry-options.ts` checks only `persistedSessionStatus === "in_progress"`; `session-bootstrap.ts` rejects `session.resumable === false`.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each finding. A human maintainer must make the final merge decision.

@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

🧹 Nitpick comments (2)
src/lib/onboard/entry-options.ts (1)

21-21: ⚡ Quick win

Tighten persistedSessionStatus to a literal union instead of string.

Using string | null weakens the cross-file contract and allows typos to compile. Narrow this to known session status literals (or a shared exported status type) so auto-resume conditions stay type-safe.

🤖 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/entry-options.ts` at line 21, The persistedSessionStatus
field is typed as string | null, which is too permissive and allows any string
value, including typos. Replace this broad string type with a literal union of
specific session status values (for example, 'active' | 'paused' | 'resumed') or
reference a shared exported status type that captures the valid session states.
This ensures type safety at compile time and prevents invalid status values from
being assigned to persistedSessionStatus.
src/lib/onboard.ts (1)

4750-4752: Run the onboarding E2E suite for this core-flow change before merge.

Given this touches onboarding entry behavior, run the recommended targeted nightly E2E jobs to validate resume/fresh interactions across lifecycle paths.

gh workflow run nightly-e2e.yaml --ref <branch> -f jobs=cloud-e2e,sandbox-operations-e2e,rebuild-openclaw-e2e,channels-stop-start-e2e,messaging-compatible-endpoint-e2e,bedrock-runtime-compatible-anthropic-e2e,hermes-discord-e2e,hermes-slack-e2e,openshell-gateway-upgrade-e2e,issue-3600-gpu-proof-optional-e2e

As per coding guidelines, src/lib/onboard.ts changes should run the recommended onboarding E2E coverage set.

🤖 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 4750 - 4752, Before merging the changes to
src/lib/onboard.ts that modify the onboarding entry behavior with
persistedSessionStatus initialization for resume detection, you must run the
recommended onboarding E2E test coverage to validate that resume and fresh
interaction paths work correctly across different lifecycle scenarios. Execute
the provided gh workflow command to run the nightly E2E jobs (cloud-e2e,
sandbox-operations-e2e, rebuild-openclaw-e2e, channels-stop-start-e2e,
messaging-compatible-endpoint-e2e, bedrock-runtime-compatible-anthropic-e2e,
hermes-discord-e2e, hermes-slack-e2e, openshell-gateway-upgrade-e2e, and
issue-3600-gpu-proof-optional-e2e) on your branch to ensure the onboarding
resume/fresh interaction changes are validated before merge.

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 4750-4751: The file `src/lib/onboard.ts` has exceeded the growth
guard threshold with a net addition of 2 lines, which blocks CI from passing. To
fix this, you need to offset the 2 newly added lines (the comment and the
persistedSessionStatus assignment) by removing or trimming 2 equivalent lines of
non-functional content elsewhere in the same file, such as unnecessary comments,
blank lines, or redundant whitespace. Ensure the deletions do not affect any
functional code logic.

---

Nitpick comments:
In `@src/lib/onboard.ts`:
- Around line 4750-4752: Before merging the changes to src/lib/onboard.ts that
modify the onboarding entry behavior with persistedSessionStatus initialization
for resume detection, you must run the recommended onboarding E2E test coverage
to validate that resume and fresh interaction paths work correctly across
different lifecycle scenarios. Execute the provided gh workflow command to run
the nightly E2E jobs (cloud-e2e, sandbox-operations-e2e, rebuild-openclaw-e2e,
channels-stop-start-e2e, messaging-compatible-endpoint-e2e,
bedrock-runtime-compatible-anthropic-e2e, hermes-discord-e2e, hermes-slack-e2e,
openshell-gateway-upgrade-e2e, and issue-3600-gpu-proof-optional-e2e) on your
branch to ensure the onboarding resume/fresh interaction changes are validated
before merge.

In `@src/lib/onboard/entry-options.ts`:
- Line 21: The persistedSessionStatus field is typed as string | null, which is
too permissive and allows any string value, including typos. Replace this broad
string type with a literal union of specific session status values (for example,
'active' | 'paused' | 'resumed') or reference a shared exported status type that
captures the valid session states. This ensures type safety at compile time and
prevents invalid status values from being assigned to persistedSessionStatus.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 93057bc6-750d-48d8-9238-4ef0d841519d

📥 Commits

Reviewing files that changed from the base of the PR and between 4a7b4c8 and 6b0241d.

📒 Files selected for processing (3)
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • src/lib/onboard/entry-options.ts

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

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 27589221225
Target ref: fix/5470-onboard-resume-autodetect
Requested jobs: onboard-resume-e2e,onboard-repair-e2e,double-onboard-e2e,onboard-negative-paths-e2e
Summary: 4 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
double-onboard-e2e ✅ success
onboard-negative-paths-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success

…ests

- Offset the codebase-growth-guardrails check: src/lib/onboard.ts must be
  net-neutral. Drop the inline comment (the rationale already lives on
  entry-options.ts) and a decorative blank line so the file is +1/-1 (net 0)
  while keeping the persistedSessionStatus wiring.
- Widen the non-resume boundary test to cover "pending" and "" in addition to
  complete/failed/null/undefined, so only an exact "in_progress" auto-resumes.

Refs #5470

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
test-onboard-resume.sh only exercised explicit `nemoclaw onboard --resume`.
Add a phase that re-marks the session in_progress and runs a plain `onboard`
(no --resume), asserting the "(resume mode)" banner and skipped cached steps,
then verifies `--fresh` suppresses the auto-resume (fail-fast at preflight to
stay cheap). Closes the implicit-resume gap flagged by the e2e advisor on #5470.

Refs #5470

Signed-off-by: Dongni Yang <dongniy@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/e2e/test-onboard-resume.sh`:
- Around line 375-390: The test in the --fresh branch injects a preflight
failure using NEMOCLAW_E2E_FORCE_FAIL_AT_STEP=preflight but never verifies the
injection actually occurred. The current code only checks that "(resume mode)"
is absent, which is insufficient. Modify the test to assert both that the
command exits with a non-zero status (indicating the preflight failure) and that
the expected failure marker appears in the output. Remove the || true from the
nemoclaw.js invocation to capture the exit code, then add assertions to verify
the non-zero exit code and check for the expected preflight failure marker in
fresh_output to ensure the injection regressed detection works correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a093d1cc-2baf-4383-b3a0-75555d7a0f63

📥 Commits

Reviewing files that changed from the base of the PR and between 6b0241d and 55a0a12.

📒 Files selected for processing (3)
  • src/lib/onboard.ts
  • src/lib/onboard/entry-options.test.ts
  • test/e2e/test-onboard-resume.sh
💤 Files with no reviewable changes (1)
  • src/lib/onboard.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/onboard/entry-options.test.ts

Comment thread test/e2e/test-onboard-resume.sh Resolved
…heck

CodeRabbit: the --fresh branch only checked that "(resume mode)" was absent,
which could pass vacuously if the run failed for an unrelated reason or never
reached preflight. Drop the `|| true`, capture the exit code, and assert the run
exited non-zero with the injected "Forced onboarding failure at step 'preflight'"
marker, so the banner-absence assertion is meaningful.

Refs #5470

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 27591288160
Target ref: fix/5470-onboard-resume-autodetect
Requested jobs: onboard-resume-e2e,cloud-onboard-e2e
Summary: 0 passed, 2 failed, 0 cancelled, 0 skipped

Job Result
cloud-onboard-e2e ❌ failure
onboard-resume-e2e ❌ failure

Failed jobs: cloud-onboard-e2e, onboard-resume-e2e. Check run artifacts for logs.

The Phase 3.5 implicit-resume check flipped the post-Phase-3 session's status
to in_progress but left resumable=false (set when onboarding completes), so the
resume machine correctly rejected it as "no resumable session" and exited before
the banner — failing the assertions. A genuinely interrupted session is
resumable; reset resumable=true so the synthesized state matches and plain
onboard auto-resumes it. (The fix itself was sound — auto-detect fired, which is
why the resume guard ran at all.)

Refs #5470

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 27591945815
Target ref: fix/5470-onboard-resume-autodetect
Requested jobs: onboard-resume-e2e
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-resume-e2e ✅ success

@Dongni-Yang

Copy link
Copy Markdown
Contributor Author

E2E status

  • onboard-resume-e2e ✅ green (run 27591945815) — covers explicit --resume plus the new Phase 3.5 implicit-resume assertions (plain onboard auto-detecting an in_progress session) and --fresh suppression.

  • cloud-onboard-e2e ❌ — pre-existing/environmental, not from this PR. It fails at [3/8] Configuring inference provider ("Validation details omitted… Public install failed") on a fresh onboard. This change only takes effect when a persisted onboard-session.json is in_progress (→ resume mode); a fresh onboard has resume=false, so the new code path never executes and cannot produce a [3/8] inference-credential failure. The issue itself notes this [3/8] failure is "environmental and separate from this bug." It's a CI inference-credential/endpoint matter, not a code change in scope here.

Scope reminder

Closing keyword stays Refs #5470 (not Closes): this fixes the resume-detection symptom (the (resume mode) banner now auto-engages, verified live). The stale-gateway / port-8080 reuse symptom is rooted in OpenShell's package-managed gateway lifecycle (NemoClaw reuses on live openshell status health and reads no gateway.json/containerId), and tightening it risks regressing #4520 (the inverse "false-stale → :8080 collision" bug).

Signed-off-by: Dongni Yang dongniy@nvidia.com

@cv
cv merged commit c7614cf into main Jun 22, 2026
43 of 45 checks passed
@cv
cv deleted the fix/5470-onboard-resume-autodetect branch June 22, 2026 00:42
jyaunches added a commit that referenced this pull request Jun 25, 2026
## Summary
Restore issue #5800 parity package `P0-B` for merged
onboard/rebuild/lifecycle bash-suite deltas only.

## Related Issues
Refs #5800
Refs #5098
Refs #5225
Refs #5487
Refs #5410
Refs #5760

## Scope gate
- Package: `P0-B — Onboard/rebuild/lifecycle parity`
- Included PRs all merged and touched `test/e2e`: yes — #5225, #5487,
#5410, #5760
- Out of scope: unmerged/non-bash PRs; shell lane retirement / PR #5756
cleanup

## Parity map
| ID | Source PR | Contract | Inference classification | Vitest
assertion / waiver | Status |
| --- | --- | --- | --- | --- | --- |
| B1 | #5225 | Persisted sandbox-entry gateway resolution is used by
lifecycle commands. | `none` | Existing
`src/lib/actions/sandbox/sandbox-gateway-routing.test.ts`,
`src/lib/onboard/gateway-binding.test.ts`,
`src/lib/onboard/sandbox-registration.test.ts` | covered |
| B2 | #5225 | Onboard repair/double-onboard failures include captured
onboard output diagnostics. | `none` | Existing live
`test/e2e-scenario/live/onboard-repair.test.ts`,
`test/e2e-scenario/live/double-onboard.test.ts`; diagnostics are
bash-runner-only verbosity and not a durable Vitest assertion. | waived
|
| B3 | #5487 | Plain `nemoclaw onboard` auto-detects an `in_progress`
session and resumes without `--resume`; `--fresh` suppresses
auto-resume. | `hosted-compatible capable` |
`test/e2e-scenario/live/onboard-resume.test.ts` Phase 3.5 mutates the
completed session to `in_progress`, asserts `(resume mode)` + cached
skips, then asserts `--fresh` fails at injected preflight without resume
banner. | covered |
| B4 | #5410 | Rebuild resumes messaging from `messaging.plan` rather
than legacy `providerCredentialHashes`; stale top-level provider hash
state is not used. | `none` |
`test/e2e-scenario/live/rebuild-hermes.test.ts` curated registry omits
`providerCredentialHashes`;
`src/lib/onboard/machine/handlers/sandbox.test.ts` refreshes
registry-plan credential hashes from env on rebuild resume. | covered |
| B5 | #5410 | Empty/staged rebuild messaging plan is preserved and
token-backed channels are not rediscovered. | `none` | Existing
`src/lib/actions/sandbox/rebuild-messaging-stage.test.ts` and
`src/lib/onboard/machine/handlers/sandbox.test.ts`. | covered |
| B6 | #5760 | Hosted-inference/messaging rebuild and live answer
assertions tolerate model whitespace around integer `42`. |
`hosted-compatible capable` | Existing
`test/helpers/e2e-answer-assertions.test.ts`, consumed by
`agent-turn-latency`, `full-e2e`, `launchable-smoke`, and
`sandbox-operations` live Vitests. | covered |
| B7 | #5760 | Stabilized hosted inference and messaging rebuild remain
validated by live full/sandbox/launchable/rebuild targets. |
`hosted-compatible capable` | Existing live targets remain unchanged;
local live execution blocked by Docker daemon unavailable. Selective
workflow required after PR opens. | follow-up |

## Inference mode support
- Default mode for touched live targets: `hosted-compatible capable` for
onboard-resume/rebuild-hermes/full/sandbox/launchable answer paths;
`none` for unit/process registry and gateway routing tests.
- Real inference support preserved: yes for existing hosted-compatible
live targets; no new inference adapter seam added here.
- Modes validated in this PR: local unit/process Vitests only; live
hosted-compatible validation needs GitHub runner/secrets because local
Docker daemon is unavailable.
- If not validated with real inference: local
`NEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project
e2e-scenarios-live test/e2e-scenario/live/onboard-resume.test.ts
test/e2e-scenario/live/rebuild-hermes.test.ts` failed at prereq Docker
daemon check before scenario assertions.

## Validation
- [x] `git diff --check`
- [x] `npm test -- src/lib/onboard/machine/handlers/sandbox.test.ts
test/helpers/e2e-answer-assertions.test.ts
src/lib/actions/sandbox/sandbox-gateway-routing.test.ts
src/lib/onboard/entry-options.test.ts
src/lib/onboard/sandbox-registration.test.ts
src/lib/actions/sandbox/rebuild-messaging-stage.test.ts`
- [x] `npm run typecheck:cli`
- [x] `npm run build:cli`
- [x] `npm run test-size:check`
- [ ] hosted-compatible selective E2E workflow: pending PR / runner
dispatch

## Follow-ups / waivers
- Waiver B2: bash-only diagnostic verbosity from #5225 is not a durable
Vitest contract; existing live tests already preserve the functional
repair/double-onboard behavior.
- Follow-up B7: dispatch selective live Vitest scenarios on GitHub
runner with Docker + hosted inference secret after PR opens.


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

## Summary by CodeRabbit

* **Tests**
* Added coverage for sandbox resume flows to verify updated Telegram
credentials are picked up when resuming a rebuild.
* Expanded end-to-end onboarding resume scenarios to confirm implicit
resume behavior, including skipped cached steps and fresh runs starting
from the expected point.
* Strengthened rebuild scenario checks to ensure curated registry
entries no longer include legacy credential-hash data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## Summary
Restore issue NVIDIA#5800 parity package `P0-B` for merged
onboard/rebuild/lifecycle bash-suite deltas only.

## Related Issues
Refs NVIDIA#5800
Refs NVIDIA#5098
Refs NVIDIA#5225
Refs NVIDIA#5487
Refs NVIDIA#5410
Refs NVIDIA#5760

## Scope gate
- Package: `P0-B — Onboard/rebuild/lifecycle parity`
- Included PRs all merged and touched `test/e2e`: yes — NVIDIA#5225, NVIDIA#5487,
NVIDIA#5410, NVIDIA#5760
- Out of scope: unmerged/non-bash PRs; shell lane retirement / PR NVIDIA#5756
cleanup

## Parity map
| ID | Source PR | Contract | Inference classification | Vitest
assertion / waiver | Status |
| --- | --- | --- | --- | --- | --- |
| B1 | NVIDIA#5225 | Persisted sandbox-entry gateway resolution is used by
lifecycle commands. | `none` | Existing
`src/lib/actions/sandbox/sandbox-gateway-routing.test.ts`,
`src/lib/onboard/gateway-binding.test.ts`,
`src/lib/onboard/sandbox-registration.test.ts` | covered |
| B2 | NVIDIA#5225 | Onboard repair/double-onboard failures include captured
onboard output diagnostics. | `none` | Existing live
`test/e2e-scenario/live/onboard-repair.test.ts`,
`test/e2e-scenario/live/double-onboard.test.ts`; diagnostics are
bash-runner-only verbosity and not a durable Vitest assertion. | waived
|
| B3 | NVIDIA#5487 | Plain `nemoclaw onboard` auto-detects an `in_progress`
session and resumes without `--resume`; `--fresh` suppresses
auto-resume. | `hosted-compatible capable` |
`test/e2e-scenario/live/onboard-resume.test.ts` Phase 3.5 mutates the
completed session to `in_progress`, asserts `(resume mode)` + cached
skips, then asserts `--fresh` fails at injected preflight without resume
banner. | covered |
| B4 | NVIDIA#5410 | Rebuild resumes messaging from `messaging.plan` rather
than legacy `providerCredentialHashes`; stale top-level provider hash
state is not used. | `none` |
`test/e2e-scenario/live/rebuild-hermes.test.ts` curated registry omits
`providerCredentialHashes`;
`src/lib/onboard/machine/handlers/sandbox.test.ts` refreshes
registry-plan credential hashes from env on rebuild resume. | covered |
| B5 | NVIDIA#5410 | Empty/staged rebuild messaging plan is preserved and
token-backed channels are not rediscovered. | `none` | Existing
`src/lib/actions/sandbox/rebuild-messaging-stage.test.ts` and
`src/lib/onboard/machine/handlers/sandbox.test.ts`. | covered |
| B6 | NVIDIA#5760 | Hosted-inference/messaging rebuild and live answer
assertions tolerate model whitespace around integer `42`. |
`hosted-compatible capable` | Existing
`test/helpers/e2e-answer-assertions.test.ts`, consumed by
`agent-turn-latency`, `full-e2e`, `launchable-smoke`, and
`sandbox-operations` live Vitests. | covered |
| B7 | NVIDIA#5760 | Stabilized hosted inference and messaging rebuild remain
validated by live full/sandbox/launchable/rebuild targets. |
`hosted-compatible capable` | Existing live targets remain unchanged;
local live execution blocked by Docker daemon unavailable. Selective
workflow required after PR opens. | follow-up |

## Inference mode support
- Default mode for touched live targets: `hosted-compatible capable` for
onboard-resume/rebuild-hermes/full/sandbox/launchable answer paths;
`none` for unit/process registry and gateway routing tests.
- Real inference support preserved: yes for existing hosted-compatible
live targets; no new inference adapter seam added here.
- Modes validated in this PR: local unit/process Vitests only; live
hosted-compatible validation needs GitHub runner/secrets because local
Docker daemon is unavailable.
- If not validated with real inference: local
`NEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project
e2e-scenarios-live test/e2e-scenario/live/onboard-resume.test.ts
test/e2e-scenario/live/rebuild-hermes.test.ts` failed at prereq Docker
daemon check before scenario assertions.

## Validation
- [x] `git diff --check`
- [x] `npm test -- src/lib/onboard/machine/handlers/sandbox.test.ts
test/helpers/e2e-answer-assertions.test.ts
src/lib/actions/sandbox/sandbox-gateway-routing.test.ts
src/lib/onboard/entry-options.test.ts
src/lib/onboard/sandbox-registration.test.ts
src/lib/actions/sandbox/rebuild-messaging-stage.test.ts`
- [x] `npm run typecheck:cli`
- [x] `npm run build:cli`
- [x] `npm run test-size:check`
- [ ] hosted-compatible selective E2E workflow: pending PR / runner
dispatch

## Follow-ups / waivers
- Waiver B2: bash-only diagnostic verbosity from NVIDIA#5225 is not a durable
Vitest contract; existing live tests already preserve the functional
repair/double-onboard behavior.
- Follow-up B7: dispatch selective live Vitest scenarios on GitHub
runner with Docker + hosted inference secret after PR opens.


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

## Summary by CodeRabbit

* **Tests**
* Added coverage for sandbox resume flows to verify updated Telegram
credentials are picked up when resuming a rebuild.
* Expanded end-to-end onboarding resume scenarios to confirm implicit
resume behavior, including skipped cached steps and fresh runs starting
from the expected point.
* Strengthened rebuild scenario checks to ensure curated registry
entries no longer include legacy credential-hash data.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants