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
Workspace - Approval workflow appears to save in New Expensify, then disappears without persisting to the backend. #99208
Version Number: Reproducible in staging?: Needs Reproduction (Unable to check with account customer's) Reproducible in production?: Needs Reproduction (Unable to check with account customer's) If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@Leeckhart Slack conversation (hyperlinked to channel name): #expensify_bugs
Action Performed:
Open Workspace X in New Expensify.
Go to Workflows.
Edit/create an approval workflow.
Add Employee 1 as the employee whose expenses should follow the workflow.
Configure:
First approver: Employee 2
Second approver: Employee 3
Click Save
The workflow appears to save successfully in the UI.
Navigate away / return to the workflow page.
The saved employee/workflow configuration has disappeared.
Expected Result:
The workflow should persist after clicking Save, and the configured employee/approvers should remain assigned after navigating away, refreshing, or reopening the workflow.
Actual Result:
The workflow appears to save successfully in the UI, but the changes later disappear.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
An approval workflow (Workspace → Workflows → approvals) appears to save in the UI, but the configured member/approvers disappear after navigating away, refreshing, or reopening the Workflows page.
What is the root cause of that problem?
I could not reproduce a plain single-approver save (it persisted correctly across navigation in a fresh Collect workspace on web), so this is most likely an edge case tied to how the approver's email resolves, not a blanket save failure.
The Workflows list is not read from a stored "workflows" object — it is re-derived from policy.employeeList every time the page renders, via convertPolicyEmployeesToApprovalWorkflows. That function silently drops any member whose submitsTo (the approver email) is not an exact key in employeeList:
So even when the save persists on the backend, the workflow vanishes on the list if the stored approver email doesn't exactly match an employeeList key — e.g. a phone-number approver (e164@expensify.sms vs a raw phone string), a casing difference, or a freshly-invited approver not yet in the list. This exact failure mode is documented in the code:
Other mechanisms considered (and why they're less likely)
Silent early-return with no API call — Workflow.ts:51-53 returns before API.write if the computed employee delta is empty, and the Save handler dismisses the modal regardless (WorkspaceWorkflowsApprovalsCreatePage.tsx:56-69). Possible, but for a genuinely new distinct-approver config the delta is non-empty, so the write does fire.
failureData revert on API error — Workflow.ts:71-80 rolls employeeList back if CreateWorkspaceApproval/UpdateWorkspaceApproval returns an error — would also look like "saved then disappeared." Needs logs to confirm.
Backend delta persistence — only the changed employees are sent (employees: JSON.stringify(Object.values(updatedEmployees))). If the backend CreateWorkspaceApproval/UpdateWorkspaceApproval (Web-Expensify) doesn't fully persist a delta-only payload, the read-back would drop it. This would be a backend fix, outside the App repo.
Confidence: medium. Code evidence points to the read-back drop as the leading cause, but it wasn't reproduced in the basic case and there is no production confirmation yet. This customer report is still Needs Reproduction — knowing whether the approvers were phone-number logins or freshly-invited members would confirm or rule out the top hypothesis.
What changes do you think we should make in order to solve the problem?
Make the read-back resilient: in convertPolicyEmployeesToApprovalWorkflows, canonicalize submitsTo/forwardsTo (apply addSMSDomainIfPhoneNumber + normalize casing) before the employees[submitsTo] lookup so a phone/casing mismatch no longer drops the whole workflow, and don't silently continue — surface it instead of hiding it.
Guarantee the approver email is stored in canonical form on save (the ApproverPage already does this at line 186; verify the same canonicalization is applied on the member/create paths).
If reproduction confirms the write itself is failing or reverting (mechanisms 2/3 above), the fix would instead be on the backend CreateWorkspaceApproval/UpdateWorkspaceApproval persistence, which is outside the App repo and should be escalated to an internal engineer with Web-Expensify access.
What alternative solutions did you explore?
Confirming via production logs which submitsTo/forwardsTo emails were stored for the affected policy vs the employeeList keys returned on the next OpenApp/ReconnectApp, and the jsonCode of the save command, would disambiguate the App-side read-back drop from a backend persistence/revert. That requires the affected customer's policyID.
Reproduction attempt (web) — basic case persisted
Setting a first approver on a workflow and saving persisted correctly across navigating to Home and back, and across switching tabs. Multi/additional approvers are gated behind the Control plan upgrade and couldn't be exercised on the Collect-plan test workspace, so the phone/edge-case path was not tested.
Workflows page immediately after saving the approver change
Workflows page after navigating to Home and back
Workflows page after navigating to Members tab and back
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99208) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
While offline, removing the current approver (Employee 1) from members — which auto-reassigns the default approver to Admin — and then editing the workflow's approver to Employee 2 produces a phantom duplicate workflow ("Approver: admin, Expenses from: nothing") next to the correct one. It disappears on reconnect. Confirmed reproduced (see below).
What is the root cause of that problem?
The optimistic member-removal path updates policy.approver but does not reassign the submitters who pointed at the removed member, leaving the workflow derivation in an inconsistent state that synthesizes an empty default workflow.
It never updates the submitsTo of employees who submitted to the removed approver. So optimistically: policy.approver = admin, but no employee has submitsTo === admin.
The Workflows list is re-derived from employeeList by convertPolicyEmployeesToApprovalWorkflows. Because no employee submits to the default approver (admin), the loop never emits an isDefault workflow, so this block injects a synthetic empty one — the phantom row:
Editing the approver to Employee 2 doesn't fix it: updateApprovalWorkflow only rewrites policy.approver when the edited workflow isDefault, so admin stays the default approver with zero submitters and the phantom persists. Going online fixes it because the backend fully removes Employee 1 and sets submitsTo/approver consistently, so the default approver actually has submitters and no synthetic workflow is injected.
Confirmed reproduction (offline → online)
After removing Employee 1 offline — approver auto-switched to Admin (single, correct workflow)
After saving Employee 2 as approver (offline) — phantom duplicate appears
Back online — the phantom disappears
The a11y tree confirmed the duplicate's "Expenses from" had no value (truly empty), and only one workflow block remained after sync.
Confidence: high — deterministically reproduced and the optimistic code path is unambiguous.
What changes do you think we should make in order to solve the problem?
Primary fix (source of the inconsistency): in removeMembers (src/libs/actions/Policy/Member.ts:394-420), make the optimistic employeeList mirror the backend: for every employee whose submitsTo (and forwardsTo/overLimitForwardsTo) points at a removed member, reassign it to the new default approver (the same value written to policy.approver). Then the default approver actually has submitters and no phantom workflow is derived.
Optional defensive guard in convertPolicyEmployeesToApprovalWorkflows: don't synthesize the empty default workflow when the default approver has no submitters, and skip emitting workflows keyed on a pendingAction: DELETE approver. This treats the symptom, so prefer the primary fix.
What alternative solutions did you explore?
N/A — the primary fix aligns the optimistic state with what the backend already returns, which is why the bug self-heals online.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99208) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@mkhutornyi Melvin's root cause looks off - that unshift block builds an isDefault: true workflow, so it would render first with the default hint, but the broken card in your video is second with no hint.
The real cause: a member with pendingAction: DELETE isn't pushed into workflow.members, but their old submitsTo still creates the workflow entry, so you end up with a group that has an approver and nobody in it.
Skipping them before that entry is created fixes it. Tests go from 2 cards to 1.
Activity
exfy-zapier commentedon Aug 21, 2026
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
FitseTLT commentedon Aug 21, 2026
@mallenexpensify U can assign me I can reproduce it
2026-08-21.20-46-07.mp4
MelvinBot commentedon Aug 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
An approval workflow (Workspace → Workflows → approvals) appears to save in the UI, but the configured member/approvers disappear after navigating away, refreshing, or reopening the Workflows page.
What is the root cause of that problem?
I could not reproduce a plain single-approver save (it persisted correctly across navigation in a fresh Collect workspace on web), so this is most likely an edge case tied to how the approver's email resolves, not a blanket save failure.
The Workflows list is not read from a stored "workflows" object — it is re-derived from
policy.employeeListevery time the page renders, viaconvertPolicyEmployeesToApprovalWorkflows. That function silently drops any member whosesubmitsTo(the approver email) is not an exact key inemployeeList:src/libs/WorkflowUtils.ts:191—if (!submitsTo || (!employees[submitsTo] && !hrAdvancedModeFinalApproverEmail)) { continue; }So even when the save persists on the backend, the workflow vanishes on the list if the stored approver email doesn't exactly match an
employeeListkey — e.g. a phone-number approver (e164@expensify.smsvs a raw phone string), a casing difference, or a freshly-invited approver not yet in the list. This exact failure mode is documented in the code:WorkspaceWorkflowsApprovalsApproverPage.tsx:183-185— "Without this, a phone approver invited offline stops resolving once online and the workflow disappears."Other mechanisms considered (and why they're less likely)
Workflow.ts:51-53returns beforeAPI.writeif the computed employee delta is empty, and the Save handler dismisses the modal regardless (WorkspaceWorkflowsApprovalsCreatePage.tsx:56-69). Possible, but for a genuinely new distinct-approver config the delta is non-empty, so the write does fire.failureDatarevert on API error —Workflow.ts:71-80rollsemployeeListback ifCreateWorkspaceApproval/UpdateWorkspaceApprovalreturns an error — would also look like "saved then disappeared." Needs logs to confirm.employees: JSON.stringify(Object.values(updatedEmployees))). If the backendCreateWorkspaceApproval/UpdateWorkspaceApproval(Web-Expensify) doesn't fully persist a delta-only payload, the read-back would drop it. This would be a backend fix, outside the App repo.Confidence: medium. Code evidence points to the read-back drop as the leading cause, but it wasn't reproduced in the basic case and there is no production confirmation yet. This customer report is still
Needs Reproduction— knowing whether the approvers were phone-number logins or freshly-invited members would confirm or rule out the top hypothesis.What changes do you think we should make in order to solve the problem?
convertPolicyEmployeesToApprovalWorkflows, canonicalizesubmitsTo/forwardsTo(applyaddSMSDomainIfPhoneNumber+ normalize casing) before theemployees[submitsTo]lookup so a phone/casing mismatch no longer drops the whole workflow, and don't silentlycontinue— surface it instead of hiding it.If reproduction confirms the write itself is failing or reverting (mechanisms 2/3 above), the fix would instead be on the backend
CreateWorkspaceApproval/UpdateWorkspaceApprovalpersistence, which is outside the App repo and should be escalated to an internal engineer with Web-Expensify access.What alternative solutions did you explore?
Confirming via production logs which
submitsTo/forwardsToemails were stored for the affected policy vs theemployeeListkeys returned on the nextOpenApp/ReconnectApp, and thejsonCodeof the save command, would disambiguate the App-side read-back drop from a backend persistence/revert. That requires the affected customer'spolicyID.Reproduction attempt (web) — basic case persisted
Setting a first approver on a workflow and saving persisted correctly across navigating to Home and back, and across switching tabs. Multi/additional approvers are gated behind the Control plan upgrade and couldn't be exercised on the Collect-plan test workspace, so the phone/edge-case path was not tested.
Workflows page immediately after saving the approver change
Workflows page after navigating to Home and back
Workflows page after navigating to Members tab and back
Related issues
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99208)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Aug 21, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (
External)melvin-bot commentedon Aug 21, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
mkhutornyi commentedon Aug 21, 2026
Not reproduced the exact bug in OP but while testing, I found another related bug.
Precondition: Employee 1 is approver
repro.mov
@MelvinBot investigate this optimistic bug
MelvinBot commentedon Aug 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
While offline, removing the current approver (Employee 1) from members — which auto-reassigns the default approver to Admin — and then editing the workflow's approver to Employee 2 produces a phantom duplicate workflow ("Approver: admin, Expenses from: nothing") next to the correct one. It disappears on reconnect. Confirmed reproduced (see below).
What is the root cause of that problem?
The optimistic member-removal path updates
policy.approverbut does not reassign the submitters who pointed at the removed member, leaving the workflow derivation in an inconsistent state that synthesizes an empty default workflow.In
removeMembers(src/libs/actions/Policy/Member.ts:394-420), the optimistic data only:pendingAction: DELETE(it stays inemployeeList), andpolicy.approverto the admin/owner viafindNextApproverInChain.It never updates the
submitsToof employees who submitted to the removed approver. So optimistically:policy.approver = admin, but no employee hassubmitsTo === admin.The Workflows list is re-derived from
employeeListbyconvertPolicyEmployeesToApprovalWorkflows. Because no employee submits to the default approver (admin), the loop never emits anisDefaultworkflow, so this block injects a synthetic empty one — the phantom row:src/libs/WorkflowUtils.ts:271-278—if (firstWorkflow && !firstWorkflow.isDefault) { unshift({ members: [], approvers: calculateApprovers(... defaultApprover ...), isDefault: true }) }Editing the approver to Employee 2 doesn't fix it:
updateApprovalWorkflowonly rewritespolicy.approverwhen the edited workflowisDefault, so admin stays the default approver with zero submitters and the phantom persists. Going online fixes it because the backend fully removes Employee 1 and setssubmitsTo/approverconsistently, so the default approver actually has submitters and no synthetic workflow is injected.Confirmed reproduction (offline → online)
After removing Employee 1 offline — approver auto-switched to Admin (single, correct workflow)
After saving Employee 2 as approver (offline) — phantom duplicate appears
Back online — the phantom disappears
The a11y tree confirmed the duplicate's "Expenses from" had no value (truly empty), and only one workflow block remained after sync.
Confidence: high — deterministically reproduced and the optimistic code path is unambiguous.
What changes do you think we should make in order to solve the problem?
Primary fix (source of the inconsistency): in
removeMembers(src/libs/actions/Policy/Member.ts:394-420), make the optimisticemployeeListmirror the backend: for every employee whosesubmitsTo(andforwardsTo/overLimitForwardsTo) points at a removed member, reassign it to the new default approver (the same value written topolicy.approver). Then the default approver actually has submitters and no phantom workflow is derived.Optional defensive guard in
convertPolicyEmployeesToApprovalWorkflows: don't synthesize the empty default workflow when the default approver has no submitters, and skip emitting workflows keyed on apendingAction: DELETEapprover. This treats the symptom, so prefer the primary fix.What alternative solutions did you explore?
N/A — the primary fix aligns the optimistic state with what the backend already returns, which is why the bug self-heals online.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99208)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
oqildev commentedon Aug 23, 2026
@mkhutornyi Melvin's root cause looks off - that
unshiftblock builds anisDefault: trueworkflow, so it would render first with the default hint, but the broken card in your video is second with no hint.The real cause: a member with
pendingAction: DELETEisn't pushed intoworkflow.members, but their oldsubmitsTostill creates the workflow entry, so you end up with a group that has an approver and nobody in it.Skipping them before that entry is created fixes it. Tests go from 2 cards to 1.
mallenexpensify commentedon Aug 24, 2026
@mkhutornyi should we create a new issue for the bug you found and let @FitseTLT take over this one since they're able to reproduce?
6 remaining items
melvin-bot commentedon Aug 27, 2026
@FitseTLT Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
FitseTLT commentedon Aug 27, 2026
Reviewing tomorrow
FitseTLT commentedon Aug 28, 2026
Not reproducible asking in slack
getusha commentedon Aug 29, 2026
@FitseTLT @mallenexpensify maybe the customer is confused by/didn't know the fact they had to click "Save" twice for the configuration to be saved?
Screen.Recording.2026-08-29.at.2.32.08.in.the.afternoon.mov
melvin-bot commentedon Aug 31, 2026
@FitseTLT Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Sep 2, 2026
@FitseTLT Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Sep 3, 2026
@FitseTLT Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Sep 3, 2026
@FitseTLT Eep! 4 days overdue now. Issues have feelings too...
mallenexpensify commentedon Sep 3, 2026
Closing per @FitseTLT 's request here