Skip to content

feat: add support for self onboarding - #51

Merged
seaona merged 3 commits into
mainfrom
self-onboarding-mode-support
Oct 15, 2026
Merged

seaona merged 3 commits into
mainfrom
self-onboarding-mode-support

Conversation

@seaona

@seaona seaona commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Description

  • Add --self-onboarding flag
  • When the flag is set, the CLI reads stdin. A terminal, or anything other than 12 or 24 words, exits with an error that does not print the phrase. A valid phrase is normalized to single-spaced words and sent as srp on the localhost POST /launch body.
    The launch schema rejects self-onboarding unless that phrase is present. The error text does not include the words.
    Before a launch step is written to the knowledge store, srp is removed. In prod mode, the usual “unlock the wallet” prerequisites are omitted, because onboarding is supposed to finish during launch.

Manual testing

Create a file phrase.txt with the 12 or 24 words SRP.

Test: mm launch --context prod --state onboarding --self-onboarding < phrase.txt

@seaona
seaona marked this pull request as ready for review October 14, 2026 11:36
@seaona
seaona requested a review from a team as a code owner October 14, 2026 11:36
cryptotavares
cryptotavares previously approved these changes Oct 14, 2026

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

Looks good. The only small issue that I found is if the launch step is run in the batch tool (run_steps). If that happens we are not redacting the SRP from the knowledge store. But we can tackle it in a subsequent PR

@seaona

seaona commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Looks good. The only small issue that I found is if the launch step is run in the batch tool (run_steps). If that happens we are not redacting the SRP from the knowledge store. But we can tackle it in a subsequent PR

oh good point! Thank you @cryptotavares I've added a fix here 91978bf

@seaona
seaona merged commit 818426f into main Oct 15, 2026
27 checks passed
@seaona
seaona deleted the self-onboarding-mode-support branch October 15, 2026 09:24
LabinatorSolutions pushed a commit to LabinatorSolutions/metamask-extension that referenced this pull request Oct 19, 2026
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Agents that run against the extension, such as visual validation in
agent-orchestration, currently onboard a wallet by clicking through the
onboarding UI with mm commands. That breaks whenever the onboarding
screens change.

This PR adds self-onboarding to the llm-workflow launcher. mm launch
--state onboarding --self-onboarding reads a secret recovery phrase from
stdin and onboards to the wallet using the existing onboarding flows
(used and maintained in our e2e, so no breaking change is possible).



This depends on 

[MetaMask/client-mcp-core#51](MetaMask/client-mcp-core#51),
which adds the --self-onboarding flag to mm. It builds on the
page-object refactor in
[MetaMask#47055](MetaMask#47055).


## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**
(you need to copy the dist folder for @metamask/client-mcp-core build
from the other repo braanch
MetaMask/client-mcp-core#51) // this was already
merged and released. Just do yarn
1. Build the wallet  yarn start
2. Stop any running daemon so it picks up the new code: yarn mm cleanup
--shutdown.
3. Launch with a test phrase ` echo "SRP" | yarn mm launch --state
onboarding --self-onboarding`
4. Run yarn mm get-state. Check that isUnlocked is true, currentScreen
is home, and accountAddress.
5. Check that the phrase does not appear in .mm-daemon.log: rg -c
abandon .mm-daemon.log should find nothing.
6. Check the error cases, which should each fail with a clear message:
Without stdin, yarn mm launch --state onboarding --self-onboarding
should report that a phrase is required.
echo "<phrase>" | yarn mm launch --state default --self-onboarding
should report that self-onboarding requires stateMode: 'onboarding'.


## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**



https://github.com/user-attachments/assets/de2a6a94-8238-426d-913b-e1c39c6c4288




<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.




<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Changes are limited to e2e/LLM launch tooling; production extension
behavior is unchanged, with explicit SRP validation, clearing, and error
redaction in the new path.
> 
> **Overview**
> Adds **`--self-onboarding`** to the LLM workflow launcher so `mm
launch` can import a secret recovery phrase during startup (stdin via
the provider) and land on **home**, reusing the same e2e onboarding page
objects (`importSRPOnboardingFlow`, unlock/completion handling) instead
of ad-hoc agent clicks.
> 
> New **`self-onboarding`** helpers validate/normalize the phrase (12/24
words, canary rejection), run the import flow, then
**`finishOnboarding`** handles unlock vs completion and side-panel
quirks (reload home before/after). The launcher clears the SRP from
options after use; flow errors are redacted when they contain the
phrase.
> 
> Supporting fixes: Playwright **`pasteIntoField`** dispatches a real
**`paste`** event (fallback to `insertText`); onboarding flow navigates
home via **`openNewURL`** for sidepanel tests. README documents the
mode; unit tests cover the self-onboarding module.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
45cd3ca. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants