Skip to content

fix: prevent re-sync account removal dialogs#40572

Merged
chloeYue merged 2 commits intorelease/13.20.1from
cc/fix/skip-snap-desync-accounts-deletion
Mar 3, 2026
Merged

fix: prevent re-sync account removal dialogs#40572
chloeYue merged 2 commits intorelease/13.20.1from
cc/fix/skip-snap-desync-accounts-deletion

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Mar 3, 2026

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.

Open in GitHub Codespaces

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

  • 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.

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 SnapAccountProvider to 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, updating package.json/yarn.lock to use the patched dependency and adjusting attribution.txt accordingly.

Written by Cursor Bugbot for commit 2907681. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

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.

@metamaskbot metamaskbot added the team-accounts-framework Accounts team label 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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

- this.messenger.captureException?.(sentryError);
- }
- }));
+ console.warn(`Snap "${this.snapId}" has de-synced accounts, Snap has more accounts than MetaMask! (${localSnapAccounts.length} < ${snapAccounts.size})`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still logging as a warning just in case.

@ccharly ccharly marked this pull request as ready for review March 3, 2026 14:23
@ccharly ccharly force-pushed the cc/fix/skip-snap-desync-accounts-deletion branch from 12ac815 to eeda900 Compare March 3, 2026 14:24
@ccharly ccharly force-pushed the cc/fix/skip-snap-desync-accounts-deletion branch from eeda900 to 617059a Compare March 3, 2026 14:25
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 3, 2026

Builds ready [2907681]
UI Startup Metrics (1422 ± 109 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup14221189172510914661643
load1197100214639012421357
domContentLoaded1190100014558912361352
domInteractive2918110222591
firstPaint168701274133214292
backgroundConnect21419326512218236
firstReactRender18144042025
initialActions106113
loadScripts99280412498910371158
setupStore1373051623
numNetworkReqs312292202286
BrowserifyPower User HomeuiStartup231714528435112823184243
load13001082203218913231749
domContentLoaded12791077190817913151718
domInteractive41211532641103
firstPaint249811919246291444
backgroundConnect53227532835764082215
firstReactRender25165072641
initialActions104111
loadScripts1046853166217410701469
setupStore1774982031
numNetworkReqs71401582482123
WebpackStandard HomeuiStartup90372413881159581108
load760629110596824911
domContentLoaded754624109895818906
domInteractive2916112192681
firstPaint1296632360171234
backgroundConnect301969103450
firstReactRender19124262130
initialActions106112
loadScripts751622108894816900
setupStore1354561326
numNetworkReqs312292192582
WebpackPower User HomeuiStartup1266881194119113471658
load74564312521197321049
domContentLoaded73563612441187231040
domInteractive40191892939102
firstPaint160691064118181296
backgroundConnect18313241158176327
firstReactRender22184642328
initialActions103111
loadScripts73263412341167201029
setupStore1242141520
numNetworkReqs1213825548143214
FirefoxBrowserifyStandard HomeuiStartup16851468284822416712195
load14081242253515514261608
domContentLoaded14061241253515514221608
domInteractive863820038102155
firstPaint------
backgroundConnect7431107210856188
firstReactRender14125241415
initialActions103112
loadScripts13761217250314513971537
setupStore218258341649
numNetworkReqs3220104222795
BrowserifyPower User HomeuiStartup27622105816467229463546
load15821251628452615862045
domContentLoaded15821251628452615852045
domInteractive13438567103132394
firstPaint------
backgroundConnect3421121405287388997
firstReactRender19147591922
initialActions203122
loadScripts15391226624852215402013
setupStore1649773205176673
numNetworkReqs752918038102139
WebpackStandard HomeuiStartup16621394313424516951985
load14101181290322314451580
domContentLoaded14091181290222314451580
domInteractive106311589156133158
firstPaint------
backgroundConnect61282023467121
firstReactRender15123041524
initialActions103122
loadScripts13851161287922314231552
setupStore248205341674
numNetworkReqs312097182786
WebpackPower User HomeuiStartup28201978983182828823644
load16071299773467116262160
domContentLoaded16061298773467116262160
domInteractive159481318179154513
firstPaint------
backgroundConnect42411118933395921068
firstReactRender21156762327
initialActions207122
loadScripts15581228769566415751989
setupStore17411734191255598
numNetworkReqs72282203993158
📊 Page Load Benchmark Results

Current Commit: 2907681 | Date: 3/3/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.08s (±60ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 759ms (±58ms) 🟢 | historical mean value: 735ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 83ms (±10ms) 🟢 | historical mean value: 85ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.08s 60ms 1.04s 1.40s 1.16s 1.40s
domContentLoaded 759ms 58ms 726ms 1.08s 810ms 1.08s
firstPaint 83ms 10ms 64ms 164ms 92ms 164ms
firstContentfulPaint 83ms 10ms 64ms 164ms 92ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@chloeYue chloeYue merged commit cb1bf17 into release/13.20.1 Mar 3, 2026
328 of 331 checks passed
@chloeYue chloeYue deleted the cc/fix/skip-snap-desync-accounts-deletion branch March 3, 2026 17:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants