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-23] [$250] iOS - Copilot - App returns to login page after removing copilot #84186
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
👋 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:
Identify the pull request that introduced this issue and revert it.
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:
However, removeDelegate() (in src/libs/actions/Delegate.ts) only updates the delegates list in Onyx state. It does NOT trigger the disconnect flow that:
Calls the backend API to disconnect as delegate
Restores the stashed credentials and session
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:
Import disconnect from @libs/actions/Delegate
Add useOnyx hooks for ONYXKEYS.STASHED_CREDENTIALS and ONYXKEYS.STASHED_SESSION
Replace the removeDelegate() call with a conditional that calls disconnect() when removing self
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
@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
Activity
melvin-bot commentedon Mar 4, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #83237
melvin-bot commentedon Mar 4, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Mar 4, 2026
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.github-actions commentedon Mar 4, 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 Mar 4, 2026
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
OSBotify commentedon Mar 4, 2026
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 ofremoveDelegate().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.tsxat line 387, when a copilot removes themselves, the code calls:However,
removeDelegate()(insrc/libs/actions/Delegate.ts) only updates the delegates list in Onyx state. It does NOT trigger the disconnect flow that: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 logicsrc/libs/actions/Delegate.ts- Contains bothremoveDelegate()anddisconnect()functionsConfirmed 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 calldisconnect({stashedCredentials, stashedSession})instead ofremoveDelegate().The disconnect pattern is already used in:
src/components/AccountSwitcher.tsx(line 149)src/DelegateAccessHandler.tsx(line 38)The fix requires:
disconnectfrom@libs/actions/DelegateuseOnyxhooks forONYXKEYS.STASHED_CREDENTIALSandONYXKEYS.STASHED_SESSIONremoveDelegate()call with a conditional that callsdisconnect()when removing self61 remaining items
melvin-bot commentedon Apr 22, 2026
Current assignee @mallenexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.
melvin-bot commentedon Apr 23, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Apr 24, 2026
@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
TaduJR commentedon Apr 24, 2026
Offer Accepted @mallenexpensify
Thanks!
suneox commentedon Apr 24, 2026
@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.
mallenexpensify commentedon Apr 24, 2026
@TaduJR paid, summary updated above. Thx.
garrettmknight commentedon Apr 27, 2026
$250 approved for @suneox