Skip to content

[HOLD] [$250] Workflows - Report is not auto-paid despite enabled feature #82995

Closed

Description

@lanitochka17

Held on https://github.com/Expensify/Expensify/issues/605172

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.23-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Mobile-Expensify/pull/13848
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: MacOS Monterey 12.7.4 / Chrome
App Component: Other

Action Performed:

Preconditions: control workspace with invited member. Enable Settings > Workspaces > {workspace} > Workflows > Auto-pay approved reports

STR:

  1. Member: Submit an expense in the workspace chat (amount is under auto-pay limit)
  2. Admin: Approve the report

Expected Result:

The report is automatically paid

Actual Result:

The report is not automatically paid

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7082820_1771533586105.Screenrecorder-2026-02-19-21-24-47-535.mp4
Bug7082820_1771530739936.Screen_Recording_2026-02-19_at_21.40.40.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022024587396009911903
  • Upwork Job ID: 2024587396009911903
  • Last Price Increase: 2026-02-19

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 19, 2026
  2. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. MelvinBot commented on Feb 19, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When "Auto-pay approved reports" is enabled on a Control workspace (Settings > Workspaces > Workflows), and a member submits an expense that is under the auto-pay limit, the report is not automatically paid after the admin approves it. The admin must manually pay the report despite auto-pay being enabled.

    What is the root cause of that problem?

    After thorough investigation of the frontend codebase, the auto-payment after approval is entirely handled by the backend. The frontend's approveMoneyRequest function (src/libs/actions/IOU/index.ts:10500-10851) sends an ApproveMoneyRequest API command to the backend with only the reportID and approvedReportActionID — it does not pass any auto-reimbursement settings, payment method, or bank account information. The ApproveMoneyRequestParams type (src/libs/API/parameters/ApproveMoneyRequestParams.ts) confirms there are zero auto-pay related fields.

    The backend is solely responsible for:

    1. Receiving the approval command
    2. Checking the policy's auto-reimbursement settings (autoReimbursement.limit, reimbursementChoice, etc.)
    3. Deciding whether to trigger automatic payment

    This means the root cause is server-side — the backend's ApproveMoneyRequest handler is not properly triggering auto-reimbursement after approval.

    There is also a related frontend UI issue at src/libs/actions/IOU/index.ts:10404 where isAutoReimbursable contains dead code logic:

    const isAutoReimbursable = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES
        ? false
        : canBeAutoReimbursed(iouReport, policy);

    This is always false because:

    • If reimbursementChoice === REIMBURSEMENT_YES: returns false directly
    • If reimbursementChoice !== REIMBURSEMENT_YES: canBeAutoReimbursed() also returns false (because it requires REIMBURSEMENT_YES internally at ReportUtils.ts:10854)

    This means the "Pay" button always shows for approved reports even when auto-pay should handle payment — a symptom consistent with the bug report.

    What changes do you think we should make in order to solve the problem?

    Since the actual auto-payment trigger is server-side, this requires a backend investigation of the ApproveMoneyRequest command handler to understand why it's not initiating auto-reimbursement after approval.

    The backend should be checking:

    • policy.reimbursementChoice === 'reimburseYes' (Direct reimbursement)
    • policy.autoReimbursement.limit >= reportTotal (report is under the auto-pay limit)
    • policy.shouldShowAutoReimbursementLimitOption === true (auto-pay toggle is enabled)
    • policy.achAccount.bankAccountID exists (bank account is connected)
    • Report currency is in the supported list (USD, AUD, CAD, GBP, EUR)

    Additionally, the dead code at IOU/index.ts:10404 should be fixed. The ternary should be removed so canBeAutoReimbursed is called directly, allowing the Pay button to be hidden when auto-reimbursement is expected:

    const isAutoReimbursable = canBeAutoReimbursed(iouReport, policy);

    However, the canBeAutoReimbursed function also needs a check for shouldShowAutoReimbursementLimitOption to respect the toggle state, since currently it only checks reimbursementChoice and autoReimbursement.limit.

    What alternative solutions did you explore? (Optional)

    Investigated whether this was a frontend regression — checked recent commits to IOU/index.ts, ReportUtils.ts, Policy.ts, and ExpenseReportRulesSection.tsx. No recent frontend changes modify the auto-pay flow. The enablePolicyAutoReimbursementLimit function correctly sends the EnablePolicyAutoReimbursementLimit API command with the toggle state, and setPolicyAutoReimbursementLimit correctly sends the limit. The issue is that after approval, the backend doesn't act on these settings.

    Detailed Investigation

    How Auto-Pay Settings Are Configured

    1. Toggle: enablePolicyAutoReimbursementLimit(policyID, true) at Policy.ts:6596-6663 sends EnablePolicyAutoReimbursementLimit with {policyID, enabled} to backend
    2. Limit: setPolicyAutoReimbursementLimit(policyID, limit) at Policy.ts:6523-6587 sends SetPolicyAutoReimbursementLimit with {policyID, limit}
    3. Prerequisites (checked in ExpenseReportRulesSection.tsx:27-28):
      • policy.areWorkflowsEnabled must be true
      • policy.reimbursementChoice must be 'reimburseYes' (Direct)
      • policy.achAccount.bankAccountID must exist

    Policy Data Model

    Field Purpose
    shouldShowAutoReimbursementLimitOption Whether auto-pay toggle is ON
    autoReimbursement.limit Max amount for auto-pay (cents)
    autoReimbursementLimit Legacy field (deprecated)
    reimbursementChoice 'reimburseYes' (Direct) / 'reimburseNo' (None) / 'reimburseManual' (Indirect)

    Approval Flow

    The approveMoneyRequest function sends APPROVE_MONEY_REQUEST to the backend. The params contain no auto-pay info — the backend must independently check the policy's settings and decide whether to auto-reimburse.

    Dead Code Analysis

    At IOU/index.ts:10404, the isAutoReimbursable variable in canIOUBePaid is always false due to contradictory logic between the ternary and canBeAutoReimbursed(). This is used on line 10425 (!isAutoReimbursable) to determine whether to show the Pay button — since it's always false, the Pay button always shows.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR for the frontend fix (dead code in canIOUBePaid), or @MelvinBot <your feedback> to refine this analysis. Note that the core issue (auto-pay not triggering) requires a backend investigation of the ApproveMoneyRequest handler.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 19, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 19, 2026
  6. melvin-bot commented on Feb 19, 2026

    @melvin-bot

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

  7. changed the title [-]Workflows - Report is not auto-paid despite enabled feature[/-] [+][$250] Workflows - Report is not auto-paid despite enabled feature[/+] on Feb 19, 2026
  8. melvin-bot commented on Feb 19, 2026

    @melvin-bot
  9. btkcodedev commented on Feb 19, 2026

    @btkcodedev
    Contributor

    BE issue

  10. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 19, 2026
  11. mallenexpensify commented on Feb 19, 2026

    @mallenexpensify
    Contributor

    Thanks @btkcodedev , removed Help Wanted since it's backend

  12. 28 remaining items

  13. joekaufmanexpensify commented on Mar 16, 2026

    @joekaufmanexpensify
    Contributor

    Still held

  14. cristipaval commented on Mar 17, 2026

    @cristipaval
    Contributor

    Asked for a retest here

  15. m-natarajan commented on Mar 17, 2026

    @m-natarajan

    Reproduce, Chrome, Xiaomi Redmi Note 10 / Android 12, v9.3.39-0

    Screenrecorder-2026-03-17-16-21-20-951.mp4
    Screen.Recording.2026-03-17.at.15.44.10.mp4
  16. s77rt commented on Mar 19, 2026

    @s77rt
    Member

    I don't think this is a bug. The policy needs to have.valid payments accounts to trigger the auto-reimbursements.

    Image
  17. s77rt commented on Mar 19, 2026

    @s77rt
    Member

    How did even get to enable Auto-pay approved reports? It should be locked if no account is set

    Image
  18. cristipaval commented on Mar 19, 2026

    @cristipaval
    Contributor

    @m-natarajan could you please reply to the above question? 🙏

  19. m-natarajan commented on Mar 19, 2026

    @m-natarajan

    @s77rt

    I don't think this is a bug. The policy needs to have.valid payments accounts to trigger the auto-reimbursements.

    The user added the bank account as per this video. Are you asking about the submitter?

    552371171-813a51b6-f285-4dc3-a999-3992d59983fe.mp4
  20. s77rt commented on Mar 21, 2026

    @s77rt
    Member

    @m-natarajan From the logs I see that both payer and submitter are using same bank account. You can't pay yourself when credit and debit bank accounts are the same. If you change the bank account of the submitter or just remove it, you will see that the payment will be initiated automatically.

    Screen.Recording.2026-03-21.at.10.27.31.AM.mov
  21. m-natarajan commented on Mar 23, 2026

    @m-natarajan

    @s77rt Asked for a retest based on your comments

  22. m-natarajan commented on Mar 23, 2026

    @m-natarajan

    Works with new instructions, Win 11 / Chrome, v9.3.42-0

    bandicam.2026-03-23.17-20-59-749.mp4
  23. cristipaval commented on Mar 24, 2026

    @cristipaval
    Contributor

    Ok, so this could be closed now, correct @s77rt?

  24. s77rt commented on Mar 24, 2026

    @s77rt
    Member

    Yes let's close

  25. cristipaval commented on Mar 24, 2026

    @cristipaval
    Contributor

    Thanks a lot for investigating it, @s77rt! 🙏

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.InternalRequires API changes or must be handled by Expensify staffWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions