Skip to content

refactor(onboard): route token download through transfer adapter - #11829

Merged
rsliter merged 8 commits into
mainfrom
codex/11497-onboarding-token-v2
Sep 16, 2026
Merged

rsliter merged 8 commits into
mainfrom
codex/11497-onboarding-token-v2

Conversation

@rsliter

@rsliter rsliter commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Outcome

Onboarding now reads the OpenClaw gateway token through the typed asynchronous sandbox-transfer adapter while preserving the existing dashboard URL and terminal output. Failed, interrupted, or partial downloads still produce the prior token-free fallback, and temporary credential files are removed before transfer resources are released.

Reason

Issue #11497 is migrating direct sandbox transfer subprocesses to the shared typed adapter. The onboarding token download was the remaining consumer after session export migrated separately.

Related issues

Closes #11497
Refs #9813

Changes

  • Route onboarding gateway-token downloads through OpenShellSandboxTransferExecutor using the currently selected gateway.
  • Add an output-suppression option for credential downloads while preserving inherited output for existing transfer consumers.
  • Propagate the transfer's asynchronous contract through dashboard and onboarding callers without changing displayed output.
  • Protect selected-gateway routing, credential custody cleanup, interruption handling, and fallback behavior with focused tests.

Verification

  • Focused CLI Vitest run, 6 files and 94 tests, passed.
  • npx vitest run --project integration test/onboarding/onboard-dashboard.test.ts --pool=forks --maxWorkers=1, 17 tests, passed.
  • npx vitest run --project integration test/onboarding/onboard-inference-reconciliation.test.ts --pool=forks --maxWorkers=1, 25 tests, passed.
  • Focused async lifecycle tests, 3 CLI files and 43 tests, passed.
  • Focused dashboard integration tests, 2 files and 34 tests, passed with a writable isolated HOME.
  • NODE_OPTIONS=--max-old-space-size=8192 npm run typecheck:cli, passed.
  • npm run build:cli, passed.
  • Installed pre-push publication validation, including repository checks, secret scan, CLI build, and CLI TypeScript checks, passed for 08ad9ecef63a53cacc90a6d1866fbcdc7a0c1a7a.
  • The diff contains no secrets, API keys, or credentials.

Review notes

Repository: NVIDIA/NemoClaw. Candidate: 08ad9ecef63a53cacc90a6d1866fbcdc7a0c1a7a. Sensitive paths include src/commands/sandbox/** and src/lib/onboard/**. No pre-publication specialist review is available: npm run review:local was attempted on the same behavior diff, but its ephemeral OpenShell gateway refused connections during reviewer setup. These paths await independent review.


Signed-off-by: Rebecca Sliter [email protected]

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when retrieving gateway tokens and dashboard URLs during sandbox onboarding.
    • Onboarding now waits for readiness checks, token retrieval, and dashboard display to complete before continuing.
    • Improved handling of failed, interrupted, missing, or invalid credential transfers.
    • Credential downloads can now run quietly without displaying subprocess output.
  • Tests
    • Expanded coverage for asynchronous onboarding flows, transfer cleanup, authentication, and error handling.

@rsliter rsliter self-assigned this Sep 15, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 15, 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 Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: e8e24842-88cb-43d7-947f-1875f68e6a3c

📥 Commits

Reviewing files that changed from the base of the PR and between 064ab4f and 08ad9ec.

📒 Files selected for processing (7)
  • src/lib/onboard.ts
  • src/lib/onboard/dashboard-web-auth-token.test.ts
  • src/lib/onboard/dashboard.ts
  • src/lib/onboard/machine/handlers/agent-setup.test.ts
  • src/lib/onboard/machine/handlers/finalization.test.ts
  • test/onboarding/onboard-dashboard.test.ts
  • test/onboarding/onboard-finalization-dashboard-forward.test.ts
💤 Files with no reviewable changes (4)
  • src/lib/onboard/dashboard-web-auth-token.test.ts
  • src/lib/onboard.ts
  • test/onboarding/onboard-dashboard.test.ts
  • src/lib/onboard/dashboard.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The change routes onboarding token downloads through the OpenShell transfer adapter and adds output suppression. Dashboard URL, gateway-token, readiness, and finalization paths now support asynchronous dependencies. Tests update mocks and assertions for promise-based execution.

Changes

Onboarding transfer and asynchronous command flow

Layer / File(s) Summary
Transfer output control
src/lib/adapters/openshell/sandbox-transfer.*
Transfer requests support "inherit" and "suppress" output modes. Suppressed transfers ignore subprocess stdio.
Dashboard token transfer and propagation
src/lib/onboard/dashboard.ts, src/lib/dashboard-url-command.ts, src/commands/sandbox/dashboard-url.ts, test/onboarding/onboard-dashboard.test.ts, src/lib/dashboard-url-command.test.ts
Dashboard token retrieval uses the transfer executor, validates openclaw.json, cleans up temporary resources, and returns a promise. Dashboard URL execution awaits token retrieval.
Gateway token and lifecycle awaiting
src/lib/gateway-token-command.ts, src/commands/sandbox/gateway/token.ts, src/lib/onboard/sandbox-lifecycle.ts, src/lib/onboard/machine/handlers/*
Gateway token retrieval, readiness checks, lifecycle callbacks, and finalization dashboard printing await asynchronous operations.
Asynchronous contract validation
src/commands/*test.ts, src/lib/*test.ts, test/helpers/*, test/credentials/*, test/onboarding/*
Tests use asynchronous mocks, await command execution, and assert rejected promises for failure paths.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: cv, prekshivyas

Merge Risk: ⚪ Minimal · up to 08ad9

The onboarding transfer migration retains its intended asynchronous completion and cleanup behavior in the supplied evidence. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 25 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #11497 requires typed asynchronous transfer use for session export and onboarding token downloads. The reviewed head contains SessionExportTransfers with OpenShellSandboxTransferExecutor, aw…
Out of Scope Changes check ✅ Passed The changes stay within Issue #11497. They propagate the required asynchronous transfer contract, add credential-output suppression, remove obsolete onboarding dependencies, and update focused tests a…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: routing onboarding token downloads through the transfer adapter.
  • Fix all pre-merge checks with AI
✨ 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 codex/11497-onboarding-token-v2

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

@github-code-quality

github-code-quality Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 08ad9ec in the codex/11497-onboardi... branch remains at 96%, unchanged from commit 2489723 in the main branch.

TypeScript / code-coverage/cli

The overall line coverage in commit 08ad9ec in the codex/11497-onboardi... branch remains at 83%, unchanged from commit 28232ba in the main branch.

Show a line coverage summary of the most impacted files.
File main 28232ba codex/11497-onboardi... 08ad9ec +/-
src/lib/onboard.ts 54% 54% 0%
src/lib/sandbox...rce-identity.ts 82% 82% 0%
src/lib/state/m...ck/decisions.ts 100% 100% 0%
src/lib/onboard...on-bootstrap.ts 84% 85% +1%
src/lib/onboard...uild-context.ts 74% 75% +1%
src/lib/onboard/dashboard.ts 71% 73% +2%

Updated September 15, 2026 18:27 UTC

@rsliter

rsliter commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rsliter

rsliter commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rsliter

rsliter commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 08ad9ec. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

Request review only when Require no Advisor blockers is green.

All previous runs

@rsliter
rsliter marked this pull request as ready for review September 15, 2026 19:58
@rsliter
rsliter requested review from cv and kaofelix and removed request for cv September 15, 2026 19:58

@kaofelix kaofelix 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.

Reviewed commit 08ad9ec. No security or correctness findings. The typed transfer path preserves selected-gateway routing, suppresses credential download output, removes temporary credential files before resource release, and awaits all asynchronous callers. Focused CLI tests and CLI type-check passed; focused integration coverage passed except for one unrelated local port-8080 conflict.

@rsliter
rsliter merged commit 60c6554 into main Sep 16, 2026
107 checks passed
@rsliter
rsliter deleted the codex/11497-onboarding-token-v2 branch September 16, 2026 12:57
cv pushed a commit that referenced this pull request Sep 18, 2026
<!-- markdownlint-disable MD041 -->
## Outcome

OpenShell inference route reads now flow through one typed observer for
the accepted first slice of #9809. Existing gateway targeting, native
lifecycle behavior, list/status redaction, and external command behavior
remain unchanged.

## Reason

Inference consumers independently constructed `openshell inference get`
commands and interpreted raw CLI results. Centralizing the read boundary
gives each consumer the same scoped, typed, and redacted observation
without changing mutation or recovery behavior.

### Related issues

Refs #9809

## Changes

- Add typed configured and unconfigured observations plus distinct
validation, authentication, timeout, schema, transport, and command
failures.
- Keep named-gateway scoping, bounded capture, control-sequence cleanup,
endpoint-override refusal, and the base gateway's legacy output
compatibility inside the OpenShell adapter.
- Migrate the accepted CLI, onboarding, connect, readiness, doctor,
inventory, status, and config-export readers to typed results.
- Remove the superseded production reader and protect the boundary with
adapter and consumer tests.

Route mutation and rollback (#11738), plugin transport (#9813),
generated gRPC transport (#9828), credentials, provider or gateway
lifecycle changes, new routing semantics, status lifecycle suppression,
and live E2E remain excluded.

## Verification

- `NODE_OPTIONS=--max-old-space-size=8192 npm run typecheck:cli` —
passed.
- `npm run checks:repository` — all 19 repository checks passed with no
architecture cycles.
- Focused CLI unit selection — 16 files and 377 tests passed, covering
the adapter and migrated source consumers.
- Focused integration selection — 8 files and 157 tests passed; the
status JSON integration suite passed 21/21.
- `npm run test:changed` — 3,182 tests passed. The route-observation
acceptance set is complete with no candidate-owned failure. Two
process-heavy suites were classified environmental after focused replay;
`snapshot-auto-create-failure` passed 4/4 unchanged and
`runtime-provider-contract` passed 75/75 with a 15-second local
diagnostic timeout.
- The remaining launch group was classified inherited: 18 cases fail
with the same sandbox-replacement journaling error on this candidate and
on exact base `3c6591ddba4a321ab8e6b766203e44d6e3b8002e`; this PR
changes none of the three owning launch/probe files.
- Commit hooks passed, including repository structure, formatting, lint,
tests selected by the commit, DCO, and secret checks.
- The diff contains no secrets, API keys, or credentials.

No live E2E is required because the accepted behavior is fully
observable at deterministic adapter and consumer boundaries and does not
mutate external state.

## Review notes

Sensitive inference and onboarding paths are changed. Pre-publication
review covered exact gateway targeting, refusal of endpoint overrides,
bounded capture, typed failure separation, redaction, current lifecycle
ownership, and the criterion-to-evidence ledger. The refreshed head
still requires exact-head CodeRabbit, PR Review Advisor, CI, and human
approval before merge.

The current-main refresh incorporates related lifecycle and
test-contract changes from #11741, #11776, #11792, #11821, #11829,
#11865, #11889, #11891, #11908, and #11913 without expanding this PR's
behavior.

Accepted scope:
#9809 (comment)

---
Signed-off-by: Rebecca Sliter <[email protected]>


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

## Summary by CodeRabbit

- **New Features**
- Added structured inference-route checks for configured and
unconfigured gateways.
  - Improved support for named gateways and provider/model verification.
- Added clearer handling for timeouts, authentication, connectivity,
validation, and schema errors.
- Improved sandbox connection, launch readiness, status, onboarding, and
recovery flows with verified route information.

- **Bug Fixes**
- Prevented untrusted or unavailable inference routes from being treated
as healthy.
- Added recovery guidance and preserved relevant failure details when
restoration cannot be confirmed.

- **Documentation**
- Documented inference-route behavior, gateway scoping, sanitization,
timeouts, and error reporting.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Rebecca Sliter <[email protected]>
Signed-off-by: San Dang <[email protected]>
Co-authored-by: Rebecca Sliter <[email protected]>
Co-authored-by: San Dang <[email protected]>
@wscurran wscurran added area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: security Security controls, permissions, secrets, or hardening integration: openclaw OpenClaw integration behavior refactor PR restructures code without intended behavior change labels Oct 14, 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: security Security controls, permissions, secrets, or hardening integration: openclaw OpenClaw integration behavior refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Route session export and onboarding downloads through the transfer adapter

3 participants