Skip to content

Workflows - A new workflow isn’t created for a different second approver #99640

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


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.

  1. Go to staging.new.expensify.com
  2. Navigate to workspace settings and select Workflows.
  3. Create a workflow with first approver and second approver.
  4. 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.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7243720_1787783532675.bandicam_2026-08-27_01-22-03-371.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7243720

Issue OwnerCurrent Issue Owner: @DylanDylann

Activity

  1. applause-bot commented on Aug 27, 2026

    @applause-bot
    Author

    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

  2. added
    Daily
    Bug
    on Aug 27, 2026
  3. MelvinBot commented on Aug 27, 2026

    @MelvinBot
    Contributor

    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 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)

    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.

    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

  4. added
    External
    on Aug 27, 2026
  5. melvin-bot commented on Aug 27, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)

  6. melvin-bot commented on Aug 27, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. DylanDylann commented on Sep 1, 2026

    @DylanDylann
    Contributor

    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

  8. self-assigned this
    on Sep 1, 2026
  9. Gonals commented on Sep 1, 2026

    @Gonals
    Contributor

    Yep, agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions