feat: harden relay status polling#8189
Merged
matthewwalsh0 merged 4 commits intomainfrom Mar 17, 2026
Merged
Conversation
matthewwalsh0
added a commit
that referenced
this pull request
Mar 12, 2026
… statuses - Add unit tests for getRelayPollingInterval and getRelayPollingTimeout - Move RELAY_PENDING_STATUSES and RELAY_FAILURE_STATUSES to constants.ts - Add missing 'depositing' status from Relay v3 API docs - Add PR number (#8189) to changelog entries
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
e0ce55a to
e5d0f42
Compare
OGPoyraz
reviewed
Mar 17, 2026
OGPoyraz
approved these changes
Mar 17, 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 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
Relay status polling currently treats any non-success/failure status as pending, meaning an unexpected API response silently loops forever. This PR hardens the polling logic to handle an explicit set of known statuses and throw immediately on unrecognized values, preventing silent infinite loops.
Additionally, the polling interval and timeout are now configurable via feature flags (
relay.pollingIntervalandrelay.pollingTimeout), and transient network errors are silently retried instead of immediately propagating — only surfacing if the configured timeout is reached.On the transaction controller side, the startup cleanup now uses a distinct error message when an incomplete transaction has
requiredTransactionIdsthat are all confirmed, distinguishing "relay completed but parent didn't finish" from the general incomplete case.References
Checklist
Note
Medium Risk
Changes Relay intent completion polling behavior (status handling, retries, and optional timeouts), which could affect MetaMask Pay transaction finalization in edge cases. Startup transaction cleanup now emits a new failure message variant, impacting downstream error handling/telemetry expectations.
Overview
Hardens Relay status polling by explicitly categorizing statuses as pending vs failure, throwing on unrecognized statuses (instead of polling indefinitely), and retrying transient network errors.
Makes polling configurable via new feature-flag fields
relay.pollingInterval(defaulting to the existing constant) and optionalrelay.pollingTimeout, with timeout errors including the last seen status.Improves startup cleanup diagnostics in
TransactionControllerby using a distinct failure message when an incomplete transaction’srequiredTransactionIdsare all alreadyconfirmed.Written by Cursor Bugbot for commit 80b21ff. This will update automatically on new commits. Configure here.