Repository navigation
fix: handle injected provider connection issues - #7800
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe wallet wagmi config now detects widget mode, disables EIP-6963 there, and broadens reconnect eligibility to include Safe, mobile, and widget contexts. ChangesWidget-aware reconnect gating
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying explorer-dev with
|
| Latest commit: |
a45c93a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://dceb8c32.explorer-dev-dxz.pages.dev |
| Branch Preview URL: | https://fix-injected-provider-and-sa.explorer-dev-dxz.pages.dev |
Deploying swap-dev with
|
| Latest commit: |
7adae9c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d6d17505.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://fix-injected-provider-and-sa.swap-dev-5u6.pages.dev |
fairlighteth
left a comment
There was a problem hiding this comment.
⚠️ AI Review (Codex GPT-5, worked 5m): partial reconnect cherry-pick can re-open wallet regressions
Finding: [BLOCKING] Keep reconnect scoped until the Safe/widget isolation pieces are included
- Location:
libs/wallet/src/wagmi/config.ts:90andlibs/wallet/src/wagmi/config.ts:120 - This one is important: this turns AppKit reconnect on for every Safe/mobile load and starts the injected mobile connector even without
recentConnectorId. - Receipt: PR #7757 deliberately narrowed mobile reconnect to recent connectors, and the #7785 review found a similar broad reconnect change broke MetaMask in-app browser and Safe/widget isolation. The follow-up comment also calls out blanket reconnect as the wrong lever.
- The full #7790 branch this PR cites adds the missing context-isolation pieces (
enableEIP6963: !isWidgetand Safe/AppKit@appkit/*storage namespacing) and keeps the direct mobile injected connect behindhasRecentConnector. This PR cherry-picks only the reconnect part, so the known bleed/reconnect failure mode is still in play.
QA evidence needed
- Please add ER-vs-AR for MetaMask mobile first visit, reload, disconnect/reconnect, and Safe/widget isolation where a standalone widget has a browser wallet connected but the widget inside Safe must show the Safe account.
Suggested fix
- Either include the rest of the #7790 isolation changes and keep the direct mobile
connectWalletById('injected')path guarded byhasRecentConnector, or keepenableReconnectscoped until the Safe/mobile flows above are proven on a preview.
Review scope and related context
- No existing PR #7800 review thread covers this; CodeRabbit only flagged missing PR-body test detail.
- This is separate from a generic QA request because the same reconnect lever already has a recent regression receipt in #7785.
- I checked the live PR diff, the linked issue #7765, and the full #7790 source branch before drafting this.
🤖 Prompt for AI agents
Verify this finding against current PR #7800 before editing.
Context:
- Current PR changes libs/wallet/src/wagmi/config.ts only.
- It sets enableReconnect to isSafeApp || isMobile || hasRecentConnector.
- It removes hasRecentConnector from the direct mobile injected connect.
- Prior PR #7785 reported similar broad reconnect behavior broke MetaMask mobile and Safe/widget isolation.
- Full PR #7790 includes additional isolation changes and does not remove the direct mobile recent-connector guard.
Expected fix:
- Keep the change minimal.
- Either pull in the missing Safe/widget isolation pieces from #7790 and keep mobile direct connect guarded, or narrow reconnect back to the proven path.
- Add/record targeted ER-vs-AR for MetaMask mobile and Safe/widget isolation.
Generated using the pr-review skill from the CoW Protocol skills repo.
…m:cowprotocol/cowswap into fix/injected-provider-and-safe-connection
|
@fairlighteth thank you, addressed your remarks |
fairlighteth
left a comment
There was a problem hiding this comment.
⚠️ AI Review (Codex GPT-5, worked 4m): code follow-up addressed, QA still needed
Rechecked
- Author response:
@limitofzerosaid the prior remarks were addressed. - Code path:
libs/wallet/src/wagmi/config.ts:93now disables EIP-6963 in widget mode, andlibs/wallet/src/wagmi/config.ts:125restores thehasRecentConnectorguard around direct mobile injected connect. - Related context: this now matches the wallet-config part of #7790;
wagmiStoragealready has separate swap/widget/Safe keys.
Result: Code-side blocker is fixed. The earlier partial-cherry-pick concern no longer applies to libs/wallet/src/wagmi/config.ts.
Follow-up: [QUESTION] Add the missing wallet/Safe/widget ER-vs-AR before approval
- The manual QA part from the previous review is still not covered in the PR body: the checklist is still unchecked, and the mobile note says MetaMask was not actually covered.
- Please add observed ER-vs-AR for MetaMask mobile first visit/reload/disconnect-reconnect, Safe iframe auto-connect, widget standalone-vs-embedded isolation, and regular desktop regression.
- Automated checks do not replace that matrix here; lint/typecheck/unit tests pass, while Cypress is currently failing on quote/swap e2e paths and does not exercise these wallet contexts.
Review scope and related context
- I am not reopening the previous code blocker: the current diff includes the two missing pieces called out there.
- The #7790 AppKit
@appkit/*storage patch was inapps/widget-configurator; this PR now explicitly defers the configurator dApp-mode issue, so I did not treat that as a blocker for this wallet-config follow-up.
🤖 Prompt for AI agents
Verify PR #7800 against the previous review only.
Prior issue:
- The PR broadened reconnect while missing widget EIP-6963 isolation.
- It had also removed the hasRecentConnector guard from direct mobile injected connect.
Current code to check:
- libs/wallet/src/wagmi/config.ts: enableEIP6963 must be !isWidget.
- direct mobile connectWalletById('injected') must remain guarded by hasRecentConnector.
Do not reopen the code blocker if those remain true. Ask separately for manual ER-vs-AR covering MetaMask mobile, Safe iframe, widget isolation, and desktop regression.
Generated using the pr-review skill from the CoW Protocol skills repo.

Summary
Fixes #7765 (partial — see deferred section).
Fixes three regressions after #7757 landed
enableReconnect: hasRecentConnectoron the AppKit config inlibs/wallet:enableEIP6963: truein widget mode let Reown discoverwindow.ethereumdirectly, bypassing theWidgetEthereumProvideriframe transport. A browser wallet connected in a standalone widget page bled into embedded contexts (e.g. widget-inside-Safe showed MetaMask instead of Safe).cow-widgetconnector never handshaked with the parent dApp on reload.Not fixed here (deferred to a separate PR)
Widget Configurator dApp-mode connect button stays on "Connect Wallet" after a successful connect, refresh fixes it. This regression was introduced by #7604 (Widget Configurator Revamp), lives entirely in
apps/widget-configurator/, and needs local browser debugging (subscription timing on<appkit-button />vsConnectorController.state). Out of scope for this wallet-config change — will be addressed in a dedicated PR against the configurator.To Test