wallet: in debug mode, do not tell the wallet where to send the user back to - #41
Merged
Conversation
…back to The third diagnostic log from the reporter's phone, run with #40's "do not open the wallet" debug mode: 16:21:54 [tab] visible -> connected=true (+609ms) MetaMask approved the pairing, sent the user back 16:21:56 [sign] request on the relay ... NOT opening the wallet 16:22:06 [tab] hidden user switched to MetaMask by hand -- no deep link 16:22:14 [tab] visible -- "it was hung on splash screen" MetaMask was already wedged BEFORE any deep link was sent to it. Twelve seconds after it approved the pairing and returned the user to the browser, it sat on its splash screen for a plain resume from recent apps. So the deep link was never the trigger, and every theory built on it -- URL shape, gesture, warm resume by intent -- is closed. Whatever puts the wallet in that state happens on the way it returns the user; the one thing here that makes it return the user at all is `providerMetadata.redirect` (chains.ts, added in #8 -- before that, MetaMask left the user in the wallet). So with debug mode on, `initAppKit` omits the redirect from the metadata it hands to the wallet. The wallet leaves the user where they are after approving, they switch back to the browser by hand, and when they switch to the wallet again for the signature the log says whether it is still healthy. Decided inside `initAppKit` because there are two call sites (LinkPassword's loader and WalletGate) and the first to run wins; AppKit reads the metadata once, so a change of debug mode needs a page reload. Default behaviour is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BpqXrkEPA9odTyRdK5Mnx
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.
A diagnostic, not a feature. Default behaviour is unchanged.
What the third log showed
Run with #40's debug mode (sign tap publishes the request but does not open the wallet):
MetaMask was already wedged before any deep link was sent to it. Twelve seconds after it approved the pairing and returned the user to the browser, it sat on its splash screen for a plain resume from recent apps. The deep link was never the trigger; every theory built on it — URL shape, gesture, warm resume by intent — is closed.
Whatever puts the wallet in that state happens on the way it returns the user. The one thing here that makes it return the user at all is
providerMetadata.redirect(chains.ts, added in #8 — before that, MetaMask left the user in the wallet).What changes
With debug mode on,
initAppKitomitsredirectfrom the metadata handed to the wallet. The wallet leaves the user where they are after approving; they switch back by hand; and when they switch to the wallet again for the signature, the log says whether it is still healthy. Decided insideinitAppKitbecause there are two call sites (LinkPassword's loader andWalletGate) and the first to run wins. AppKit reads the metadata once, so a change of debug mode needs a page reload — the protocol says so.Also confirmed again by this log: #39's park-on-hidden holds. Three returns from the wallet, all under 400 ms to a live socket.
Testing
npm test --workspacesclean. Newappkit.test.ts: redirect present by default, absent with debug mode active, present again when debug mode has expired.🤖 Generated with Claude Code
https://claude.ai/code/session_013BpqXrkEPA9odTyRdK5Mnx