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-16] [$250] Agent - Agent is removed as approver when saving field again. #92261
Version Number: 9.3.90-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:#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: Use an expensifail account.
Prerequisite 2: Account has a workspace with approvals enabled.
Prerequisite 3: Account doesn´t have an agent created yet.
Open the staging.new.expensify.com website.
Navigate to "Workspaces" and open workspace menu.
Navigate to "Workflows"
On "Approvals" click on "Add Agent" > "Create Agent"
Note that when RHP opens, agent is displayed as "Approver"
Open the field where agent is an approver.
Without making any edition, click on "Save"
Note that agent is removed as approver, despite field being saved without edition.
Expected Result:
No change should be displayed on "Approver" field after being saved without any edition.
Actual Result:
Agent is removed as approver after saving "Approver" field again without making editions.
👋 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.
Confidence: Medium-High. Root cause is verified by code tracing + elimination. I couldn't watch the Applause repro video, so the exact gesture is inferred (see "How I confirmed it" below).
What is the root cause of that problem?
The Approver field is a single-select list, and tapping the row that is already selected is treated as a deselect — which the page interprets as "remove the approver" and wipes it.
When you create an agent it lands on the approver field pre-selected as approver 0. Opening that field and tapping the agent again (to "save it") hits this path:
ApproverSelectionList.toggleApprover — for single-select, isAlreadySelected is true, so newSelectedApprovers = [] and it fires onSelectApprover([]).
clearApprovalWorkflowApprover sets approvers[0] = undefined, then lodashDropRightWhile collapses it to [] — the agent is gone.
This deselect-on-re-tap logic pre-datesPR #91441 (that PR didn't touch ApproverSelectionList.tsx or the approver page). The agent flow is what exposes it: the agent arrives pre-selected, so the admin's natural "confirm/save" tap lands on the already-selected row and silently clears it. For a normal human approver you set the value by tapping (which routes you forward to the approval-limit page), so you rarely sit on a pre-selected row to re-tap.
How I confirmed it (and why it isn't the Save button on the edit page)
If the agent is still pending (CREATE_AGENT in flight) → it takes the queueDeferredAgentWorkflowSave branch and just defers; the agent is not removed.
If the agent is resolved → approvalWorkflow.approvers still contains the agent and approversToRemove only targets the previous approver; the agent is persisted, not removed.
So a plain Save without touching the list cannot drop the agent. The only code path in this flow that removes it is the deselect-on-re-tap above — which matches the issue title "removed as approver when saving field again".
What changes do you think we should make in order to solve the problem?
In single-select mode, tapping the already-selected approver should be a no-op / confirm-and-go-back rather than a deselect that empties the field. Concretely, in ApproverSelectionList.toggleApprover, when !allowMultipleSelection && isAlreadySelected, don't emit an empty selection (so clearApprovalWorkflowApprover never runs for a re-tap).
Scope it carefully so legitimate removal of a specific approver step in multi-step Control workflows still works (deselecting a slot is intended there). The safe target is the single-approver field where emptying the sole/first approver is never a valid outcome — e.g. guard the re-tap in single-select only, or guard the isRemovingApprover branch in the page so it doesn't clear the first/only approver.
What alternative solutions did you explore? (Optional)
A separate, related risk (not the trigger for this repro): the edit page rebuilds the workflow only from convertPolicyEmployeesToApprovalWorkflows (policy.employeeList) and never hydrates from DEFERRED_AGENT_WORKFLOW_SAVES. If an admin dismisses and re-opens the edit page while the agent is still only in deferred state, a save there could persist an agent-less workflow. Worth a follow-up, but it requires re-opening the modal, which this continuous-session repro doesn't do.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92261) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-][$250] Agent - Agent is removed as approver when saving field again.[/-][+][Due for payment 2026-06-16] [$250] Agent - Agent is removed as approver when saving field again.[/+]on Jun 9, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.0-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@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]
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/03a5d26f1b190a343c4d98d037d406d6ac6e8ff7a780c06adc111bef152628f0
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?
The Approver field is a single-select list, and tapping the row that is already selected is treated as a deselect — which the page interprets as "remove the approver" and wipes it.
When you create an agent it lands on the approver field pre-selected as approver
0. Opening that field and tapping the agent again (to "save it") hits this path:ApproverSelectionList.toggleApprover— for single-select,isAlreadySelectedistrue, sonewSelectedApprovers = []and it firesonSelectApprover([]).WorkspaceWorkflowsApprovalsApproverPage.toggleApprover—approvers.length === 0⇒isRemovingApprover, so it callsclearApprovalWorkflowApproverand navigates back.clearApprovalWorkflowApproversetsapprovers[0] = undefined, thenlodashDropRightWhilecollapses it to[]— the agent is gone.This deselect-on-re-tap logic pre-dates PR #91441 (that PR didn't touch
ApproverSelectionList.tsxor the approver page). The agent flow is what exposes it: the agent arrives pre-selected, so the admin's natural "confirm/save" tap lands on the already-selected row and silently clears it. For a normal human approver you set the value by tapping (which routes you forward to the approval-limit page), so you rarely sit on a pre-selected row to re-tap.How I confirmed it (and why it isn't the Save button on the edit page)
I traced the edit-page Save handler (
WorkspaceWorkflowsApprovalsEditPage.updateApprovalWorkflowCallback). With no edit:queueDeferredAgentWorkflowSavebranch and just defers; the agent is not removed.approvalWorkflow.approversstill contains the agent andapproversToRemoveonly targets the previous approver; the agent is persisted, not removed.So a plain Save without touching the list cannot drop the agent. The only code path in this flow that removes it is the deselect-on-re-tap above — which matches the issue title "removed as approver when saving field again".
What changes do you think we should make in order to solve the problem?
In single-select mode, tapping the already-selected approver should be a no-op / confirm-and-go-back rather than a deselect that empties the field. Concretely, in
ApproverSelectionList.toggleApprover, when!allowMultipleSelection && isAlreadySelected, don't emit an empty selection (soclearApprovalWorkflowApprovernever runs for a re-tap).Scope it carefully so legitimate removal of a specific approver step in multi-step Control workflows still works (deselecting a slot is intended there). The safe target is the single-approver field where emptying the sole/first approver is never a valid outcome — e.g. guard the re-tap in single-select only, or guard the
isRemovingApproverbranch in the page so it doesn't clear the first/only approver.What alternative solutions did you explore? (Optional)
A separate, related risk (not the trigger for this repro): the edit page rebuilds the workflow only from
convertPolicyEmployeesToApprovalWorkflows(policy.employeeList) and never hydrates fromDEFERRED_AGENT_WORKFLOW_SAVES. If an admin dismisses and re-opens the edit page while the agent is still only in deferred state, a save there could persist an agent-less workflow. Worth a follow-up, but it requires re-opening the modal, which this continuous-session repro doesn't do.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92261)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.
35 remaining items
[-][$250] Agent - Agent is removed as approver when saving field again.[/-][+][Due for payment 2026-06-16] [$250] Agent - Agent is removed as approver when saving field again.[/+]melvin-bot commentedon Jun 9, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.0-7 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-16. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 9, 2026
@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]
melvin-bot commentedon Jun 12, 2026
@abzokhattab Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jun 15, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 15, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 17, 2026
No payment is due here cuz it was fixed via this PR which will be paid in this issue, correct @abzokhattab ?
abzokhattab commentedon Jun 17, 2026
@mallenexpensify correct .. we can close it