Skip to content

[Due for payment 2026-07-23] Android & iOS - Back button on Profile opens Profile after copilotting into agent #94088

Closed

Description

@applause-bot

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: 9.4.16-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93683
Email or phone of affected tester (no customers): sdjnoisdjdosijsonssjo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 15 Pro Max / iOS 26.5
App Component: User Settings

Action Performed:

Precondition:

  • Create an agent in Account > Agents.
  1. Launch Expensify app.
  2. Go to Account > Agents.
  3. Open any agent.
  4. Click Copilot into account.
  5. Click app back button.

Expected Result:

App back button will return to Account page.

Actual Result:

Back button on Profile opens Profile after copilotting into agent.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7185653_1781885708341.ScreenRecording_06-20-2026_00-13-08_1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Nathan Lemma
Bug ID: 7185653

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 19, 2026
  2. applause-bot commented on Jun 19, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/160685408d00b8dd1adc5bfd03f6c24955916184c3f0d05c4b2722911898ca6c

  3. melvin-bot commented on Jun 19, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #93683

  4. melvin-bot commented on Jun 19, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Jun 19, 2026

    @github-actions
    Contributor

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

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. Dip-G-M commented on Jun 19, 2026

    @Dip-G-M

    hi

  7. melvin-bot commented on Jun 19, 2026

    @melvin-bot

    📣 @Dip-G-M! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  8. MelvinBot commented on Jun 19, 2026

    @MelvinBot
    Contributor

    Proposal

    ⚠️ Regression introduced by #93683 (the PR this deploy blocker was auto-assigned from). Not reproducible in production because the change only exists on staging.

    Please re-state the problem that we are trying to solve in this issue.

    After an owner copilots into one of their agents, the back button on the Profile page re-opens Profile instead of returning to the Account page — the user is trapped in a Profile ⇄ Profile loop.

    What is the root cause of that problem?

    #93683 changed withAgentAccessDenied to redirect agents off guarded screens on every focus via useFocusEffect, calling Navigation.navigate(ROUTES.SETTINGS_PROFILE) — see withAgentAccessDenied.tsx:28-35.

    Navigation.navigate defaults to PUSH, not replace (linkTo/index.ts:181-189). So the redirect pushes a new Profile entry on top of the stale guarded central-pane screen (e.g. SCREENS.SETTINGS.AGENTS.ROOT) that the owner session left mounted in the SettingsSplitNavigator. The Account sidebar (SCREENS.SETTINGS.ROOT) is not guarded, but it sits below that guarded screen in the stack (SettingsSplitNavigator.tsx:16-29).

    The loop:

    1. Copilot in → session email becomes an agent; nav stack is not reset, so the owner's guarded central route stays mounted.
    2. That guarded screen re-focuses → useFocusEffect fires → pushes Profile. Stack is now [Account sidebar] [Agents (guarded)] [Profile].
    3. Back on Profile → pops to the still-guarded Agents screen → its useFocusEffect fires again → pushes Profile again. → loop, never reaching Account.

    What changes do you think we should make in order to solve the problem?

    Targeted fix (lowest risk): Make the redirect replace the guarded screen instead of pushing on top of it, by passing forceReplace at withAgentAccessDenied.tsx:33:

    Navigation.navigate(ROUTES.SETTINGS_PROFILE.getRoute(), {forceReplace: true});

    forceReplace is honored at linkTo/index.ts:173-175. This keeps #93683's blank-pane fix (still redirects on every focus) but consumes the stale guarded route, so back from Profile pops past it to the unguarded Account sidebar. ⚠️ Verify forceReplace propagates correctly through getMinimalAction's nested split-navigator drilldown so the REPLACE lands on the central-pane entry.

    Alternatives considered
    • More robust: reinstate the (reverted) nav-stack reset in Delegate.connect/disconnect (src/libs/actions/Delegate.ts) so the owner's stale guarded routes are cleared at the source on every copilot transition, rather than relying on per-screen redirects. Best outcome is likely both — reset on connect/disconnect + keep the focus guard as a safety net.
    • Not recommended: keep PUSH but suppress the guard's re-fire with a transition flag — this reintroduces the blank-pane bug Redirect agents off guarded routes on every focus #93683 fixed, since the stale guarded screen would render its FullPageNotFoundView on back.
    • Fastest unblock: revert #93683 to clear the deploy blocker, then re-land with one of the fixes above.

    Confidence: High — code evidence fully explains the symptom, the regression is isolated to the one file #93683 changed, and it matches "staging yes / production no."


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94088) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  9. mjasikowski commented on Jun 20, 2026

    @mjasikowski
    Contributor

    @abzokhattab can you address this please?

  10. 17 remaining items

  11. melvin-bot commented on Jul 16, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  12. melvin-bot commented on Jul 16, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.35-6 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-07-23. 🎊

    For reference, here are some details about the assignees on this issue:

    • @abzokhattab requires payment through NewDot Manual Requests
  13. melvin-bot commented on Jul 16, 2026

    @melvin-bot

    @abzokhattab 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]

  14. melvin-bot commented on Jul 20, 2026

    @melvin-bot

    @abzokhattab Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. abzokhattab commented on Jul 23, 2026

    @abzokhattab
    Contributor

    Can we close this issue ,, the regression PR got merged and no payment is needed since it was handled in the main issue

    cc @mjasikowski @mallenexpensify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions