Skip to content

[Exploratory] Expense-With instant submission, expense is not auto submitted. #101020

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: V9.4.77-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/53775228/test-cases/113924940
Email or phone of affected tester (no customers): Applausetester+aha@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Redmi note 10s android 13
App Component: Money Requests

Action Performed:

  1. Launch app using Expensifail account
  2. Create a workspace
  3. Open workspace chat
  4. Create a empty report
  5. Go to workspace settings- workflows - submission change as instant
  6. Go to workspace chat
  7. Tap plus icon and create a manual expense

Expected Result:

With instant submission, expense must be auto submitted.

Actual Result:

With instant submission, expense is not auto submitted.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7257376_1789151136445.Screenrecorder-2026-09-11-23-27-49-53.mp4

View all open jobs on GitHub

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

Issue OwnerCurrent Issue Owner: @justinpersaud

Activity

  1. applause-bot commented on Sep 12, 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/4ab317e2c583116c4976a1180a1242d8c880879066767dc2ce9c6a6a440a2753

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 24, 2026
  3. MelvinBot commented on Sep 24, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    Instant submit is only applied when the App builds a brand-new expense report. Step 4 of the repro ("Create an empty report") makes that never happen.

    Creating an empty report in the workspace chat points the chat at it: src/libs/actions/Report/index.ts:4702 writes iouReportID: reportID onto the parent workspace chat.

    When the manual expense is then created, src/libs/actions/IOU/MoneyRequestBuilder.ts:1409 resolves that pointer and reuses the empty report. shouldCreateNewMoneyRequestReport returns false for it, so the !iouReport || shouldCreateNewMoneyRequestReport branch at MoneyRequestBuilder.ts:1433 is skipped.

    That branch is the only path to getExpenseReportStateAndStatus, the one function that turns instant submit into stateNum/statusNum = SUBMITTED. The existing report's stateNum/statusNum are never recomputed, so it stays OPEN (0/0) — an unsubmitted expense.

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

    In getMoneyRequestInformation, in the branch that reuses an existing expense report (MoneyRequestBuilder.ts:1452 onwards), also recompute state when the reused report is still open. Call getExpenseReportStateAndStatus(policy, isASAPSubmitBetaEnabled) and apply the result to the reused report whenever isOpenExpenseReport(iouReport) is true, in the same place the totals are already being mutated. That keeps the "add to an existing open report" flow but makes instant submit behave the way the setting promises: adding an expense submits the report.

    This needs matching backend behaviour — RequestMoney must also submit the report it appends to, not only ones it creates. That part is outside this repo, so an internal engineer should confirm/handle it.

    Add a regression test: there is currently no test that exercises instant submit through requestMoney/getMoneyRequestInformation.

    What alternative solutions did you explore? (Optional)

    Alternatives considered and ruled out

    Make shouldCreateNewMoneyRequestReport return true when instant submit is on. This forces a fresh submitted report every time, which would break the deliberate "create an empty report, then add expenses to it" flow that the user explicitly started. Rejected.

    autoReporting and autoReportingFrequency diverging. isInstantSubmitEnabled needs both autoReporting === true and autoReportingFrequency === 'instant', but setWorkspaceAutoReportingFrequency only writes the frequency. A policy can therefore display "Instantly" while instant submit evaluates false. This is a real second bug worth its own issue, but it does not explain this repro: the user reached the frequency page through the Workflows accordion, which is gated on autoReporting being true.

    The asapSubmit beta. ReportUtils.ts:7436 short-circuits every new expense report to OPEN when that beta is on, producing the same symptom with no empty report involved. Worth confirming the reporter's beta state, but the empty-report path reproduces deterministically without it.

    Widening since 9.4.81. Reuse the submitter's outstanding report when the chat has no iouReportID added a getNewestOutstandingReportForUser fallback at MoneyRequestBuilder.ts:1412. That is not the cause here (the bug reproduces on 9.4.77-0), but it makes the same class of bypass fire in more situations.

    Verification note. The code chain above was read and confirmed directly. A browser reproduction was attempted but the test session died before any step ran, so this analysis rests on code evidence, not a live repro.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101020) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run · no recording available

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 24, 2026
  5. melvin-bot commented on Sep 24, 2026

    @melvin-bot

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

  6. melvin-bot commented on Sep 24, 2026

    @melvin-bot

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

  7. melvin-bot commented on Sep 26, 2026

    @melvin-bot

    @linhvovan29546 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  8. 6 remaining items

  9. melvin-bot commented on Oct 3, 2026

    @melvin-bot

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

  10. linhvovan29546 commented on Oct 5, 2026

    @linhvovan29546
    Contributor

    This is a BE issue, not FE. When an expense is added to a report that's still OPEN (e.g. a pre-created empty report) on a workspace with instant submit enabled, the FE correctly shows Waiting for your expenses to automatically submit shortly, this is the designed next-step message for policy.harvesting.enabled reports, telling the user the backend's harvest job will pick it up and submit it shortly, with a manual Submit button as a fallback.

    The actual bug: that automatic submit never happens. The harvest job should submit this report the same way it does for a freshly-created report with instant submit on, but it doesn't follow through here.

    Can an internal engineer look into why the harvest/auto-submit job isn't picking up this report?

    🎀 👀 🎀 C+ reviewed

  11. melvin-bot commented on Oct 5, 2026

    @melvin-bot

    Triggered auto assignment to @justinpersaud, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  12. justinpersaud commented on Oct 7, 2026

    @justinpersaud
    Contributor

    I have a backend PR up to fix this. Will test it out tomorrow.

  13. justinpersaud commented on Oct 8, 2026

    @justinpersaud
    Contributor

    Backend fix is in review. I'll update here once it has been merged for a re-test.

  14. justinpersaud commented on Oct 9, 2026

    @justinpersaud
    Contributor

    Should be fixed in the backend. Can we get a retest @jponikarchuk ?

  15. melvin-bot commented on Oct 10, 2026

    @melvin-bot

    @justinpersaud @linhvovan29546 this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  16. justinpersaud commented on Oct 13, 2026

    @justinpersaud
    Contributor

    This should be resolved

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions