Skip to content

[Due for payment 2026-04-23] [$250] iOS - Copilot - App returns to login page after removing copilot #84186

Closed

Description

@jponikarchuk

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.3.31-0
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: #83237
Email or phone of affected tester (no customers): applausetester+khcategory20@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 15 Pro Max / iOS 26.2
App Component: User Settings

Action Performed:

Precondition:

  • User has access (copilot) to other account.
  1. Launch Expensify app.
  2. Go to Account.
  3. Open account switcher.
  4. Select another account.
  5. Go to Account > Security.
  6. Tap on the main account.
  7. Tap Remove copilot > Remove copilot.

Expected Result:

User will return to the main account.

Actual Result:

App returns to login page after removing copilot.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022031282419101737224
  • Upwork Job ID: 2031282419101737224
  • Last Price Increase: 2026-03-24

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Mar 4, 2026

    @melvin-bot

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

  4. melvin-bot commented on Mar 4, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. github-actions commented on Mar 4, 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. MelvinBot commented on Mar 4, 2026

    @MelvinBot
    Contributor

    I have failed to help you. I let you down and for that I am sorry. Please try again later. This may be due to a Claude outage (check here).

    Failure details: https://github.com/Expensify/Expensify/actions/runs/22689224775

  7. OSBotify commented on Mar 4, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #83237 - "Fix:Copilot/align security features access with od" by @ChavdaSachin (High confidence)
    Related Issues: Original issue fixed by this PR: #78105

    Recommendation: ROLL FORWARD

    A revert would reintroduce the original bug (#78105) where full copilots could not remove themselves at all. The fix is straightforward - when a copilot removes themselves, the code should call disconnect() instead of removeDelegate().

    Labels: No label changes needed. This is a frontend bug that only affects the App on staging, so DeployBlockerCash should remain.

    Detailed Analysis

    Evidence

    PR #83237 was designed to allow full copilots to remove themselves (fixing issue #78105). However, the implementation is incomplete and causes the app to return to the login page instead of switching back to the original account.

    Root Cause

    In src/pages/settings/Security/SecuritySettingsPage.tsx at line 387, when a copilot removes themselves, the code calls:

    removeDelegate({email: selectedDelegate?.email ?? , delegatedAccess: account?.delegatedAccess});

    However, removeDelegate() (in src/libs/actions/Delegate.ts) only updates the delegates list in Onyx state. It does NOT trigger the disconnect flow that:

    1. Calls the backend API to disconnect as delegate
    2. Restores the stashed credentials and session
    3. Switches the user back to their original account

    When the delegate is removed from the list while still logged in as that delegate, the authentication system detects the auth token is no longer valid, causing a logout to the login page.

    Verification

    Files affected by the bug:

    • src/pages/settings/Security/SecuritySettingsPage.tsx - Contains the remove copilot logic
    • src/libs/actions/Delegate.ts - Contains both removeDelegate() and disconnect() functions

    Confirmed the PR modifies SecuritySettingsPage.tsx and adds the ability for a copilot to remove themselves.

    Proposed Fix

    In SecuritySettingsPage.tsx line 387, the code should check if the delegate being removed is the currently logged-in delegate (account?.delegatedAccess?.delegate). If so, it should call disconnect({stashedCredentials, stashedSession}) instead of removeDelegate().

    The disconnect pattern is already used in:

    • src/components/AccountSwitcher.tsx (line 149)
    • src/DelegateAccessHandler.tsx (line 38)

    The fix requires:

    1. Import disconnect from @libs/actions/Delegate
    2. Add useOnyx hooks for ONYXKEYS.STASHED_CREDENTIALS and ONYXKEYS.STASHED_SESSION
    3. Replace the removeDelegate() call with a conditional that calls disconnect() when removing self
  8. 61 remaining items

  9. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Apr 17, 2026
  10. melvin-bot commented on Apr 22, 2026

    @melvin-bot

    Current assignee @mallenexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.

  11. melvin-bot commented on Apr 23, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    • Reviewer: @suneox owed $250 via NewDot
    • ROLE: @TaduJR paid $(AMOUNT) via Upwork (LINK)

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • 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/2031282419101737224/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
  12. mallenexpensify commented on Apr 24, 2026

    @mallenexpensify
    Contributor

    If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83237

    @suneox this came from a PR so, by default, it'd be considered a regression. Please comment in the future if the penalty should/shouldn't be applied. From what I read it looks like this is an extension/follow up vs a bug that should have been fixed initially. @mollfpr, comment if ya disagree.

    Payment Summary

    Contributor: @TaduJR paid $250 via Upwork
    Contributor+: @suneox due $250 via NewDot

    @TaduJR can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022031282419101737224

    ^ Test case created

  13. TaduJR commented on Apr 24, 2026

    @TaduJR
    Contributor

    Offer Accepted @mallenexpensify

    Thanks!

  14. suneox commented on Apr 24, 2026

    @suneox
    Contributor

    @suneox this came from a PR so, by default, it'd be considered a regression. Please comment in the future if the penalty should/shouldn't be applied.

    @mallenexpensify I also mentioned the related PR in the checklist, but I don’t think we should apply the penalty in this case. The new behavior appeared after making things consistent, but it was outside the initial scope of the OP. We also need a new solution for this one.

    this is a pre-existing architectural issue that also exists in Old Dot. PR #83237 only aligned NewDot behavior with Old Dot behavior

  15. mallenexpensify commented on Apr 24, 2026

    @mallenexpensify
    Contributor

    @TaduJR paid, summary updated above. Thx.

  16. garrettmknight commented on Apr 27, 2026

    @garrettmknight
    Contributor

    $250 approved for @suneox

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.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions