fix: reject pending confirmations when app locks#26905
Conversation
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key observations:
Impact analysis:
The change is well-contained and defensive in nature, with proper error handling. The unit tests provide good coverage of the new functionality. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
The committed fixture schema is out of date. To update, comment: |
|



Description
If the user is on a send confirmation and the app goes idle until the device and MetaMask lock, after unlocking they no longer see that confirmation. If they then start a new send, the UI can show the previous confirmation instead of the new one, because the old approval was never rejected and remains first in the pending list.
Solution
When the app locks, reject all pending approvals by calling
ApprovalController.clear(providerErrors.userRejectedRequest())in the lock saga, before navigating to the lock screen. That way there are no stale confirmations after unlock, and any new send shows the correct confirmation.Changes
app/store/sagas/index.ts: InappLockStateMachine, after handlingLOCKED_APP, clear pending approvals viaEngine.context.ApprovalController.clear(...)inside try/catch, then navigate toLOCK_SCREEN. Log and ignore errors so navigation still runs.app/store/sagas/sagas.test.ts: AddApprovalControllerwithclearto the Engine mock; add tests that clear is called withuserRejectedRequest()when the app locks and that navigation toLOCK_SCREENstill happens whenclearthrows.Changelog
CHANGELOG entry: Fixed issue of confirmation not rejecting when app locks
Related issues
Fixes: #26320
Manual testing steps
Screenshots/Recordings
reject-approval-app-locks.webm
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes approval/confirmation lifecycle by clearing all pending approvals on app lock, which could inadvertently reject legitimate in-flight requests if triggered unexpectedly. Guarded with try/catch and covered by new saga tests, but behavior impacts transaction confirmations.
Overview
Prevents stale transaction/permission confirmations after unlocking by clearing any pending approvals when
UserActionType.LOCKED_APPfires, rejecting them withproviderErrors.userRejectedRequest()before navigating toRoutes.LOCK_SCREEN.Updates saga tests to mock
ApprovalController.clearand assert it is invoked on lock, and that navigation to the lock screen still occurs even if clearing approvals throws.Written by Cursor Bugbot for commit 2f1c2d3. This will update automatically on new commits. Configure here.