fix: prevent re-sync account removal dialogs#40572
Merged
chloeYue merged 2 commits intorelease/13.20.1from Mar 3, 2026
Merged
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
ccharly
commented
Mar 3, 2026
| "@metamask/assets-controllers@npm:^99.4.0": "patch:@metamask/assets-controllers@npm%3A99.4.0#~/.yarn/patches/@metamask-assets-controllers-npm-99.4.0-13861a06b6.patch", | ||
| "@metamask/assets-controllers@npm:^93.0.0": "patch:@metamask/assets-controllers@npm%3A99.4.0#~/.yarn/patches/@metamask-assets-controllers-npm-99.4.0-13861a06b6.patch" | ||
| "@metamask/assets-controllers@npm:^93.0.0": "patch:@metamask/assets-controllers@npm%3A99.4.0#~/.yarn/patches/@metamask-assets-controllers-npm-99.4.0-13861a06b6.patch", | ||
| "@metamask/multichain-account-service@npm:^7.0.0": "patch:@metamask/multichain-account-service@npm%3A6.0.0#~/.yarn/patches/@metamask-multichain-account-service-npm-6.0.0-a23b03a175.patch" |
Contributor
Author
There was a problem hiding this comment.
This is a transitive deps of @metamask/assets-controllers, but the actual runtime version used for @metamask/multichain-account-service was ^6.0.0, so this is ok to resolve to this version.
ccharly
commented
Mar 3, 2026
| - this.messenger.captureException?.(sentryError); | ||
| - } | ||
| - })); | ||
| + console.warn(`Snap "${this.snapId}" has de-synced accounts, Snap has more accounts than MetaMask! (${localSnapAccounts.length} < ${snapAccounts.size})`); |
Contributor
Author
There was a problem hiding this comment.
Still logging as a warning just in case.
12ac815 to
eeda900
Compare
eeda900 to
617059a
Compare
Contributor
Builds ready [2907681]
UI Startup Metrics (1422 ± 109 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
7 tasks
gantunesr
approved these changes
Mar 3, 2026
chloeYue
approved these changes
Mar 3, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Prevent auto-removal of de-synced Snap accounts.
This feature has been introduced to keep Snaps and the client in-sync, but the dialogs are a side-effects of this.
There is not clear root-cause of why the de-sync happened in the first place, but we have strong suspicions that some Snap accounts can have duplicated addresses (race-condition), in which case, the account removal might not target the proper duplicated account.
Duplicated accounts might have the same addresses, but not the same IDs, and since we're removing "by address", there's not guarantee we're going to to delete the right account.
For now, we skip the re-sync entirely has there is not undesired side-effects of having more Snap accounts than the client.
Changelog
CHANGELOG entry: Fixed automatic account removal dialogs, no accounts will be deleted automatically.
Related issues
N/A
Manual testing steps
Difficult to replicate. See the recordings.
Screenshots/Recordings
Before
Screen.Recording.2026-03-03.at.14.52.25.mov
After
Screen.Recording.2026-03-03.at.15.04.59.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes Snap account re-sync behavior by disabling automatic deletion of Snap-side accounts when a count mismatch is detected, which could leave stale Snap accounts but avoids destructive/incorrect removals.
Overview
Prevents automatic removal of de-synced Snap accounts by changing
SnapAccountProviderto log a warning and bail out when the Snap reports more accounts than MetaMask, instead of attempting to delete the extras.Applies this as a Yarn patch to
@metamask/multichain-account-service@6.0.0, updatingpackage.json/yarn.lockto use the patched dependency and adjustingattribution.txtaccordingly.Written by Cursor Bugbot for commit 2907681. This will update automatically on new commits. Configure here.