Skip to content

[Due for payment 2026-09-30] To-do-To-do becomes empty for Admin when Employee held the first report #100365

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.72-0
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://test-management.browserstack.com/projects/2219752/folder/53697186/test-cases/132213353
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: MacBook Air 26.6.2 Chrome, iPhone 15 iOS 26.6.1
App Component: Left Hand Navigation (LHN)

Action Performed:

  1. As an Admin, create a workspace and invite an Employee
  2. Set the yourself as the approver
  3. As the Employee, submit a single-expense report
  4. Submit a separate report with two expenses
  5. As the Employee, open the single-expense report and place the expense on hold
  6. As an Admin, open LHN - To-dos

Expected Result:

The two-expense report remains present in the Inbox To-do tab with an Approve action available

Actual Result:

The two-expense report is not present in the Admin's Inbox To-do tab, when the one-expense report was put on hold by Employee

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7250644_1788479911856.Second_report_1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7250644

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    Daily
    Bug
    on Sep 4, 2026
  2. applause-bot commented on Sep 4, 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/0cb9448accb8067a34961282fca5c7d4fbddc221c59b5ccdb747b770fa5e05e6

  3. MelvinBot commented on Sep 4, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    For a workspace admin, the To-do row is the policy expense chat, not each expense report — so both reports A and B are represented by one LHN row. That row's To-do membership is decided by a single flag, requiresAttention (SidebarUtils.ts:973-975).

    In getReasonAndReportActionThatRequiresAttention, the chat picks one representative child expense report and then applies the all-held exclusion to that one report — but uses the result to gate the whole chat:

    1. getIOUReportActionWithBadge walks the chat's REPORTPREVIEW actions and keeps the oldest one that yields a badge. Report A was submitted first, and canApproveIOU has no hold awareness, so a fully-held report A still returns an APPROVE badge and wins the race. Report B is discarded.
    2. iouReportID, transactions and isExcludedForHeldExpenses are all computed from report A only (ReportUtils.ts:4672-4683). Report A has exactly one expense, so hasOnlyHeldExpenses is true after a single hold, and didCurrentUserPlaceHoldOnReportExpense is false for the admin (the employee placed the hold) → isExcludedForHeldExpenses = true.
    3. hasValidIOUAction is then false — and && !isExcludedForHeldExpenses overrides hasOutstandingChildRequest === true, so the correct server flag can't rescue it. No later branch matches, requiresAttention becomes false, and the chat row leaves the To-do tab, taking report B's pending approval with it.

    The exclusion was added in #96178 (merged 2026-08-17). It excludes all-held reports correctly, but is evaluated after a single winner has been chosen instead of during selection.

    Supporting evidence and things ruled out
    • Holding does not write shared state. putOnHold (Hold.ts:88-343) only touches the transaction, its thread, its violations, and report A's unheld* totals and nextStep. It writes no chatReport field, no hasOutstandingChildRequest, no policy or account key — so this is a read-side bug, not a data bug. The fix is entirely in the App repo.
    • No RBR fallback for the approver. The other half of the To-do filter, hasErrorsOtherThanFailedReceipt, is submitter-only (ReportUtils.ts:9868-9879), which is why the tab goes fully empty rather than leaving a red-dot row.
    • Why B doesn't get its own row. Expense reports only earn a separate To-do row when the approver has no access to the parent chat (ReportUtils.ts:4545-4564); a policy admin has that access.
    • Ordering dependency (good confirming test). The bug should only fire when the fully-held report's preview is the oldest. Holding the expense on the newer report instead should leave the To-do row intact.
    • Not verified: I analyzed this from code only — I did not run a live two-account repro, and there is no server-side log that records the client's requiresAttention decision.

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

    Move the all-held exclusion inside the candidate selection in getIOUReportActionWithBadge (or in getBadgeFromIOUReport), so a fully-held child report is skipped while choosing earliestAction and a still-approvable sibling wins instead. Keep the existing carve-out per report: a fully-held report where the current user placed the hold should still be selectable, since they can remove it.

    getReasonAndReportActionThatRequiresAttention can then drop the chat-wide isExcludedForHeldExpenses gate on ReportUtils.ts:4689-4692, because a chat with no selectable child will already produce no badge action.

    Regression tests to add alongside the existing ones from #96178: a chat with two submitted reports where the older one is fully held by the submitter must keep requiresAttention === true for the approver; and the single-report case must stay excluded.

    What alternative solutions did you explore?

    • Make canApproveIOU hold-aware. Cleaner in principle, but it feeds the Approve button and the Home/Spend to-dos too, so it risks changing behavior well beyond the LHN.
    • Only apply the exclusion when the chat has one child report. A narrow patch that leaves the same bug for three reports where the oldest two are held.
    • Rely on hasOutstandingChildRequest. Doesn't work: line 4692 explicitly overrides it.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/100365) 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 Sep 4, 2026
  5. melvin-bot commented on Sep 4, 2026

    @melvin-bot

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

  6. melvin-bot commented on Sep 4, 2026

    @melvin-bot

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

  7. j3ffffff commented on Sep 4, 2026

    @j3ffffff
  8. Anthgg commented on Sep 4, 2026

    @Anthgg

    Proposal

    What is the root cause of that problem?

    In getIOUReportActionWithBadge (src/libs/actions/IOU/ReportWorkflow.ts:383), we iterate through all REPORT_PREVIEW actions in the chat to select the earliestAction with an action badge. When multiple child reports exist (such as Report A submitted first, followed by Report B), Report A is selected as earliestAction because its preview action is older.

    However, when an employee places the only expense in Report A on hold, Report A cannot be approved by the admin.

    Back in getReasonAndReportActionThatRequiresAttention (src/libs/ReportUtils.ts:4689-4693), the function inspects only this single returned candidate (iouReportActionToApproveOrPay). It calculates hasAllExpensesHeld = true and isExcludedForHeldExpenses = true, causing hasValidIOUAction to be false and returning null. Because getIOUReportActionWithBadge does not filter out held reports and getReasonAndReportActionThatRequiresAttention has no fallback mechanism to evaluate subsequent report previews, the entire chat disappears from the Admin's To-do list despite Report B actively waiting for approval.

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

    Move the held-report exclusion check directly into getIOUReportActionWithBadge in src/libs/actions/IOU/ReportWorkflow.ts:

    Inside the REPORT_PREVIEW loop, after validating that iouReport exists and has a badge from getBadgeFromIOUReport:

    1. Check if all transactions of the child report are held (hasOnlyHeldExpenses).
    2. If all expenses are held and the current user did not place the hold (!didCurrentUserPlaceHoldOnReportExpense(...)), skip this action (continue;).
    3. Only consider the action for earliestAction if it is not excluded.

    This ensures getIOUReportActionWithBadge returns the oldest actionable child report (Report B in the repro). getReasonAndReportActionThatRequiresAttention will then receive a valid candidate, keeping requiresAttention = true and preserving the workspace chat in the Admin's To-do tab.

    We should also add a regression test in ReportUtilsTest covering a chat with two submitted expense reports where the earlier report is held by the employee and the later report is awaiting admin approval.

    What alternative solutions did you explore? (Optional)

    1. Filtering inside getReasonAndReportActionThatRequiresAttention: Loop back through all report previews if the chosen action is excluded. Rejected because it duplicates iteration logic and breaks the single responsibility of getIOUReportActionWithBadge (which is meant to select the actionable preview).
    2. Modifying canApproveIOU: Adding hold checks inside canApproveIOU. Rejected because canApproveIOU is consumed by other UI components (such as action buttons and report views) where held reports still need to display their approvable status once unheld.
  9. melvin-bot commented on Sep 4, 2026

    @melvin-bot

    📣 @Anthgg! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  10. Anthgg commented on Sep 4, 2026

    @Anthgg

    Contributor details
    Your Expensify account email: anthgg17@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01974b42efa621eec0

  11. melvin-bot commented on Sep 4, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  12. melvin-bot commented on Sep 7, 2026

    @melvin-bot

    @DylanDylann Whoops! This issue is 2 days overdue. Let's get this updated quick!

  13. 24 remaining items

  14. DylanDylann commented on Sep 23, 2026

    @DylanDylann
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    Test

    1. As an admin (account A), create a Collect or Control workspace and invite an employee (account B).
    2. In Workspace settings > Workflows, turn on Add approvals and set account A as the approver.
    3. As B, submit report 1 with a single expense to that workspace. Once it has submitted, submit report 2 with two expenses to the same workspace, so report 1 is the older of the two.
    4. As B, open report 1 and put its expense on hold.
    5. As A, open the To-dos tab in the LHN. Verify the workspace chat is still listed with an Approve badge, and that opening it lands on report 2 — the approvable sibling — not on the held report 1.
    6. As B, remove the hold from report 1 and instead put both expenses in report 2 on hold.
    7. As A, verify the To-dos row is still listed and its Approve badge now targets report 1.
    8. As B, remove the remaining holds. Verify A still sees the chat in To-dos.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-fc96-a779-a2a8-9010793ce8c4
  15. added
    Weekly
    and removed
    Daily
    on Sep 23, 2026
  16. DylanDylann commented on Sep 23, 2026

    @DylanDylann
    Contributor

    @MelvinBot Could you help find the offending PR that caused this bug?

  17. MelvinBot commented on Sep 23, 2026

    @MelvinBot
    Contributor

    Offending PR: [Payment due eh2077] Exclude all-held reports from the Inbox to-do, keep them for whoever placed the hold (Expensify/App#96178) — merged 2026-08-17, author allgandalf, reviewer eh2077. Staging 9.4.55-0, production 9.4.55-4; this bug was reported on 9.4.72-0.

    It added the chat-wide isExcludedForHeldExpenses gate at src/libs/ReportUtils.ts:4544 and ANDed it into hasValidIOUAction at ReportUtils.ts:4550-4553. The gate is computed from a single representative child report but applied to the whole policy expense chat, so a fully-held report hid its still-approvable sibling.

    Why this PR and not an earlier one

    Not verified in a browser — I could not drive a live session this run, so this is a code-and-history conclusion, not a bisect against builds.

    For the BugZero checklist, allgandalf and eh2077 are the people to notify on #96178.


    view run

  18. added
    Daily
    Awaiting Payment
    and removed
    Weekly
    on Sep 29, 2026
  19. melvin-bot commented on Sep 29, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  20. melvin-bot commented on Sep 29, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  21. mallenexpensify commented on Oct 1, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @DylanDylann due $250 via NewDot

  22. quinthar commented on Oct 27, 2026

    @quinthar
    Contributor

    Approved $250 to @DylanDylann

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions