Skip to content

[codex] add first-run onboarding usage notice#1222

Open
13ernkastel wants to merge 8 commits intoNVIDIA:mainfrom
13ernkastel:codex/onboard-usage-notice
Open

[codex] add first-run onboarding usage notice#1222
13ernkastel wants to merge 8 commits intoNVIDIA:mainfrom
13ernkastel:codex/onboard-usage-notice

Conversation

@13ernkastel
Copy link
Copy Markdown

@13ernkastel 13ernkastel commented Apr 1, 2026

Summary

  • add a first-run onboarding usage notice after preflight and before any gateway or sandbox provisioning
  • load the notice from a bundled JSON config with an operator override via NEMOCLAW_ONBOARD_NOTICE_CONFIG
  • persist the last seen notice version so updated legal text can be shown again intentionally
  • add a dedicated docs page and focused tests for interactive and non-interactive behavior

Root Cause

The onboarding flow provisioned resources immediately after preflight with no configurable notice surface. A simple hardcoded banner would not satisfy the issue because legal text changes would either require JS edits or remain hidden behind a one-time boolean.

Impact

  • interactive onboarding now pauses once for acknowledgement before provisioning continues
  • non-interactive onboarding logs the notice to stderr and does not block
  • operators can swap the notice JSON without changing CLI logic
  • bumping the notice version re-displays the updated notice on the next onboarding run

Validation

  • ./node_modules/.bin/eslint bin/lib/onboard-notice.js bin/lib/onboard.js test/onboard-notice.test.js test/onboard.test.js
  • ./node_modules/.bin/vitest run test/onboard-notice.test.js test/onboard.test.js

Closes #1213

Summary by CodeRabbit

  • New Features

    • First-run onboarding displays a Usage Notice that requires acknowledgement and is re-shown when its version changes; supports non-interactive continuation.
    • Operator can override the bundled notice via an environment-pointed JSON.
  • Documentation

    • Added a Usage Notice reference page, updated onboarding command docs, and site navigation.
  • Tests

    • Added tests for display, persistence, non-interactive behavior, prompting, and version-based re-display.
  • Bug Fixes

    • Gracefully warns (does not fail) if notice state cannot be persisted.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

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

Adds a configurable "Usage Notice" to onboarding: a bundled JSON payload, a notice-management module with state persistence and display/acknowledgement logic, integration into the onboard flow before provisioning, tests, and documentation. Supports interactive and non-interactive modes and re-displays when the notice version changes.

Changes

Cohort / File(s) Summary
Notice Configuration
bin/config/onboard-notice.json
New bundled JSON notice payload containing version, title, summary, details, url, and prompt.
Notice Implementation
bin/lib/onboard-notice.js
New module: resolves config/state paths (env override support), validates/loads config, loads/sanitizes state, decides whether to show the notice, renders lines via stderr or injected writeLine, supports interactive promptFn or non-interactive continuation, and atomically persists state with warnings on failure.
Onboarding Integration
bin/lib/onboard.js
Inserts an awaited call to showOnboardNoticeIfNeeded(...) after the preflight step and before gateway checks/start.
Documentation
docs/index.md, docs/reference/commands.md, docs/reference/usage-notice.md
Adds Usage Notice docs, Reference toctree entry, notes about first-run display and NEMOCLAW_ONBOARD_NOTICE_CONFIG override, and operator disclaimer/guidance.
Tests
test/onboard-notice.test.js, test/onboard.test.js
New tests covering config loading, rendering, state persistence, interactive/non-interactive flows, error handling, version-based re-display, and a regex check that onboarding invokes the notice after preflight.

Sequence Diagram

sequenceDiagram
    participant User
    participant Onboard as onboard.js
    participant Notice as onboard-notice.js
    participant ConfigFS as Config File System
    participant StateFS as State File System

    User->>Onboard: Start onboarding
    Onboard->>Onboard: Mark preflight complete
    Onboard->>Notice: showOnboardNoticeIfNeeded(options)
    Notice->>ConfigFS: Load notice config (env override or default)
    ConfigFS-->>Notice: return config
    Notice->>Notice: Validate config
    Notice->>StateFS: Load last-seen state
    StateFS-->>Notice: return lastSeenVersion / null
    Notice->>Notice: Compare versions
    alt Should show notice
        Notice->>Notice: Render notice lines
        Notice->>User: Write lines to stderr / writeLine
        alt Interactive
            Notice->>User: promptFn(prompt)
            User-->>Notice: acknowledgement
        else Non-interactive
            Notice->>User: log continuation message
        end
        Notice->>StateFS: Atomically save new state (version + timestamp)
        StateFS-->>Notice: save result
    end
    Notice-->>Onboard: Return shown status & version
    Onboard->>Onboard: Continue onboarding (gateway checks/start)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nibble a clause and twitch my nose,
A notice hops forth before the show,
Press Enter, or let logs carry on,
The version stamped, then quietly gone,
Happy hops — onboarding's ready to go! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% 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 clearly and concisely describes the main change: adding a first-run onboarding usage notice, which is the primary objective of the PR.
Linked Issues check ✅ Passed The PR fully implements all coding requirements from #1213: displays notice before sandbox provisioning, supports non-interactive mode without blocking, makes notice text configurable via JSON and environment variable, and persists version to re-display on updates.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #1213 requirements: the notice config, notice display logic, integration into onboard flow, comprehensive tests, and documentation are all in-scope additions.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@13ernkastel 13ernkastel marked this pull request as ready for review April 1, 2026 03:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
test/onboard.test.js (1)

1827-1835: Tighten this ordering assertion around the gateway boundary.

This regex only proves the notice call appears somewhere after markStepComplete("preflight"). If the call moved below gateway startup, the test would still pass. Please anchor the match to the first gateway logic (for example const gatewayStatus = or startGateway() so the test protects the contract this PR is adding.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/onboard.test.js` around lines 1827 - 1835, The test's regex currently
only ensures showOnboardNoticeIfNeeded appears after
onboardSession.markStepComplete("preflight") but not that it occurs before
gateway startup; update the assertion in onboard.test.js so the match anchors
the sequence to the first gateway boundary (e.g., require
showOnboardNoticeIfNeeded\({ before either the first occurrence of "const
gatewayStatus =" or "startGateway("); locate the existing symbols
onboardSession.markStepComplete("preflight") and showOnboardNoticeIfNeeded and
modify the regex to assert they appear in that order and precede the gateway
marker (const gatewayStatus or startGateway) so the test fails if the notice
call moves below gateway startup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bin/lib/onboard-notice.js`:
- Around line 122-123: The call to saveOnboardNoticeState should be made
best-effort so that write failures do not abort onboarding: wrap the
saveOnboardNoticeState(config.version, statePath) call in a try/catch, and on
error call the existing logger (or console.warn) to emit a warning that includes
the error and the statePath, but do not rethrow; always return { shown: true,
version: config.version } regardless of persistence success so
non-interactive/onboard flow continues.

In `@docs/reference/usage-notice.md`:
- Around line 37-47: Add a required "Next Steps" section to the bottom of this
new page (the "Operator Override" section that documents
NEMOCLAW_ONBOARD_NOTICE_CONFIG and the JSON keys) that links to related docs
such as the CLI reference, configuration guide, and onboarding/installation
pages; ensure the section title is "Next Steps" and include short bulleted links
to the CLI usage, configuration file format, and onboarding guides so reviewers
see related navigation from this page.
- Around line 26-35: Replace the generic `{admonition}` block used for "Notice
and Disclaimer" with a MyST warning admonition (use the ::: warning ... :::
syntax) so the page follows the docs style guide; locate the existing
`{admonition}` token and the "Notice and Disclaimer" title and convert that
block to a MyST warning callout containing the same text content.

---

Nitpick comments:
In `@test/onboard.test.js`:
- Around line 1827-1835: The test's regex currently only ensures
showOnboardNoticeIfNeeded appears after
onboardSession.markStepComplete("preflight") but not that it occurs before
gateway startup; update the assertion in onboard.test.js so the match anchors
the sequence to the first gateway boundary (e.g., require
showOnboardNoticeIfNeeded\({ before either the first occurrence of "const
gatewayStatus =" or "startGateway("); locate the existing symbols
onboardSession.markStepComplete("preflight") and showOnboardNoticeIfNeeded and
modify the regex to assert they appear in that order and precede the gateway
marker (const gatewayStatus or startGateway) so the test fails if the notice
call moves below gateway startup.
🪄 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: Pro

Run ID: c0d944eb-d74e-4baa-97a7-5af1e09801b3

📥 Commits

Reviewing files that changed from the base of the PR and between 71b4141 and fbea648.

📒 Files selected for processing (8)
  • bin/config/onboard-notice.json
  • bin/lib/onboard-notice.js
  • bin/lib/onboard.js
  • docs/index.md
  • docs/reference/commands.md
  • docs/reference/usage-notice.md
  • test/onboard-notice.test.js
  • test/onboard.test.js

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
bin/lib/onboard-notice.js (1)

66-83: Optional: clean up temp file if atomic rename fails.

If fs.renameSync fails (e.g., permissions/race), the temp file may be left behind. A small cleanup path would avoid stale files in the state directory.

♻️ Suggested hardening for temp-file cleanup
 function saveOnboardNoticeState(version, statePath = getOnboardNoticeStatePath()) {
   const dir = path.dirname(statePath);
   const tmpPath = path.join(
     dir,
     `.onboard-notice.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 8)}.tmp`,
   );
   fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
   const payload = JSON.stringify(
     {
       lastSeenVersion: version,
       lastSeenAt: new Date().toISOString(),
     },
     null,
     2,
   );
-  fs.writeFileSync(tmpPath, payload, { mode: 0o600 });
-  fs.renameSync(tmpPath, statePath);
+  try {
+    fs.writeFileSync(tmpPath, payload, { mode: 0o600 });
+    fs.renameSync(tmpPath, statePath);
+  } catch (error) {
+    try {
+      fs.unlinkSync(tmpPath);
+    } catch {
+      // ignore cleanup failure
+    }
+    throw error;
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/lib/onboard-notice.js` around lines 66 - 83, The temp file created in
saveOnboardNoticeState (tmpPath) can be left behind if fs.renameSync fails; wrap
the rename in a try/catch so that on error you attempt to remove the tmpPath
(fs.unlinkSync(tmpPath)) before rethrowing the original error, and ensure any
unlink errors are swallowed/logged but don't mask the rename error; keep the
existing write-to-temp logic and rethrow the original exception after cleanup so
callers still see the failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@bin/lib/onboard-notice.js`:
- Around line 66-83: The temp file created in saveOnboardNoticeState (tmpPath)
can be left behind if fs.renameSync fails; wrap the rename in a try/catch so
that on error you attempt to remove the tmpPath (fs.unlinkSync(tmpPath)) before
rethrowing the original error, and ensure any unlink errors are swallowed/logged
but don't mask the rename error; keep the existing write-to-temp logic and
rethrow the original exception after cleanup so callers still see the failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cde6e627-1646-412e-b0c9-e5541fe1367b

📥 Commits

Reviewing files that changed from the base of the PR and between fbea648 and bda9238.

📒 Files selected for processing (3)
  • bin/lib/onboard-notice.js
  • docs/reference/usage-notice.md
  • test/onboard-notice.test.js
✅ Files skipped from review due to trivial changes (1)
  • docs/reference/usage-notice.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/onboard-notice.test.js

@wscurran wscurran added status: triage For new items that haven't been reviewed yet. NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). enhancement: feature Use this label to identify requests for new capabilities in NemoClaw. and removed status: triage For new items that haven't been reviewed yet. labels Apr 1, 2026
@wscurran
Copy link
Copy Markdown
Contributor

wscurran commented Apr 1, 2026

@wscurran wscurran added the Getting Started Use this label to identify setup, installation, or onboarding issues. label Apr 1, 2026
kjw3 added a commit that referenced this pull request Apr 2, 2026
…ing (#1290)

## Summary
- show a third-party software notice before `install.sh` launches
onboarding and before direct `nemoclaw onboard`
- require explicit `yes` in interactive flows and fail immediately on
any other answer
- require explicit non-interactive acceptance via
`--yes-i-accept-third-party-software` or
`NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1`
- link users to the official OpenClaw security guidance before
continuing
- render the security URL as a clickable terminal hyperlink where OSC 8
is supported, while still printing the raw URL
- implement the new notice capability in TypeScript under `src/lib`

## Details
This is aimed at issue #1213, but the acceptance behavior is stricter
than the original issue text.

The notice is specifically about third-party software liability and
OpenClaw usage, not NemoClaw terms. The acceptance flag and env var are
named accordingly.

The current notice is intentionally formatted for standard terminal
width and uses the approved wording in short, non-wrapping lines.

Reference shown to users:
- https://docs.openclaw.ai/gateway/security

Credit:
- builds on prior overlapping notice work in #1222 by @13ernkastel, but
extends it to the current acceptance model, non-interactive enforcement,
and the shared `install.sh` + `nemoclaw onboard` flow

## Validation
- `npm run build:cli`
- `npx vitest run test/usage-notice.test.js test/cli.test.js
test/install-preflight.test.js`
- `npx eslint bin/lib/usage-notice.js test/usage-notice.test.js`
- `npx tsc -p jsconfig.json --noEmit`

## Note
The full local git hook suite is currently blocked in this environment
by an unrelated `src/lib/preflight.test.ts` localhost listen failure
(`EPERM` on `127.0.0.1`). I did not change that area in this branch.


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

* **New Features**
* Onboarding and installer now require explicit acceptance of
third‑party software terms before proceeding; onboarding exits early if
consent is not given.
* Interactive mode displays a bundled usage notice and prompts users to
type "yes"; acceptance is persisted per user.
* Non‑interactive installs allow scripted acceptance via a new explicit
acceptance mechanism.

* **Documentation**
* CLI help, installer messages, and docs updated to document the new
non‑interactive acceptance option and TTY guidance.

* **Tests**
* Added and updated tests and e2e scripts to cover acceptance flows and
enforcement.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
cjagwani pushed a commit to fdzdev/NemoClaw that referenced this pull request Apr 3, 2026
…ing (NVIDIA#1290)

## Summary
- show a third-party software notice before `install.sh` launches
onboarding and before direct `nemoclaw onboard`
- require explicit `yes` in interactive flows and fail immediately on
any other answer
- require explicit non-interactive acceptance via
`--yes-i-accept-third-party-software` or
`NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1`
- link users to the official OpenClaw security guidance before
continuing
- render the security URL as a clickable terminal hyperlink where OSC 8
is supported, while still printing the raw URL
- implement the new notice capability in TypeScript under `src/lib`

## Details
This is aimed at issue NVIDIA#1213, but the acceptance behavior is stricter
than the original issue text.

The notice is specifically about third-party software liability and
OpenClaw usage, not NemoClaw terms. The acceptance flag and env var are
named accordingly.

The current notice is intentionally formatted for standard terminal
width and uses the approved wording in short, non-wrapping lines.

Reference shown to users:
- https://docs.openclaw.ai/gateway/security

Credit:
- builds on prior overlapping notice work in NVIDIA#1222 by @13ernkastel, but
extends it to the current acceptance model, non-interactive enforcement,
and the shared `install.sh` + `nemoclaw onboard` flow

## Validation
- `npm run build:cli`
- `npx vitest run test/usage-notice.test.js test/cli.test.js
test/install-preflight.test.js`
- `npx eslint bin/lib/usage-notice.js test/usage-notice.test.js`
- `npx tsc -p jsconfig.json --noEmit`

## Note
The full local git hook suite is currently blocked in this environment
by an unrelated `src/lib/preflight.test.ts` localhost listen failure
(`EPERM` on `127.0.0.1`). I did not change that area in this branch.


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

* **New Features**
* Onboarding and installer now require explicit acceptance of
third‑party software terms before proceeding; onboarding exits early if
consent is not given.
* Interactive mode displays a bundled usage notice and prompts users to
type "yes"; acceptance is persisted per user.
* Non‑interactive installs allow scripted acceptance via a new explicit
acceptance mechanism.

* **Documentation**
* CLI help, installer messages, and docs updated to document the new
non‑interactive acceptance option and TTY guidance.

* **Tests**
* Added and updated tests and e2e scripts to cover acceptance flows and
enforcement.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
lakamsani pushed a commit to lakamsani/NemoClaw that referenced this pull request Apr 4, 2026
…ing (NVIDIA#1290)

## Summary
- show a third-party software notice before `install.sh` launches
onboarding and before direct `nemoclaw onboard`
- require explicit `yes` in interactive flows and fail immediately on
any other answer
- require explicit non-interactive acceptance via
`--yes-i-accept-third-party-software` or
`NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1`
- link users to the official OpenClaw security guidance before
continuing
- render the security URL as a clickable terminal hyperlink where OSC 8
is supported, while still printing the raw URL
- implement the new notice capability in TypeScript under `src/lib`

## Details
This is aimed at issue NVIDIA#1213, but the acceptance behavior is stricter
than the original issue text.

The notice is specifically about third-party software liability and
OpenClaw usage, not NemoClaw terms. The acceptance flag and env var are
named accordingly.

The current notice is intentionally formatted for standard terminal
width and uses the approved wording in short, non-wrapping lines.

Reference shown to users:
- https://docs.openclaw.ai/gateway/security

Credit:
- builds on prior overlapping notice work in NVIDIA#1222 by @13ernkastel, but
extends it to the current acceptance model, non-interactive enforcement,
and the shared `install.sh` + `nemoclaw onboard` flow

## Validation
- `npm run build:cli`
- `npx vitest run test/usage-notice.test.js test/cli.test.js
test/install-preflight.test.js`
- `npx eslint bin/lib/usage-notice.js test/usage-notice.test.js`
- `npx tsc -p jsconfig.json --noEmit`

## Note
The full local git hook suite is currently blocked in this environment
by an unrelated `src/lib/preflight.test.ts` localhost listen failure
(`EPERM` on `127.0.0.1`). I did not change that area in this branch.


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

* **New Features**
* Onboarding and installer now require explicit acceptance of
third‑party software terms before proceeding; onboarding exits early if
consent is not given.
* Interactive mode displays a bundled usage notice and prompts users to
type "yes"; acceptance is persisted per user.
* Non‑interactive installs allow scripted acceptance via a new explicit
acceptance mechanism.

* **Documentation**
* CLI help, installer messages, and docs updated to document the new
non‑interactive acceptance option and TTY guidance.

* **Tests**
* Added and updated tests and e2e scripts to cover acceptance flows and
enforcement.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement: feature Use this label to identify requests for new capabilities in NemoClaw. Getting Started Use this label to identify setup, installation, or onboarding issues. NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(onboard): display usage notice during first-run onboarding

2 participants