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
Workflows - A new workflow isn’t created for a different second approver #99640
Version Number: 9.4.62-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#94825 Email or phone of affected tester (no customers):biruknew45+ghkhk52@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Web, android App Component: Workspace Settings
Action Performed:
Preconditions:
use Gmail account
Workspace exists with multiple members.
Go to staging.new.expensify.com
Navigate to workspace settings and select Workflows.
Create a workflow with first approver and second approver.
Create a second workflow for different users using the same first approver, but a different second approver.
Expected Result:
App should create a new workflow alongside the existing one.
Actual Result:
Existing workflow updates instead of creating a new workflow.
Approval workflows aren't stored as independent objects — they're derived from policy.employeeList, where each employee has a single submitsTo (their first approver) and each approver has a single forwardsTo (their next approver). So a given approver can forward to only one person across the entire policy.
When you create the second workflow with the same first approver A but a different second approver C, createApprovalWorkflow rewrites employeeList[A].forwardsTo from B to C. Because workflows are then re-derived by grouping submitters by their first approver, both submitter groups collapse into a single A → C workflow — which looks like "the existing workflow was updated instead of a new one being created."
This is a data-model limitation of the legacy employeeList representation, not a UI rendering bug.
Code evidence (HEAD 1605be0)
Derivation groups/keys workflows by the first approver's email — two submitter groups sharing a first approver can't coexist: src/libs/WorkflowUtils.ts:212-258
createApprovalWorkflow sends the mutated employeeList as the payload + optimistic data (no independent workflow record): src/libs/actions/Workflow.ts:57-109
Flow: WF1 sets A.forwardsTo=B → WF2 sets A.forwardsTo=C (single value, overwrites) → re-derive groups both submitter sets under key A → one A → C workflow remains.
What changes do you think we should make in order to solve the problem?
A fix already exists in the codebase behind the MULTIPLE_APPROVERS beta, which replaces the legacy employeeList derivation with a per-submitter rules-based model. In that path each submitter's full approver chain is fingerprinted, so A → B and A → C get distinct keys and remain independent workflows:
So the recommended resolution is to verify this scenario against the MULTIPLE_APPROVERS beta / rules-based path and drive that path to GA, rather than patching the legacy employeeList functions (which structurally cannot represent one approver forwarding to two different people). This also depends on backend (CreateWorkspaceApproval) support for the rules model, which is outside the App repo — a code fix for the legacy path here would be a workaround, not a real fix.
Short of GA, an interim App-side mitigation would be to detect and warn/block when a new workflow reuses an existing first approver with a conflicting forwardsTo, so the silent overwrite doesn't surprise users.
What alternative solutions did you explore? (Optional)
Patching the legacy employeeList path to keep both chains — rejected: a single forwardsTo per approver email cannot represent A → B and A → C simultaneously, so no amount of frontend logic fixes it without the rules model.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99640) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
A fix already exists in the codebase behind the MULTIPLE_APPROVERS beta, which replaces the legacy employeeList derivation with a per-submitter rules-based model.
That's correct. I can't reproduce this issue after enabling the beta flag, so I think we should close it.
cc @Gonals tagging you since you authored #94825, which is where this issue originated
Activity
applause-bot commentedon Aug 27, 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/db806d63bd3f0eae94c2fad188c0a5e0a744129b6e2726cb4086fb82cbecf445
MelvinBot commentedon Aug 27, 2026
Proposal
What is the root cause of that problem?
Approval workflows aren't stored as independent objects — they're derived from
policy.employeeList, where each employee has a singlesubmitsTo(their first approver) and each approver has a singleforwardsTo(their next approver). So a given approver can forward to only one person across the entire policy.When you create the second workflow with the same first approver A but a different second approver C,
createApprovalWorkflowrewritesemployeeList[A].forwardsTofrom B to C. Because workflows are then re-derived by grouping submitters by their first approver, both submitter groups collapse into a singleA → Cworkflow — which looks like "the existing workflow was updated instead of a new one being created."This is a data-model limitation of the legacy
employeeListrepresentation, not a UI rendering bug.Code evidence (HEAD
1605be0)src/libs/WorkflowUtils.ts:212-258forwardsTo:src/libs/WorkflowUtils.ts:72-108forwardsTo:src/libs/WorkflowUtils.ts:381-410createApprovalWorkflowsends the mutatedemployeeListas the payload + optimistic data (no independent workflow record):src/libs/actions/Workflow.ts:57-109Flow: WF1 sets
A.forwardsTo=B→ WF2 setsA.forwardsTo=C(single value, overwrites) → re-derive groups both submitter sets under keyA→ oneA → Cworkflow remains.What changes do you think we should make in order to solve the problem?
A fix already exists in the codebase behind the
MULTIPLE_APPROVERSbeta, which replaces the legacyemployeeListderivation with a per-submitter rules-based model. In that path each submitter's full approver chain is fingerprinted, soA → BandA → Cget distinct keys and remain independent workflows:WorkspaceWorkflowsApprovalsCreatePage.tsx:68-73WorkflowUtils.ts:1448-1465So the recommended resolution is to verify this scenario against the
MULTIPLE_APPROVERSbeta / rules-based path and drive that path to GA, rather than patching the legacyemployeeListfunctions (which structurally cannot represent one approver forwarding to two different people). This also depends on backend (CreateWorkspaceApproval) support for the rules model, which is outside the App repo — a code fix for the legacy path here would be a workaround, not a real fix.Short of GA, an interim App-side mitigation would be to detect and warn/block when a new workflow reuses an existing first approver with a conflicting
forwardsTo, so the silent overwrite doesn't surprise users.What alternative solutions did you explore? (Optional)
Patching the legacy
employeeListpath to keep both chains — rejected: a singleforwardsToper approver email cannot representA → BandA → Csimultaneously, so no amount of frontend logic fixes it without the rules model.Related issues
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99640)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 27, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)melvin-bot commentedon Aug 27, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
DylanDylann commentedon Sep 1, 2026
That's correct. I can't reproduce this issue after enabling the beta flag, so I think we should close it.
cc @Gonals tagging you since you authored #94825, which is where this issue originated
Gonals commentedon Sep 1, 2026
Yep, agreed