Skip to content

refactor(onboard): make runtime the machine authority - #7716

Merged
cv merged 37 commits into
mainfrom
codex/onboard-fsm-runtime-authority
Aug 4, 2026
Merged

refactor(onboard): make runtime the machine authority#7716
cv merged 37 commits into
mainfrom
codex/onboard-fsm-runtime-authority

Conversation

@cv

@cv cv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Make OnboardRuntime the authority for normal machine transitions, revisions, terminal state, and machine events. Extract initial-to-core and core-to-final context handoffs from the onboarding entrypoint.

Related Issue

Related to #7703 and #7706

Changes

  • Validate and apply handler results only through OnboardRuntime.
  • Limit session step helpers to step-progress bookkeeping and context updates accepted by filterSafeUpdates. Prevent them from changing the machine snapshot.
  • Emit the existing redacted state.skipped event from OnboardRuntime when a pending or in-progress step becomes skipped.
  • Remove the machine-mutation compatibility bridge and unused legacy flow helper.
  • Keep explicit session recovery and the process-exit failure backstop as separate recovery boundaries.
  • Move flow-handoff validation and context construction into flow-handoff.ts while retaining process-bound reserved-name handling in the entrypoint.

Type of Change

  • Code change with documentation updates

Scope Review

  • Result: PASS
  • Evidence: Issues refactor(onboard): make runtime the machine authority #7703 and refactor(onboard): reduce entrypoint to setup and wiring #7706 record the maintainer-authored internal-refactor scope represented by this PR. The change does not add a supported integration, solution recipe, custom image, third-party stack, public API, or user-visible onboarding behavior. The existing contributor commits and attribution remain in the refreshed history.
  • GPU path: The verifyGpuSandboxLocalInferenceAndCommitAfterReady block remains unchanged by this PR. It still waits for GPU verification before committing the deferred runtime patch.

Quality Gates

  • Tests added or updated for changed behavior
  • Documentation not applicable — No supported CLI, configuration, default, workflow, or version 1 machine-event behavior changes. Internal ownership documents were updated.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed — Independent nine-category review passed for commit 8da6eb3cc3ccf502547b9b08dbdf28dbf48a4081 against 1ee723a3c0fd61fa6c8217b81035208ef5a68e09 with no findings.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: None requested; every required check must pass.

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: Independently reviewed all 39 changed paths at commit 8da6eb3cc3ccf502547b9b08dbdf28dbf48a4081 against 1ee723a3c0fd61fa6c8217b81035208ef5a68e09. src/lib/onboard/lifecycle-contracts.md and src/lib/onboard/machine/README.md match the implementation: OnboardRuntime owns normal machine transitions, terminal state, and machine events; step helpers update step status and context accepted by filterSafeUpdates without changing the machine snapshot; explicit recovery and the process-exit failure backstop remain separate boundaries; and flow-handoff.ts validates the required context. No user-facing docs/ update is required because supported behavior does not change. GitHub CI provides validation for this commit.
  • Agent: Codex Desktop independent documentation writer

Security Review

  • Result: PASS
  • Reviewed commit: 8da6eb3cc3ccf502547b9b08dbdf28dbf48a4081
  • Base commit: 1ee723a3c0fd61fa6c8217b81035208ef5a68e09
  • Secrets and credentials: PASS — persistence and event paths retain redaction, including secret-bearing URL and error coverage.
  • Input validation and data sanitization: PASS — handoffs validate required context; state writes remain gated by filterSafeUpdates; result source, target, kind, and transition are checked before mutation.
  • Authentication and authorization: PASS — no authentication or authorization surface changes.
  • Dependencies and third-party libraries: PASS — no dependency or registry changes.
  • Error handling and logging: PASS — errors expose finite machine-state names, and failure persistence and emitted events remain redacted.
  • Cryptography and data protection: PASS — no cryptographic behavior changes; secret-free session and redaction contracts remain.
  • Configuration and security controls: PASS — no network policy, container, header, port, permission, or debug setting changes.
  • Security testing: PASS — coverage checks stale-source and invalid-transition rejection, event redaction, filtered updates, and removal of the machine-mutation escape hatch.
  • System security: PASS — normal transition authority is centralized while fail-closed slice-entry checks and validated recovery paths remain.
  • Agent: Codex Desktop independent security reviewer

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable
  • Station profile/scenario: Not applicable
  • Result: Not applicable; this PR does not change scripts/prepare-dgx-station-host.sh.
  • Supporting evidence: Not applicable

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub — verification is pending after local commit 8da6eb3cc3ccf502547b9b08dbdf28dbf48a4081 is pushed.
  • 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 — commit hooks passed; pre-push is pending.
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — GitHub CI is authoritative and pending.
  • Applicable broad gate passed — GitHub CI is authoritative and pending.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, credentials, or private keys are added by this diff.
  • npm run docs builds without warnings (documentation changes only) — Not applicable; no published documentation page changed.
  • Documentation pages follow the style guide (documentation changes only) — independent documentation review passed.
  • New documentation pages include SPDX header and frontmatter (new pages only) — Not applicable; no new documentation page was added.

GitHub CI is authoritative.
No duplicate local test, documentation, build, or typecheck suite ran after the merge refresh.


Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Onboarding step failures are now recorded on the affected step without prematurely marking the entire session as failed.
    • Invalid or stale onboarding results are rejected before changing session state.
    • Improved handling and messaging for unexpected onboarding states.
    • Step completion preserves supported session details and updates only permitted fields.
    • Onboarding transitions now occur consistently, reducing unintended state changes during recovery or completion.
  • Documentation

    • Clarified onboarding transition, recovery, validation, and failure-handling behavior.

cv added 2 commits July 28, 2026 01:17
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 28, 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.

@github-code-quality

github-code-quality Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 8da6eb3 in the codex/onboard-fsm-ru... branch remains at 96%, unchanged from commit 5f87afa in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 8da6eb3 in the codex/onboard-fsm-ru... branch remains at 81%, unchanged from commit 1ee723a in the main branch.

Show a code coverage summary of the most impacted files.
File main 1ee723a codex/onboard-fsm-ru... 8da6eb3 +/-
src/lib/state/o...d-step-state.ts 100% 67% -33%
src/lib/onboard...esult-events.ts 100% 67% -33%
src/lib/state/o...oard-session.ts 91% 89% -2%
src/lib/onboard...hine/runtime.ts 95% 93% -2%
src/lib/onboard.ts 31% 31% 0%
src/lib/shields/index.ts 69% 69% 0%
src/lib/onboard...ime-boundary.ts 84% 86% +2%
src/lib/platform.ts 84% 89% +5%
src/lib/onboard...flow-handoff.ts 0% 100% +100%
src/lib/onboard...-slice-error.ts 0% 100% +100%

Updated August 04, 2026 03:07 UTC

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The onboarding runtime now owns machine transitions, revisions, terminal state, events, and result validation. Session helpers persist step status and safe data. Legacy step-mutation APIs and live-flow slice execution were removed.

Changes

Onboarding runtime authority

Layer / File(s) Summary
Shared flow-state validation errors
src/lib/onboard/machine/flow-slice-error.ts, src/lib/onboard/machine/*-flow-phases.ts, src/lib/onboard/machine/*-flow-phases.test.ts
Flow slices now use UnexpectedOnboardFlowSliceStateError for invalid states.
Runtime result validation and boundary flow
src/lib/onboard/machine/runtime.ts, src/lib/onboard/runtime-boundary.ts, src/lib/onboard/machine/runtime.test.ts, src/lib/onboard/runtime-boundary*.test.ts, src/lib/onboard/machine/*runner*.test.ts
Runtime APIs no longer accept mutation options or record-only methods. Result validation runs before application. Boundary transitions use explicit runtime methods.
Direct session step persistence
src/lib/state/onboard-session.ts, src/lib/state/onboard-session*.test.ts, test/repro-1751-extra.test.ts, test/source-architecture.test.ts, ci/*.json, test/*timeout*.test.ts
Step helpers update step fields without machine transitions, session failure state, or machine events. Tests and source-shape checks use and enforce the direct APIs.

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

Sequence Diagram(s)

sequenceDiagram
  participant Handler
  participant OnboardRuntimeBoundary
  participant OnboardRuntime
  participant OnboardSession
  Handler->>OnboardRuntimeBoundary: Return explicit state result
  OnboardRuntimeBoundary->>OnboardRuntime: Validate result metadata and graph transition
  OnboardRuntime->>OnboardSession: Persist step status and safe updates
  OnboardRuntime->>OnboardRuntime: Apply machine transition and emit events
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 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 and concisely describes the main change: making OnboardRuntime the authority for onboarding machine transitions.
✨ 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/onboard-fsm-runtime-authority

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

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

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · low confidence · 1 blocker · 6 warnings · 5 suggestions
  • Model comparison: normalized findings differ; normalized terminology decisions differ; normalized E2E selections differ; Nemotron reported 1 more blocker, 6 more warnings, 5 more suggestions.
4 terminology differences from the second opinion

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

  • OnboardRuntime at src/lib/onboard/machine/README.md:48: selected only by the second-opinion lane as established.
  • flow-handoff at src/lib/onboard/machine/README.md:22: selected only by the second-opinion lane as justified.
  • prepareCoreOnboardFlowContext at src/lib/onboard/machine/flow-handoff.ts:13: selected only by the second-opinion lane as justified.
  • prepareFinalOnboardFlowContext at src/lib/onboard/machine/flow-handoff.ts:46: selected only by the second-opinion lane as justified.
5 additional E2E selections from the second opinion

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

  • rebuild-openclaw: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • rebuild-hermes: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • security-posture: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • ubuntu-repo-cloud-openclaw: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • ubuntu-repo-cloud-langchain-deepagents-code: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. They do not change the primary assessment or E2E / PR Gate.

2 semantic terminology decisions

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

  • define — flow handoff at src/lib/onboard/machine/README.md:22: Keep the first-use definition in the machine README. Use “flow handoff” only for these context-transfer boundaries.
  • justified — step-progress bookkeeping at src/lib/onboard/machine/README.md:49: Use the term only when distinguishing step-helper effects from OnboardRuntime machine authority.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-onboard, onboard-repair, onboard-resume

Workflow run details

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

cv added 4 commits July 28, 2026 07:37
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv added the v0.0.97 label Jul 28, 2026
@cv cv self-assigned this Jul 28, 2026
@cjagwani cjagwani added v0.0.98 and removed v0.0.97 labels Jul 28, 2026
@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow refactor PR restructures code without intended behavior change labels Jul 28, 2026
@cjagwani

Copy link
Copy Markdown
Collaborator

Draft-stack babysitting status for exact head 90dd9cd (plain comment; no Changes Requested review): this PR depends on #7715 but its recorded base is 4788d97 while #7715 is now at 8ec0d88. The draft has no current CI evidence, sensitive-path review is still marked pending, auto-sync is disabled, and maintainer edits are disabled. I will review and gate a refreshed quiet stack after #7715 is resolved and this base is updated.

@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Security review for commit SHA 6a7a061: PASS.

  1. Secrets and credentials — PASS. No credential material was added. Session updates still pass through filterSafeUpdates; step errors and event data remain redacted.
  2. Input validation and sanitization — PASS. The runtime validates interruption state, result source, target, transition kind, and graph membership before persistence.
  3. Authentication and authorization — PASS. No authentication, authorization, permission, or token-validation behavior changed.
  4. Dependencies — PASS. No dependency manifest, container image, installer artifact, or third-party package changed.
  5. Error handling and logging — PASS. Interrupted sessions retain OnboardInterruptedError and resume guidance. Six focused nemoclaw onboard fails with InvalidOnboardMachineTransitionError after successful sandbox creation #7982 assertions protect the behavior.
  6. Cryptography and data protection — PASS. No cryptographic behavior changed. Existing session filtering, redaction, atomic persistence, and file-permission boundaries remain in place.
  7. Configuration and isolation — PASS. No network policy, sandbox capability, port, runtime isolation, or production configuration changed.
  8. Security testing — PASS. Coverage includes step-helper ownership, stale and invalid results, single runtime transitions, redaction, interrupted sessions, and a source guard preventing the removed mutation APIs from returning. GitHub CI is authoritative.
  9. System security and TOCTOU — PASS. OnboardRuntime is the sole normal machine-transition authority, validation is repeated when results are applied, and the existing onboarding lock continues to serialize cross-process work.

Issue #7703 records the accepted scope. No security finding blocks merge. Repository checks and required reviews for this commit remain separate merge gates.

@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Security review — PASS

Reviewed PR #7716 at commit b1f9f0c695e09691e2ae0dddfee4a88631774dfd against base 4cd4d64fe67143b57707f874afa0b9d269dfeff2 and linked issue #7703.

The change removes the legacy step-owned machine-mutation path, centralizes result validation in OnboardRuntime, and preserves context filtering and event redaction. The final guard reports an invalid transition for an ordinary failed session while preserving OnboardInterruptedError for an interrupted session. I found no security finding that blocks approval for this commit. GitHub CI is authoritative for test execution.

Findings

No findings.

Detailed analysis

  1. Secrets and Credentials — PASS: No credential material or credential files were added. Credential-like test values are redaction fixtures. Session updates remain restricted by filterSafeUpdates.
  2. Input Validation and Data Sanitization — PASS: Runtime validation checks result source, target, transition kind, and graph membership before machine mutation. Persisted step errors continue through redactSensitiveText, and terminal transitions fail before state changes.
  3. Authentication and Authorization — PASS: The diff adds no endpoint, identity, permission, or authorization behavior.
  4. Dependencies and Third-Party Libraries — PASS: No dependency manifest, registry, version, or package source changed.
  5. Error Handling and Logging — PASS: Interrupted sessions retain actionable interruption guidance. Ordinary terminal failures retain InvalidOnboardMachineTransitionError. New errors contain state identifiers, not credentials or internal paths, and machine events retain their redaction boundary.
  6. Cryptography and Data Protection — PASS: The diff changes no cryptographic primitive or transport protection. Credential values remain outside persisted onboarding context.
  7. Configuration and Security Headers — PASS: No runtime configuration, container privilege, port exposure, CORS, CSP, or image policy changed.
  8. Security Testing — PASS: Tests cover stale result rejection before mutation, filtered context updates, redacted failures, step helpers that cannot mutate machine state or emit machine events, terminal interruption classification, invalid transitions, and removal of the legacy mutation API. GitHub CI execution is still in progress.
  9. System Security — PASS: Removing the compatibility escape hatch eliminates the second persisted machine authority. applyResult validates again after paired step writes, so a changed durable state cannot bypass transition validation.

Files reviewed

  • ci/source-architecture-budget.json
  • ci/source-shape-test-budget.json
  • src/lib/onboard/lifecycle-contracts.md
  • src/lib/onboard/machine/README.md
  • src/lib/onboard/machine/core-flow-phases.test.ts
  • src/lib/onboard/machine/core-flow-phases.ts
  • src/lib/onboard/machine/final-flow-phases.runtime.test.ts
  • src/lib/onboard/machine/final-flow-phases.ts
  • src/lib/onboard/machine/flow-phases/agent-policy-finalization.test.ts
  • src/lib/onboard/machine/flow-sequence.test.ts
  • src/lib/onboard/machine/flow-slice-error.ts
  • src/lib/onboard/machine/flow-slices.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/machine/initial-flow-phases.ts
  • src/lib/onboard/machine/live-flow-slice.test.ts (removed)
  • src/lib/onboard/machine/live-flow-slice.ts (removed)
  • src/lib/onboard/machine/runner-sequence.test.ts
  • src/lib/onboard/machine/runner.test.ts
  • src/lib/onboard/machine/runtime.test.ts
  • src/lib/onboard/machine/runtime.ts
  • src/lib/onboard/machine/sequence-runner.test.ts
  • src/lib/onboard/machine/transition-traces.test.ts
  • src/lib/onboard/resume-machine-repair.test.ts
  • src/lib/onboard/runtime-boundary-record-only.test.ts (renamed)
  • src/lib/onboard/runtime-boundary-step-result.test.ts
  • src/lib/onboard/runtime-boundary.test.ts
  • src/lib/onboard/runtime-boundary.ts
  • src/lib/state/onboard-session-reasoning-effort.test.ts
  • src/lib/state/onboard-session.test.ts
  • src/lib/state/onboard-session.ts
  • src/lib/state/onboard-step-mutation.test.ts (removed)
  • src/lib/state/onboard-step-mutation.ts (removed)
  • test/gateway-state-reconcile-2276.test.ts
  • test/helpers/onboard-final-flow-phases.ts
  • test/helpers/onboard-legacy-step-mutation.ts (removed)
  • test/package-contract/openshell-policy-boundary.test.ts
  • test/repro-1751-extra.test.ts
  • test/source-architecture.test.ts

@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Security review — PASS

Reviewed PR #7716 at commit bcd3c03 against base c614c0d and issue #7703. The merge resolution preserves the prior PR delta. No security finding remains.

  1. Secrets and Credentials — PASS: No credential material was added; session values still pass through filtering and redaction.
  2. Input Validation and Data Sanitization — PASS: Runtime validates result source, target, transition kind, graph membership, and interruption state before mutation.
  3. Authentication and Authorization — PASS: No identity, permission, endpoint, or token behavior changes.
  4. Dependencies and Third-Party Libraries — PASS: No dependency or package-source change.
  5. Error Handling and Logging — PASS: Terminal errors preserve interruption classification and redact persisted error text.
  6. Cryptography and Data Protection — PASS: No cryptographic or transport behavior changes.
  7. Configuration and Security Headers — PASS: No policy, privilege, port, image, CORS, or CSP change.
  8. Security Testing — PASS: Tests cover stale-result rejection, filtered context, redaction, step/runtime authority separation, terminal transitions, and legacy API removal.
  9. System Security — PASS: OnboardRuntime is the normal machine-transition authority; paired step/result writes revalidate after the step write, closing the state-change interval.

Required GitHub checks remain a separate gate.

cv and others added 2 commits August 3, 2026 06:24
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Clarify the source-shape contract and session step bookkeeping.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Security review receipt — PASS

Reviewed commit SHA 48a2766b2c213a59dd5862cb579bcf6911267865 against base SHA d09b530ef1d3045b0c26b6d34462cb2175d9fb94.

Category Result Evidence
Secrets and credentials PASS No credential value or credential-handling code changed. Context updates remain constrained by filterSafeUpdates.
Input validation and sanitization PASS Runtime source, target, transition-kind, graph, and safe-update validation are unchanged.
Authentication and authorization PASS No identity, permission, or authorization path changed.
Dependencies PASS No package, lockfile, workflow, image, or external-source change.
Errors and logging PASS Sanitization, redaction, and machine-event behavior are unchanged.
Cryptography and data protection PASS No cryptographic, storage-protection, or transport behavior changed.
Security configuration PASS No policy, port, container, header, or deployment configuration changed.
Security testing PASS Existing invalid-transition, stale-result, interruption, redaction, legacy-normalization, revision, and event-ownership coverage remains intact. The final commit changes only explanatory text.
System security PASS OnboardRuntime remains the normal machine-transition authority. Removed mutation APIs remain absent, and step helpers cannot change the machine snapshot.

Issue #7703 establishes the accepted internal refactor scope. This PR does not create a new supported surface or user-visible onboarding behavior.

The final commit changes two explanatory lines after the prior PASS: src/lib/onboard/machine/README.md and test/source-architecture.test.ts. It changes no executable statement or test assertion.

The confirmed #8106 unverifiedPids listener finding is present in the base-only gateway fallback file. PR #7716 does not modify that file or finding.

Required GitHub checks for commit SHA 48a2766b2c213a59dd5862cb579bcf6911267865 remain authoritative. This review does not replace them.

Use one term for step helper bookkeeping across the internal authority contracts.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Security review receipt

Reviewed commit SHA dfd7278233a27d82c6d00efce36991401212dbc0 against base SHA d09b530ef1d3045b0c26b6d34462cb2175d9fb94.

Verdict: PASS. The PR-specific diff has no security finding that prevents approval.

  • Secrets and Credentials — PASS. The diff adds no credential value or credential exposure.
  • Input Validation and Data Sanitization — PASS. Machine events remain the validated transition boundary.
  • Authentication and Authorization — PASS. Session step helpers cannot obtain machine-transition authority.
  • Dependencies and Third-Party Libraries — PASS. The diff adds no dependency.
  • Error Handling and Logging — PASS. Failure handling does not expose a secret or broaden internal detail.
  • Cryptography and Data Protection — PASS. The diff changes no cryptographic or data-protection contract.
  • Configuration and Security Headers — PASS. The diff changes no HTTP header, port, image privilege, or security configuration.
  • Security Testing — PASS. Regression tests cover invalid transitions, interrupt behavior, recovery, and failure paths.
  • System Security — PASS. The runtime remains the lifecycle authority; filtered step bookkeeping cannot replace the machine snapshot.

Accepted issue #7703 establishes product scope for this change. The listener-ownership finding introduced by PR #8106 is present in the base SHA and does not originate in this PR diff.

cv added a commit that referenced this pull request Aug 3, 2026
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv

cv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Sensitive-path security review: PASS

Reviewed commit SHA 7c83651249b7a53a847a317736aa59e46ded8101 against base SHA 8c542b214f15561f71b262523d80a61ed4a5e9c7.

No security findings remain for this SHA pair.

  • Product scope: PASS. Issue refactor(onboard): make runtime the machine authority #7703 defines an internal refactor with no new supported integration, configuration, workflow, or product surface.
  • DCO and commit verification: PASS. Required check dco-check passed, and all 33 comparison commits have valid GitHub signatures.
  • Review threads: PASS. The only review thread is resolved and outdated; no unresolved thread remains.
  • Current base interaction: PASS. The base's Hermes preserved-environment handoff remains intact and is not exposed through machine-event context or metadata.

Security categories:

  • Secrets and credentials — PASS. Session updates remain restricted by filterSafeUpdates; events expose redacted context and credential environment-variable names, not credential values.
  • Input validation and data sanitization — PASS. Runtime results validate source, target, transition kind, terminal state, and transition graph before mutation. Skipped-step events map only known step names.
  • Authentication and authorization — PASS. No identity, token-verification, permission, or ownership path changes.
  • Dependencies and third-party libraries — PASS. No dependency, package source, registry, version range, or executable was added.
  • Error handling and logging — PASS. Failure text, event errors, metadata, and context continue through existing redaction and sanitization.
  • Cryptography and data protection — PASS. No cryptographic, key-handling, transport, encryption, or digest contract changes.
  • Configuration and security headers — PASS. No HTTP, CSP, CORS, port, privilege, image, or network-policy surface changes.
  • Security testing — PASS. Tests cover redaction, mapped state and step, idempotency, terminal and unknown steps, stale results, and the OpenClaw and Hermes paths.
  • System security — PASS. Step helpers cannot advance the machine snapshot; normal transitions and events remain owned by OnboardRuntime, and the production onboarding lock continues to cover validation and persistence.

The skipped-step remediation reads the known step's prior status, records the status change, and emits exactly once only when the resulting status is skipped. GitHub checks for the reviewed commit SHA remain the validation authority; this review did not duplicate the test suites locally.

This PASS covers the sensitive-path security review only. Required checks and required reviews remain separate merge requirements.

cv and others added 5 commits August 3, 2026 08:05
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
cv added a commit that referenced this pull request Aug 3, 2026
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions github-actions Bot added v0.0.102 and removed v0.0.101 labels Aug 3, 2026

@apurvvkumaria apurvvkumaria 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 current head 7dfbb44. Runtime ownership of snapshot and state mutation is consistent, and transition filtering plus event emission preserve the intended behavior. Focused testing passed 56 assertions; one suite load issue was due to a missing generated dist artifact in the temporary review worktree rather than a failing product assertion. I found no blocking defect.

cv added 2 commits August 3, 2026 16:37
<!-- markdownlint-disable MD041 -->
## Summary

Stack 3 of 5; depends on #7716.

Move initial-to-core and core-to-final context validation into
`flow-handoff.ts`. The entrypoint retains dependency wiring instead of
constructing handoff context.

## Related Issue

Refs #7706

## Changes

- Validate preflight GPU output before core execution.
- Preserve sandbox-name precedence and reserved-name reporting.
- Validate sandbox identity and inference output before final execution.
- Document the extracted handoff owner.

## Type of Change

- [x] Code change with doc updates

## Quality Gates

- [x] Tests added or updated for changed behavior
- [x] Documentation not applicable — No supported command,
configuration, default, workflow, or user-visible behavior changes. The
internal ownership README was updated.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed — Independent nine-category review
passed for commit SHA `74d024849fb23fca25c339f567220a937298d6c0` against
base SHA `7c83651249b7a53a847a317736aa59e46ded8101`:
#7717 (comment)

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `docs-updated`
- Evidence: Independent Codex Desktop documentation writer review passed
for commit SHA `74d024849fb23fca25c339f567220a937298d6c0` against base
SHA `7c83651249b7a53a847a317736aa59e46ded8101`. Reviewed all five
changed files against `WRITING.md`, the NemoClaw Controlled Word List,
the shared documentation-writing contract, and the documentation
contributor guidance. `src/lib/onboard/machine/README.md` accurately
states that `flow-handoff.ts` validates required data and constructs
context at the initial-to-core and core-to-final boundaries. The
entrypoint continues to supply process-bound dependencies and
reserved-name output. Changed errors and behavior-oriented test titles
accurately describe preflight GPU validation, sandbox-name precedence,
required final context, and preservation of runner results and sessions.
Issue #7706 defines this internal refactor scope and prohibits a new
public API or speculative extension point. The change does not modify a
supported command, output, configuration, workflow, default, or other
user-visible behavior, so no user-facing `docs/` source change is
required.
- Agent: Codex Desktop
<!-- docs-review-head-sha: 74d0248 -->
<!-- docs-review-agents-blob-sha: 3dd7c24 -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Result: Not applicable; this PR does not change
`scripts/prepare-dgx-station-host.sh`.

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set — CI /
Pull Request test jobs passed for commit SHA
`74d024849fb23fca25c339f567220a937298d6c0`.
- [x] Applicable broad gate passed — Required check `E2E / PR Gate`
passed for commit SHA `74d024849fb23fca25c339f567220a937298d6c0`.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [x] `npm run docs` builds without warnings (documentation changes
only) — Not applicable; no published documentation source changed.
- [x] Doc pages follow the style guide (doc changes only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>

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

Approve — re-reviewed exact head 49f779c after the flow-handoff extraction and main refresh. The extracted helpers preserve sandbox-name precedence, runtime session authority, selected channels, normalized GPU state, and the full final-flow context while adding explicit validation for required handoff fields. The merge resolution also retains the current source-budget changes. Exact-head handoff and context-focused tests passed 44 of 44. The one shared CI shard failure is the same managed-image registry fetch timeout seen on an unrelated PR and is not attributable to this delta. No blocking defect found.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv merged commit abae710 into main Aug 4, 2026
46 checks passed
@cv
cv deleted the codex/onboard-fsm-runtime-authority branch August 4, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Architecture, design debt, major refactors, or maintainability area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants