fix: shield-cohort-post-tx-modal-not-show#39898
Merged
Conversation
Contributor
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (1 files, +0 -2)
👨🔧 @MetaMask/extension-platform (1 files, +1 -0)
🕵️ @MetaMask/extension-privacy-reviewers (1 files, +1 -1)
🧪 @MetaMask/qa (2 files, +2 -1)
🔐 @MetaMask/web3auth (1 files, +41 -11)
|
Contributor
Builds ready [a8d7a95]
UI Startup Metrics (1455 ± 110 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
lwin-kyaw
previously approved these changes
Feb 10, 2026
huggingbot
reviewed
Feb 11, 2026
huggingbot
reviewed
Feb 11, 2026
pedronfigueiredo
previously approved these changes
Feb 11, 2026
LeVinhGithub
previously approved these changes
Feb 11, 2026
a08c365
huggingbot
approved these changes
Feb 11, 2026
chaitanyapotti
approved these changes
Feb 11, 2026
Contributor
Builds ready [a08c365]
UI Startup Metrics (1331 ± 90 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
LeVinhGithub
approved these changes
Feb 11, 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
The Shield announcement modal uses a cohort strategy (wallet_home / post_tx) to determine when to show users the entry modal. Users assigned to the
post_txcohort were never seeing the modal due to multiple issues in the evaluation flow:pendingShieldCohortwas not persisted - Withpersist: false, thePOST_TXcohort value set by#assignPostTxCohortafter a swap/transfer was lost whenever the MV3 service worker restarted. On the next Home page visit,componentDidMountwould overwrite it withWALLET_HOME, causing the evaluation to return early for pending-but-not-expired users. Changed topersist: trueso the value survives service worker restarts.Pending cohort cleared before evaluation completed -
setPendingShieldCohort(null)was called synchronously beforeevaluateCohortEligibilityhad a chance to finish. If the evaluation failed, the pending cohort was permanently lost with no retry. Now the pending cohort is only cleared after the evaluation promise resolves successfully.Timeout event fired incorrectly for non-expired cohorts - When
entrypointCohort === POST_TX, the guardentrypointCohort !== POST_TX && !hasExpiredwas alwaysfalse, causing theShieldEligibilityCohortTimeoutevent to fire even when the assigned cohort had not actually expired. Added ahasExpiredguard so the timeout event only fires when the cohort has genuinely expired.Missing error observability - Failures in
evaluateCohortEligibilitywere only logged withlog.warn. Added Sentry error capture so cohort evaluation failures surface in monitoring.post_txcould not overwrite an existingwallet_homepending cohort -#assignPostTxCohortonly setPOST_TXwhenpendingShieldCohortwas falsy (!pendingShieldCohort). If the user had already visited Home (setting it toWALLET_HOME), a subsequent swap would not overwrite it. Now the guard checks specifically forpendingShieldCohort === POST_TXinstead, allowingPOST_TXto take priority overWALLET_HOME.Ref: cohort technical details
Changelog
CHANGELOG entry: Fixed a bug where users assigned to the post-transaction Shield cohort would never see the Shield announcement modal
Related issues
Fixes:
Manual testing steps
post_txcohort, sign in and navigate to the Home pageverify no modal appears (initial cohort assignment happens silently for post_tx users)post_txcohortpendingShieldCohortvalue persists across restarts and the modal still appearswallet_homecohort users: verify the modal still appears immediately on first Home page visit (no regression)Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches persisted app state and Shield cohort/metrics flow, which could affect when modals appear and what telemetry is emitted, but changes are localized and largely additive/guarded.
Overview
Fixes Shield cohort handling so users assigned to the
post_txcohort reliably see the Shield entry modal.pendingShieldCohortis now persisted inAppStateController,SubscriptionServicenow allowsPOST_TXto override an existing pending cohort, and the UI evaluation flow was hardened by clearing/restoring the pending cohort around async eligibility checks (with added Sentry capture), awaiting modal state updates, and only emitting theShieldEligibilityCohortTimeoutmetric when the assigned cohort has actually expired. Test fixtures/state snapshots were updated to reflect the new persistedpendingShieldCohortstate.Written by Cursor Bugbot for commit a08c365. This will update automatically on new commits. Configure here.