Skip to content

wallet: in debug mode, do not tell the wallet where to send the user back to - #41

Merged
ehsan6sha merged 1 commit into
mainfrom
wallet/debug-no-redirect
Sep 5, 2026
Merged

wallet: in debug mode, do not tell the wallet where to send the user back to#41
ehsan6sha merged 1 commit into
mainfrom
wallet/debug-no-redirect

Conversation

@ehsan6sha

Copy link
Copy Markdown
Member

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):

16:21:54  [tab] visible → connected=true (+609ms)   ← MetaMask approved the pairing and 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. 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, initAppKit omits redirect from 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 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 — 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 --workspaces clean. New appkit.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

…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
@ehsan6sha
ehsan6sha merged commit 7f4e3c7 into main Sep 5, 2026
2 checks passed
@ehsan6sha
ehsan6sha deleted the wallet/debug-no-redirect branch September 5, 2026 16:34
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.

1 participant