Skip to content

refactor(onboard): run final phases through FSM slice#4507

Merged
cv merged 96 commits into
mainfrom
stack/onboard-fsm-use-final-slice
Jun 10, 2026
Merged

refactor(onboard): run final phases through FSM slice#4507
cv merged 96 commits into
mainfrom
stack/onboard-fsm-use-final-slice

Conversation

@cv

@cv cv commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Move the fresh-run agent/openclaw setup, policies, and finalization live call sites onto the final FSM flow slice. Resume remains on the compatibility path for now so branch setup, policy, and final verification checks continue to run for ahead-state sessions.

Changes

  • Build a final OnboardFlowContext from the core flow output in src/lib/onboard.ts.
  • Wrap branch setup, policy setup, and finalization as sequence phases.
  • Use runFinalOnboardFlowSequence(...) for fresh runs starting at openclaw or agent_setup.
  • Preserve compatibility execution for resume/ahead-state sessions.

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

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

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

Summary by CodeRabbit

Refactor

  • Reorganized onboarding finalization logic to use an improved orchestration system for better code structure and reliability.

Tests

  • Added comprehensive test suite for final onboarding flow phases, validating critical orchestration behaviors including phase execution order and session persistence.

cv added 30 commits May 27, 2026 15:18
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>
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>
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>
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>
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>
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 13 commits June 9, 2026 12:57
…e-sequence-slice

# Conflicts:
#	src/lib/onboard/machine/flow-slices.test.ts
#	src/lib/onboard/machine/flow-slices.ts
…slice' into stack/onboard-fsm-final-sequence-slice
…-slice' into stack/onboard-fsm-use-initial-slice
…ice' into stack/onboard-fsm-use-core-slice

# Conflicts:
#	src/lib/onboard.ts
…' into stack/onboard-fsm-use-final-slice

# Conflicts:
#	src/lib/onboard.ts
…al-sequence-slice

# Conflicts:
#	src/lib/onboard/machine/flow-slices.test.ts
#	src/lib/onboard/machine/flow-slices.ts
…-slice' into stack/onboard-fsm-use-initial-slice
Base automatically changed from stack/onboard-fsm-use-core-slice to main June 10, 2026 00:33
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv marked this pull request as ready for review June 10, 2026 00:53
Signed-off-by: Carlos Villela <cvillela@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 `@src/lib/onboard.ts`:
- Around line 6679-6695: The code snapshots selectedMessagingChannels from
coreContext before running policy merges, causing getMessagingChannels and
verifyDeployment to use stale data; change the code to stop using the outer
selectedMessagingChannels variable and instead reference the live value on the
final flow context/session after policies are applied (e.g., use
finalFlowContext.selectedMessagingChannels or session.getMessagingChannels()
inside getMessagingChannels and verifyDeployment); update occurrences where
selectedMessagingChannels is closed-over (including the instances referenced
around getMessagingChannels and verifyDeployment) to read from the
finalFlowContext/session so mergePolicyMessagingChannels updates are respected.
🪄 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: 9dd9d632-ba4a-4e99-be94-84c67dd1a9a1

📥 Commits

Reviewing files that changed from the base of the PR and between 8c98d76 and fca2bef.

📒 Files selected for processing (3)
  • src/lib/onboard.ts
  • src/lib/onboard/machine/final-flow-phases.test.ts
  • src/lib/onboard/machine/final-flow-phases.ts

Comment thread src/lib/onboard.ts Outdated
cv added 4 commits June 9, 2026 18:06
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 27246820487
Target ref: 86a24fe79ee53ece7d89ab6f3c2c354ab364b4bb
Workflow ref: main
Requested jobs: cloud-onboard-e2e,onboard-resume-e2e,messaging-providers-e2e,hermes-e2e
Summary: 4 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
hermes-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-resume-e2e ✅ success

@cv cv added v0.0.63 Release target and removed v0.0.62 Release target labels Jun 10, 2026
@cv cv merged commit 3a0cb2b into main Jun 10, 2026
31 checks passed
@cv cv deleted the stack/onboard-fsm-use-final-slice branch June 10, 2026 02:39
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 refactor PR restructures code without intended behavior change v0.0.63 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants