Skip to content

Conversation

@cryptodev-2s
Copy link
Contributor

@cryptodev-2s cryptodev-2s commented Jan 14, 2026

Explanation

Connects NetworkController to ConnectivityController to prevent retries and suppress RPC endpoint error events when the user is offline.

Changes

  • The NetworkController now depends on the ConnectivityController to prevent retries and suppress events when the user is offline.
  • When offline, NetworkController:rpcEndpointUnavailable and NetworkController:rpcEndpointDegraded events are suppressed since retries don't occur and circuit breakers don't trigger.

Breaking Changes

  • BREAKING: NetworkController now requires ConnectivityController:getState action handler to be registered on the messenger
    • You must register a ConnectivityController:getState action handler on your root messenger that returns an object with a connectivityStatus property ('online' or 'offline').
    • You must delegate the ConnectivityController:getState action from your root messenger to the NetworkControllerMessenger using rootMessenger.delegate({ messenger: networkControllerMessenger, actions: ['ConnectivityController:getState'] }).

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Overview

Connects NetworkController to ConnectivityController so RPC retries are prevented when offline and related events are suppressed.

  • Adds dependency on @metamask/connectivity-controller; updates README dependency graph
  • Wires connectivity via messenger (ConnectivityController:getState) and propagates isOffline to RpcService/RpcServiceChain
  • When offline: do not retry RPC requests; suppress NetworkController:rpcEndpointUnavailable and NetworkController:rpcEndpointDegraded

Breaking change

  • Requires registering and delegating ConnectivityController:getState on the root messenger to the NetworkControllerMessenger

Tests

  • Updates and adds tests to cover offline behavior and event suppression; plumbs isOffline through existing tests

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

@cryptodev-2s cryptodev-2s requested a review from mcmire January 14, 2026 15:46
@cryptodev-2s cryptodev-2s self-assigned this Jan 14, 2026
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot publish-preview

@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from 1a810fe to b590b43 Compare January 14, 2026 15:47
@cryptodev-2s cryptodev-2s changed the title feat(network-controller): connect NetworkController to ConnectivityCo… feat(network-controller): connect NetworkController to ConnectivityController Jan 14, 2026
@cryptodev-2s cryptodev-2s marked this pull request as ready for review January 14, 2026 15:47
@cryptodev-2s cryptodev-2s requested review from a team as code owners January 14, 2026 15:47
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from b590b43 to 1bdba27 Compare January 14, 2026 18:34
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from 1bdba27 to 753eb65 Compare January 14, 2026 21:07
@cryptodev-2s cryptodev-2s requested a review from a team as a code owner January 14, 2026 21:07
…CTIVITY_STATUSES

- Rename ConnectivityStatus constant to CONNECTIVITY_STATUSES
- Export ConnectivityStatus as a type instead of enum
- Update all references to use CONNECTIVITY_STATUSES
- Export CONNECTIVITY_STATUSES from index
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch 2 times, most recently from 5c3f070 to 35be87b Compare January 14, 2026 21:26
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot publish-preview

@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch 3 times, most recently from 3d671df to be34729 Compare January 14, 2026 21:59
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot publish-preview

…ntroller

- Add ConnectivityController:getState action handler requirement
- Suppress rpcEndpointUnavailable and rpcEndpointDegraded events when offline
- Update NetworkController to check connectivity status before publishing events
- Add tests for offline event suppression
…fline

- Add isOffline check to RpcService retry filter policy to prevent retries when offline
- Suppress rpcEndpointUnavailable and rpcEndpointDegraded events when offline
- Add tests to verify retries don't happen when offline
- Add tests to verify events are suppressed when offline
- Update CHANGELOG with breaking change documentation
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from e3d5f1f to d59bf85 Compare January 14, 2026 23:14
Base automatically changed from feature/add-connectivity-controller to main January 15, 2026 14:05
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot publish-preview

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Had some comments, but they are minor. This looks good in general.

@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from 0af1e4f to 46c0f95 Compare January 15, 2026 14:31
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from 46c0f95 to b048b72 Compare January 15, 2026 15:08
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from b048b72 to c0b3840 Compare January 15, 2026 15:11
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch 2 times, most recently from 5d44b9b to 24c8e00 Compare January 15, 2026 16:05
@cryptodev-2s cryptodev-2s force-pushed the feature/connect-network-controller-to-connectivity branch from 24c8e00 to 75b0aaa Compare January 15, 2026 16:12
@cryptodev-2s
Copy link
Contributor Author

@metamaskbot publish-preview

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

@cryptodev-2s cryptodev-2s added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit 9134e8b Jan 15, 2026
294 checks passed
@cryptodev-2s cryptodev-2s deleted the feature/connect-network-controller-to-connectivity branch January 15, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants