cmux NEXT: Sign In to cmux opens in the default browser unless it is Safari; Accounts shows the cmux account
Leo could not sign in to cmux from cmux NEXT Settings > Accounts (2026-10-19). The Sign In button opened the ASWebAuthenticationSession popup. When the default browser is not Safari (Leo uses Edge), the popup can end as a cancelled login almost at once, and Settings showed nothing: no progress, no error, and no way to retry in the browser. Accounts also had no Sign Out or account switch for cmux itself.
What changes
- Sign-in window. A new Debug Settings tunable, Accounts > Sign-in window (
auth.signInWindow), offers Automatic (the default), Popup and Default browser. Automatic opens the sign-in page in the default browser from the start, unless that browser is Safari, where the popup works.HostBrowserSignInFlow.beginSignIn(selectAccount:inDefaultBrowser:)reuses the existing default-browser handoff and callback states.cancelSignIn()ends an attempt, so a late callback is rejected. A Cancel that arrives after the callback is ignored: the callback's tokens have already replaced the session, so the sign-in finishes. - cmux account row. Settings > Accounts now has a row for the cmux account:
- signed out: Sign In. If the last attempt failed, the row says "Sign-in did not finish. Try again." The reason and its diagnostic detail stay in the log.
- signing in, including a Switch Account while signed in: a pulsing status dot, Open in Browser and Cancel. A note appears once the browser is waiting.
- signed in: the masked email, Switch Account and Sign Out.
Every entry point still goes throughCloudAuth. The old Sign In button in the page header is removed. The row's logic lives in CmuxNextAccounts (CmuxAccountSource, whichCloudAuthconforms to), so CmuxNextApp does not grow.
- 8 new strings, translated into all 21 locales.
Tests
CmuxAuthRuntimeTests/HostBrowserSignInFlowDefaultBrowserTests: a default-browser sign-in opens the URL with no popup session and signs in on the callback; Cancel rejects a late callback; a failed open reportsbrowser_open_failed; a Cancel after the callback lets the sign-in finish. The first commit adds only these tests (red); the second adds the fix.CmuxNextAppTests/AccountsCmuxRowTests: row states, action parsing and dispatch, email masking, the Automatic rule, the tunable's values matchingCloudSignInWindow, andCmuxAccountSourcemapping and gestures with a fake source.webviewsaccounts.test.tsx: the cmux row renders, and its buttons sendcmux.<action>. Gallery variants cover signed in, signed out and signing in.
Not verified
I could not reproduce the failed sign-in on a live build. The debug logs were not saved, and the app now reports signed in. The cause above comes from reading the code and the failure path, not from a captured log. This needs a dogfood run on a nightly with Edge as the default browser.
Related: #21233 adds an active-team switcher to the same Accounts page, so AccountsPageState.swift and AccountsSection.tsx may conflict. #20242 and #20234 change sign-in on the server and in classic cmux, separately from this PR. Another session is working on slow sign-out; this PR does not touch signOut in CloudAuth.
š¤ Generated with Claude Code