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-06-18] Agent - Agent deleted offline is still displayed as "Approver" and still selectable. #92262
Version Number: 9.3.90-1 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:#91441 Email or phone of affected tester (no customers):applausetester+ib0005@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome App Component: Workspace Settings
Action Performed:
Prerequisite: User an expensifail account.
Prerequisite 2: Account has a workspace with "Approvals" enabled.
Open the staging.new.expensify.com wesbite.
Navigate to "Account" > "Agents"
Create a new agent.
Navigate to "Workspaces" > "Workflows"
Click on "Add Agent" > "Save"
Note that agent was added as approver.
Turn off internet connection.
Return to "Account" > Agents" and delete the agent.
Return to "Workspaces" > "Workflows"
Note that agent is still displayed as approver.
Tap on approver to open "Edit Approval" RHP.
Click on "Approver" field where agent is an approver two times to reach "Set Approver".
Click on agent to remove it as approver.
Reopen approver field.
Click on agent again.
Note that agent is added as approver again, despite being deleted.
Expected Result:
Deleted agent should automatically disappear as "Approver"
Actual Result:
Agent that was deleted while offline is still displayed as approver and is still selectable.
👋 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.
deleteAgent only writes the deletion state optimistically to the agent's prompt key (sharedNVP_agentPrompt_<accountID> → pendingAction: DELETE). It does not optimistically touch personalDetailsList or the policy employeeList — those removals live in successData, which never runs while offline.
But the Workflows UI reads the agent from employeeList + personalDetails, not from the prompt key. So while offline the agent is still a full member/approver, which produces both symptoms:
Still shown as approver: the workflow card derives approvers by walking the submitsTo / forwardsTo chain in employeeList via calculateApprovers. The agent's employeeList entry is untouched, so it stays in the chain.
Still selectable: the Set Approver list is built from employeeList and only drops entries whose employeeList entry has pendingAction === DELETE. deleteAgent sets that flag on the prompt key instead, so the filter never matches.
This is why it only "fixes itself" once you reconnect — the real removal arrives from the server's DELETE_AGENT response, not from optimistic data.
What changes do you think we should make in order to solve the problem?
Give deleteAgent an optimistic update that mirrors what regular workspace member removal already does, instead of only flagging the prompt key.
Resolve the agent's email from personalDetailsList[accountID].login, then for every policy whose employeeList contains that email, optimistically merge {[agentEmail]: {pendingAction: DELETE}} into employeeList (and reverse it in failureData). This alone fixes the still-selectable symptom and removes the agent from the card's member list (both DELETE filters then match). See the existing template in removeMembers.
To also drop the agent from the displayed approver chain, rewire the affected workflows the same way member removal does — recompute via updateWorkflowDataOnApproverRemoval and write the resulting submitsTo/forwardsTo changes into the optimistic employeeList, so anyone forwarding to the agent falls back to the owner/default approver. Marking the agent pendingAction: DELETE is not enough on its own here, because calculateApprovers walks the chain without skipping pending‑delete entries.
Why marking pending-delete alone won't remove the approver row
calculateApprovers (WorkflowUtils.ts:58-93) follows submitsTo→forwardsTo and pushes any email that still exists in employeeList, regardless of pendingAction. The pendingAction === DELETE filters in convertPolicyEmployeesToApprovalWorkflows (L182-L184) only affect availableMembers and the workflow members list — not the approver chain itself. So the chain must be rewired, not just flagged.
Scope note
deleteAgent(accountID) is invoked globally from Settings > Agents and isn't policy-scoped, while an agent can be an approver in multiple workspaces. The optimistic update therefore needs to scan all loaded policies for the agent's email — the same set the server's DELETE_AGENT updates server-side.
Root cause confidence: High. The exact fix shape is Medium confidence given the multi-policy chain-rewiring involved.
What alternative solutions did you explore? (Optional)
If full offline chain-rewiring is deemed too large for a deploy-blocker turnaround, a narrower stopgap is to disable/greyout the delete action (or the agent's approver row) while offline so the UI never shows a stale-but-selectable agent. This trades offline-first behavior for correctness and should be confirmed with the feature owner.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92262) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.
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/26c4244c876e5691a60ff123e59691806053694692bdebe53b72b6452f5c5fa0
melvin-bot commentedon Jun 1, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #91441
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
What is the root cause of that problem?
deleteAgentonly writes the deletion state optimistically to the agent's prompt key (sharedNVP_agentPrompt_<accountID>→pendingAction: DELETE). It does not optimistically touchpersonalDetailsListor the policyemployeeList— those removals live insuccessData, which never runs while offline.But the Workflows UI reads the agent from
employeeList+personalDetails, not from the prompt key. So while offline the agent is still a full member/approver, which produces both symptoms:submitsTo/forwardsTochain inemployeeListviacalculateApprovers. The agent'semployeeListentry is untouched, so it stays in the chain.employeeListand only drops entries whoseemployeeListentry haspendingAction === DELETE.deleteAgentsets that flag on the prompt key instead, so the filter never matches.This is why it only "fixes itself" once you reconnect — the real removal arrives from the server's
DELETE_AGENTresponse, not from optimistic data.What changes do you think we should make in order to solve the problem?
Give
deleteAgentan optimistic update that mirrors what regular workspace member removal already does, instead of only flagging the prompt key.personalDetailsList[accountID].login, then for every policy whoseemployeeListcontains that email, optimistically merge{[agentEmail]: {pendingAction: DELETE}}intoemployeeList(and reverse it infailureData). This alone fixes the still-selectable symptom and removes the agent from the card's member list (both DELETE filters then match). See the existing template inremoveMembers.updateWorkflowDataOnApproverRemovaland write the resultingsubmitsTo/forwardsTochanges into the optimisticemployeeList, so anyone forwarding to the agent falls back to the owner/default approver. Marking the agentpendingAction: DELETEis not enough on its own here, becausecalculateApproverswalks the chain without skipping pending‑delete entries.Why marking pending-delete alone won't remove the approver row
calculateApprovers(WorkflowUtils.ts:58-93) followssubmitsTo→forwardsToand pushes any email that still exists inemployeeList, regardless ofpendingAction. ThependingAction === DELETEfilters inconvertPolicyEmployeesToApprovalWorkflows(L182-L184) only affectavailableMembersand the workflowmemberslist — not the approver chain itself. So the chain must be rewired, not just flagged.Scope note
deleteAgent(accountID)is invoked globally from Settings > Agents and isn't policy-scoped, while an agent can be an approver in multiple workspaces. The optimistic update therefore needs to scan all loaded policies for the agent's email — the same set the server'sDELETE_AGENTupdates server-side.Root cause confidence: High. The exact fix shape is Medium confidence given the multi-policy chain-rewiring involved.
What alternative solutions did you explore? (Optional)
If full offline chain-rewiring is deemed too large for a deploy-blocker turnaround, a narrower stopgap is to disable/greyout the delete action (or the agent's approver row) while offline so the UI never shows a stale-but-selectable agent. This trades offline-first behavior for correctness and should be confirmed with the feature owner.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92262)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
lakchote commentedon Jun 1, 2026
Behind beta, demoting.
21 remaining items
melvin-bot commentedon Jun 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mkhutornyi commentedon Jun 15, 2026
The linked blocker is not a regression as per #93260 (comment).
melvin-bot commentedon Jun 15, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jun 17, 2026
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.
melvin-bot commentedon Jun 17, 2026
@mallenexpensify Huh... This is 4 days overdue. Who can take care of this?
mallenexpensify commentedon Jun 19, 2026
Payment Summary
Contributor+: @mkhutornyi due $250 via NewDot
Checking on updating test cases when feature is removed, will reopen, if needed.
trjExpensify commentedon Jun 23, 2026
approved $250 for @mkhutornyi