Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.3.89-5
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory around #91537
Email or phone of affected tester (no customers): applausetester+ck52826@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Iphone 16/18.7.1
App Component: User Settings
Action Performed:
Precondition: Owner has crated few agents
- Launch Hybrid app & log in with Expensifail account
- Go to Account >> Agents >> Select agent
- Click "Copilot into account"
- Tap back button on Profile page
- User navigate to Home tab >> Tap Account menu
- Tap account icon to open bottom switch account drawer
- Select owner account
- Observe account not switched to owner and still show agent's account
- Tap on the account icon again & observe account get switched to owner account now
- Repeat steps 5-9 switching accounts between agent owner & agent
Expected Result:
User able to switch accounts on selecting accounts from bottom drawer when switching between owner and agents after visiting agent's profile page via Copilot into account option
Actual Result:
Cannot switch accounts on selecting accounts from bottom drawer when switching between owner and agents after visiting agent's profile page via Copilot into account option
User ahs to click top account icon to see the switched account
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome Safari
Screenshots/Videos
Bug7166572_1780077554508.ScreenRecording_05-29-2026_13-37-01_1.mp4
Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7166572
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022061454516701719762
- Upwork Job ID: 2061454516701719762
- Last Price Increase: 2026-06-01
- Automatic offers:
- aimane-chnaif | Contributor | 111637636
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
applause-bot commentedon Jun 1, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/a363f0930dcbc6708ad7ed169b9b3d82243e4f0cb574326c2d5c6da696216ec4
melvin-bot commentedon Jun 1, 2026
@NicolasBonet recently merged #91537, but they are OOO right now, so I'll auto-assign someone else.
melvin-bot commentedon Jun 1, 2026
Triggered auto assignment to @carlosmiceli (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Jun 1, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jun 1, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Jun 1, 2026
Proposal
Problem
After copiloting into an agent via the new Copilot into account button, switching back to the owner from the account-switcher bottom drawer leaves the switcher displaying the agent's name/avatar. The account actually switches — tapping the switcher icon a second time (forcing a re-render) reveals the correct owner account. So this is a stale render of the displayed account, not a failed switch.
Root cause
The name/avatar shown in the switcher come from
useCurrentUserPersonalDetails(). When you tap the owner,disconnect()updatesSESSION, clears Onyx, then asynchronously repopulatesPERSONAL_DETAILS_LISTviaopenApp(). The displayed identity does not reliably re-render when that async data lands — a subsequent unrelated re-render (the second tap) is what flushes it.The strongest code-level suspect is the selector in
CurrentUserPersonalDetailsProvider.tsx:19-28, which mutates the Onyx object in place and returns the same reference — a known pattern that can suppressuseOnyx/context update notifications.Important: PR #91537 only added the profile button — it did not modify the AccountSwitcher, the delegate connect/disconnect logic, or
CurrentUserPersonalDetailsProvider. This is a pre-existing reactivity bug that the new entry point exposes, not a defect in the PR's own code.Recommended changes
Because this is a
DeployBlockerCashon a new feature that isn't in production, the lowest-risk immediate unblock is to revert PR #91537 (removes the new entry point and the regression), then fix the underlying stale-render separately.The candidate code fix for the underlying bug is to stop mutating the selector result and return a fresh object:
This must be verified on iOS HybridApp before merging, since
CurrentUserPersonalDetailsProvideris used app-wide and the nativeHybridAppModule.switchAccountsession-sync timing may also contribute.Investigation details, alternatives considered, and open questions
Flow traced: profile button →
useSwitchToDelegator→connect()/disconnect()inDelegate.ts.disconnect()setsSESSION, thenclearOnyxForDelegateTransition()wipesPERSONAL_DETAILS_LIST, thenopenApp()repopulates it. There's a window where the selector returns an empty-shape object, and the re-render when the owner's details arrive isn't reliably triggered.Alternative considered — "RHP modal not dismissed": the profile button calls
switchToDelegator()without dismissing its host RHP. I ruled this out as the primary cause because the pre-existingCopilotPage,AgentsPage, andEditAgentPageall use the exact same direct-call pattern from within the RHP, so it isn't unique to this PR.Ruled out as irrelevant: the new
openAgentsPage()useEffect(Agent.ts) is just a data read, andcallFunctionIfActionIsAllowedis a pass-through for non-anonymous users.Open questions to confirm on device:
useOnyxuse reference equality on selector output? If so, the in-place mutation at lines 21-24 definitively suppresses the update.CopilotPage? The report only exercised the profile flow.HybridAppModule.switchAccountstep delayPERSONAL_DETAILS_LISTrepopulation on iOS?Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92158)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
mountiny commentedon Jun 1, 2026
@MelvinBot Is this feature behind beta?
MelvinBot commentedon Jun 1, 2026
Yes — the Custom Agents feature is gated behind the
customAgentbeta (CONST/index.ts:972). The Agents menu entry only appears whenisBetaEnabled(CONST.BETAS.CUSTOM_AGENT)is true, and it even renders with abetabadge (InitialSettingsPage.tsx:318-328).AgentsPage.tsx:46gates on the same beta.So this deploy blocker only affects users in the
customAgentbeta in practice.One caveat: the new "Copilot into account" button itself (
ProfilePage.tsx:290-296) is not directly beta-checked. It's gated byisOwnedAgent = !isCurrentUser && isAgentEmail(login) && !!agentPrompt(ProfilePage.tsx:153) — thebetasvalue read on that page is only passed toPromotedActions.message, not used to hide the button. In practice the button is still only reachable for owners who created an agent (which requires the beta), but it relies on that data precondition rather than an explicitcustomAgentbeta check.49 remaining items
melvin-bot commentedon Jun 16, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.8-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-06-23. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 16, 2026
@aimane-chnaif The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
melvin-bot commentedon Jun 19, 2026
@aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Jun 22, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)aimane-chnaif commentedon Jun 23, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: The root cause existed for long time but Add Chat and Copilot buttons to Agents page #91533 just revealed this bug.
[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:
[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/652654
Regression Test Proposal
Precondition:
Owner has crated few agents
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-ca75-a01f-1733-2236079cedc4mallenexpensify commentedon Jun 25, 2026
Payment Summary
Contributor+: @aimane-chnaif due $250 via NewDot
^ Test case created. Thx
@NicolasBonet if there's an offending PR linked in the OP or a post from Melvin (or OSBotify), please assign the C+ from that since they're responsible to fix their mistakes if the bug was reported within a week of their PR hitting production. Thx.
garrettmknight commentedon Jul 19, 2026
$250 apprvoed for @aimane-chnaif