You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-04-17] [$250] Copilot - Account switcher shows @expensify.sms when account is phone number #86308
Version Number: 9.3.42-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: EDGE cases retest Email or phone of affected tester (no customers): undefined Issue reported by: Applause Internal Team Device used: Windows Windows 11 - Chrome
Action Performed:
Preconditions:
The user has assigned a Copilot account with a phone number via OD (Settings > Account > Profile)
The phone number account must have 'Display name' field empty (erase the name from OD if necessary).
Please re-state the problem that we are trying to solve in this issue.
When a Copilot account is registered with a phone number and has no display name set, the account switcher popover shows @expensify.sms (e.g., +15857527441@expensify.sms) instead of just the formatted phone number.
When a user hasn't set a custom display name, the backend sets displayName equal to the full login (e.g., +15857527441@expensify.sms). This raw value is used directly as the menu item title with no SMS domain stripping or phone number formatting.
In contrast, the current user's display name in the same component (line 263) correctly uses formatPhoneNumber(displayName), and PersonalDetailsUtils.ts:75-80 has explicit handling for this case:
// If the displayName is not set by the user, the backend sets the displayName same as the login so// we need to remove the sms domain from the displayName if it is an sms login.if(Str.isSMSLogin(login)){if(displayName===login){displayName=Str.removeSMSDomain(displayName);}
What changes do you think we should make in order to solve the problem?
In createBaseMenuItem at src/components/AccountSwitcher.tsx:140, wrap the text value with formatPhoneNumber() (already available in the component via useLocalize() at line 49):
formatPhoneNumber (from LocalePhoneNumber.ts) handles both stripping the @expensify.sms suffix and formatting the number for the user's locale. It also safely passes through non-phone strings unchanged, so it won't affect email-based accounts.
Additionally, the description field on line 141 should also use formatPhoneNumber instead of just Str.removeSMSDomain to show a nicely formatted phone number rather than a raw E.164 number:
What alternative solutions did you explore? (Optional)
An alternative would be to use getDisplayNameOrDefault() from PersonalDetailsUtils.ts which already handles the displayName === login case for SMS logins. However, formatPhoneNumber() is simpler, already available in the component, and provides the additional benefit of locale-aware phone number formatting (e.g., (555) 123-4567 instead of +15551234567).
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Copilot - Account switcher shows @expensify.sms when account is phone number[/-][+][$250] Copilot - Account switcher shows @expensify.sms when account is phone number[/+]on Mar 25, 2026
Please re-state the problem that we are trying to solve in this issue.
Copilot - Account switcher shows @expensify.sms when account is phone number
What is the root cause of that problem?
Popover rows built in createBaseMenuItem set the primary label from displayName or login as-is, so an SMS login still includes @expensify.sms. The secondary line already strips the domain with Str.removeSMSDomain on login, so the title and description are inconsistent and the title can show the domain.
Note: By “consistency,” I mean making both the primary and secondary labels use the raw E.164 number, just like we did in WorkspaceMembersSelectionList
What alternative solutions did you explore? (Optional)
Alternatively, we can use formatPhoneNumber for the primary label to match the display name, but we shouldn’t update the description to use formatPhoneNumber as well, as Melvin suggests. We can keep using Str.removeSMSDomain for the description
Please re-state the problem that we are trying to solve in this issue.
When a Copilot delegator account is registered with a phone number and has no display name set, the account switcher popover shows the raw login string (e.g. +15857527441@expensify.sms) instead of a formatted phone number.
What is the root cause of that problem?
In AccountSwitcher.tsx, the createBaseMenuItem helper builds the menu item for each account in the switcher popover. The text field (the primary label shown in the menu row) is set as:
The ?? operator only coalesces on null or undefined — not on empty string. When the account has no display name, personalDetails.displayName is '' (empty string), so ?? does not fall through to login; the text renders as an empty string. However, when displayName is undefined, it falls through to personalDetails?.login, which is the raw login value including the @expensify.sms suffix (e.g. +15857527441@expensify.sms). Neither branch applies Str.removeSMSDomain or formatPhoneNumber, so the SMS domain leaks into the UI.
The description field on the very next line correctly strips the domain via Str.removeSMSDomain(personalDetails?.login ?? ''), but the text field has no such treatment.
What changes do you think we should make in order to solve the problem?
The text field in createBaseMenuItem should fall back to the formatted phone number (via formatPhoneNumber, which already strips the SMS domain and formats the number) when displayName is absent or empty, mirroring how other parts of the app (e.g. createDisplayName in PersonalDetailsUtils.ts) handle this case. Using || instead of ?? covers the empty-string case, and wrapping the login fallback in formatPhoneNumber ensures the SMS domain is never shown.
Switching ?? to || ensures an empty displayName string falls through to the login fallback. Wrapping the login with formatPhoneNumber strips @expensify.sms and formats the number into a human-readable string (e.g. +1 585-752-7441), consistent with how the subtitle line and the current-user display already handle phone logins.
What alternative solutions did you explore? (Optional)
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
MelvinBot commentedon Mar 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a Copilot account is registered with a phone number and has no display name set, the account switcher popover shows
@expensify.sms(e.g.,+15857527441@expensify.sms) instead of just the formatted phone number.What is the root cause of that problem?
The root cause is in
src/components/AccountSwitcher.tsx:140in thecreateBaseMenuItemfunction:When a user hasn't set a custom display name, the backend sets
displayNameequal to the full login (e.g.,+15857527441@expensify.sms). This raw value is used directly as the menu item title with no SMS domain stripping or phone number formatting.In contrast, the current user's display name in the same component (line 263) correctly uses
formatPhoneNumber(displayName), andPersonalDetailsUtils.ts:75-80has explicit handling for this case:What changes do you think we should make in order to solve the problem?
In
createBaseMenuItematsrc/components/AccountSwitcher.tsx:140, wrap thetextvalue withformatPhoneNumber()(already available in the component viauseLocalize()at line 49):formatPhoneNumber(fromLocalePhoneNumber.ts) handles both stripping the@expensify.smssuffix and formatting the number for the user's locale. It also safely passes through non-phone strings unchanged, so it won't affect email-based accounts.Additionally, the
descriptionfield on line 141 should also useformatPhoneNumberinstead of justStr.removeSMSDomainto show a nicely formatted phone number rather than a raw E.164 number:What alternative solutions did you explore? (Optional)
An alternative would be to use
getDisplayNameOrDefault()fromPersonalDetailsUtils.tswhich already handles thedisplayName === logincase for SMS logins. However,formatPhoneNumber()is simpler, already available in the component, and provides the additional benefit of locale-aware phone number formatting (e.g.,(555) 123-4567instead of+15551234567).Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 25, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)melvin-bot commentedon Mar 25, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022036731881981651146
[-]Copilot - Account switcher shows @expensify.sms when account is phone number[/-][+][$250] Copilot - Account switcher shows @expensify.sms when account is phone number[/+]ryntgh commentedon Mar 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copilot - Account switcher shows @expensify.sms when account is phone number
What is the root cause of that problem?
Popover rows built in
createBaseMenuItemset the primary label fromdisplayNameorloginas-is, so an SMS login still includes@expensify.sms. The secondary line already strips the domain withStr.removeSMSDomainonlogin, so the title and description are inconsistent and the title can show the domain.App/src/components/AccountSwitcher.tsx
Line 109 in 36016bf
What changes do you think we should make in order to solve the problem?
Use
Str.removeSMSDomaininstead offormatPhoneNumberfor consistency.App/src/components/AccountSwitcher.tsx
Line 109 in 36016bf
Note: By “consistency,” I mean making both the primary and secondary labels use the raw E.164 number, just like we did in
WorkspaceMembersSelectionListWhat alternative solutions did you explore? (Optional)
Alternatively, we can use
formatPhoneNumberfor the primary label to match the display name, but we shouldn’t update thedescriptionto useformatPhoneNumberas well, as Melvin suggests. We can keep usingStr.removeSMSDomainfor thedescriptionMobileMage commentedon Mar 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a Copilot delegator account is registered with a phone number and has no display name set, the account switcher popover shows the raw login string (e.g.
+15857527441@expensify.sms) instead of a formatted phone number.What is the root cause of that problem?
In
AccountSwitcher.tsx, thecreateBaseMenuItemhelper builds the menu item for each account in the switcher popover. Thetextfield (the primary label shown in the menu row) is set as:The
??operator only coalesces onnullorundefined— not on empty string. When the account has no display name,personalDetails.displayNameis''(empty string), so??does not fall through tologin; the text renders as an empty string. However, whendisplayNameisundefined, it falls through topersonalDetails?.login, which is the raw login value including the@expensify.smssuffix (e.g.+15857527441@expensify.sms). Neither branch appliesStr.removeSMSDomainorformatPhoneNumber, so the SMS domain leaks into the UI.The
descriptionfield on the very next line correctly strips the domain viaStr.removeSMSDomain(personalDetails?.login ?? ''), but thetextfield has no such treatment.App/src/components/AccountSwitcher.tsx
Lines 139 to 142 in 89e699f
What changes do you think we should make in order to solve the problem?
The
textfield increateBaseMenuItemshould fall back to the formatted phone number (viaformatPhoneNumber, which already strips the SMS domain and formats the number) whendisplayNameis absent or empty, mirroring how other parts of the app (e.g.createDisplayNameinPersonalDetailsUtils.ts) handle this case. Using||instead of??covers the empty-string case, and wrapping the login fallback informatPhoneNumberensures the SMS domain is never shown.App/src/components/AccountSwitcher.tsx
Lines 139 to 142 in 89e699f
const createBaseMenuItem = ( personalDetails: PersonalDetails | undefined, errors?: Errors, additionalProps: Partial<Omit<PopoverMenuItem, 'icon' | 'iconType'>> = {}, ): PopoverMenuItem => { const error = Object.values(errors ?? {}).at(0) ?? ''; return { - text: personalDetails?.displayName ?? personalDetails?.login ?? '', + text: personalDetails?.displayName || formatPhoneNumber(personalDetails?.login ?? ''), description: Str.removeSMSDomain(personalDetails?.login ?? ''),Switching
??to||ensures an emptydisplayNamestring falls through to the login fallback. Wrapping the login withformatPhoneNumberstrips@expensify.smsand formats the number into a human-readable string (e.g.+1 585-752-7441), consistent with how the subtitle line and the current-user display already handle phone logins.What alternative solutions did you explore? (Optional)
N/A
arlo-owls commentedon Mar 25, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
arlo-owls commentedon Mar 25, 2026
Contributor details
Your Expensify account email: arlo.ai.agent@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0110238ea7fec0963b
melvin-bot commentedon Mar 25, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
25 remaining items
melvin-bot commentedon Apr 10, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Apr 17, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Apr 18, 2026
Payment Summary
Contributor+: @eh2077 due $250 via NewDot
@eh2077 plz complete the BZ checklist and tag me in a post once you have. Thx
eh2077 commentedon Apr 20, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Delegate access: Add account switcher #47338
Link to the comment on the Issue: https://github.com/Expensify/App/pull/47338/changes#r3110779562
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/626351
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-9311-a60c-7042-ca3a56014084eh2077 commentedon Apr 20, 2026
@mallenexpensify Checklist done, thanks!
laurenreidexpensify commentedon Apr 27, 2026
$250 approved for @eh2077