fix: Snap Platform Watcher throwing error after wallet reset#8124
Open
fix: Snap Platform Watcher throwing error after wallet reset#8124
Conversation
ccharly
reviewed
Mar 5, 2026
ccharly
reviewed
Mar 6, 2026
packages/multichain-account-service/src/snaps/SnapPlatformWatcher.ts
Outdated
Show resolved
Hide resolved
| ); | ||
| }); | ||
|
|
||
| it('resolves immediately if platform is already ready', async () => { |
Contributor
There was a problem hiding this comment.
Maybe we could add a similar test case than this one when the Snap platform is ready but that the promise is not ready yet?
Making sure we wait for ensureOnboardingComplete to be fulfilled first?
Testing async stuff can be tricky, but that sounds like a good test case. WDYT?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This PR fixes the
Snap platform cannot be used nowerror by modifying Snap Platform Watcher.References
Related ticket: MetaMask/metamask-extension#40114
Extension PR that applies the fix: TBD
Checklist
Note
Medium Risk
Changes the Snap platform readiness gate by optionally awaiting an external onboarding-completion callback, which can affect when Snap-based operations unblock and could introduce new waiting/failure modes if misused.
Overview
Adds an optional onboarding gate for Snap usage.
MultichainAccountServicenow accepts an optionalensureOnboardingCompletecallback and passes it intoSnapPlatformWatcher.SnapPlatformWatcher.ensureCanUseSnapPlatform()now awaitsensureOnboardingComplete(when provided) before waiting forSnapControllerreadiness, preventing Snap operations from proceeding until re-onboarding completes after a wallet reset.Tests are expanded to cover the new option (including ordering when the platform is already ready) and a race-guard case where readiness flips back to not-ready before the awaiting continuation runs;
CHANGELOG.mdis updated accordingly.Written by Cursor Bugbot for commit 12b2b57. This will update automatically on new commits. Configure here.