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
[Due for payment 2026-09-15] Expense - Failed scan expense does not move to a new report after marking as paid offline #96257
Version Number: 9.4.35-1 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#95682 Email or phone of affected tester (no customers):dosodjnosjdoisjoi@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat.
Create a manual expense.
Create a scan expense with invalid receipt.
Wait for smartscan to fail.
Open the report.
Go offline.
Click Submit, Approve and Mark as paid.
Go online.
Expected Result:
In Step 8. after marking the report as paid in offline mode, the failed scan expense will move to a new report.
Actual Result:
In Step 8. after marking the report as paid in offline mode, the failed scan expense does not move to a new report.
In Step 9, the failed scan expense only moves to a new report after returning online.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Root Cause: Moving a SmartScan-failed expense out of a report into a new report on Submit/Approve/Pay is done only by the backend response — the App has no optimistic (client-side) logic for it. So offline the split can't happen; it reconciles the moment the queued command is processed after reconnect. This is expected given the current architecture, not a broken state.
The only report-splitting the App does optimistically is the held-expenses split in Hold.ts:707 (via getReportFromHoldRequestsOnyxData), and it selects transactions strictly by transaction.comment.hold at Hold.ts:598-615 — never by scan-failed status, and only for a partial (!full) action. There is no hasSmartScanFailed / isTransactionSubmittable check feeding any optimistic report split in the Pay/Approve/Submit builders.
This is not caused by PR #95682 (the PR this deploy blocker was auto-assigned from by merge timing). That PR only changed the Submit button/To-Do visibility logic (isSubmitAction / canSubmitReport); it does not touch optimistic data or the move-to-new-report behavior. Recommend removing the DeployBlockerCash label — nothing in that PR regressed this, and the behavior is a pre-existing offline limitation of a backend-only feature.
Recommended Fix (if the offline UX is deemed worth fixing): Add an optimistic split in the Pay/Approve/Submit builders that mirrors the held-expenses split but keys off scan-failed / non-submittable transactions (e.g. reuse isTransactionSubmittable / hasSmartScanFailedWithMissingFields from TransactionUtils), building an optimistic new report with buildOptimisticExpenseReport and reassigning those transactions' reportID. This must exactly mirror what the server does, so it's a non-trivial change and not deploy-blocker-urgent.
Investigation details & evidence
Submit — ReportWorkflow.ts submitReport builds optimistic data that only flips stateNum/statusNum/nextStep on the same report; SubmitReportParams carries no move/new-report fields.
Pay — PayMoneyRequest.ts:502-514: same held-only split, also gated behind !full. No scan-failed detection.
The split mechanism — getReportFromHoldRequestsOnyxData (Hold.ts:707) builds an optimistic new report and moves transactions, but only those returned by getHoldReportActionsAndTransactions, which filters on transaction?.comment?.hold at Hold.ts:598-615.
Detection helper exists but isn't wired in — hasSmartScanFailedWithMissingFields / isTransactionSubmittable live in TransactionUtils and are used only for button-enablement (canSubmitReport), never for an optimistic report split.
Data flow (offline): User taps Pay/Approve/Submit → optimistic builders run → only the held-expenses split path exists, and scan-failed transactions aren't held → nothing moves → command queues → on reconnect the backend performs the split and returns updated Onyx data → only now does the moved expense appear. That exactly matches the reported symptom.
Alternative explanations considered: A regression from #95682 (ruled out — it only changes Submit visibility), or a broken/lost-data state (ruled out — the expense reconciles correctly once online; it's a delayed-optimistic-UI gap, not data loss).
Confidence: High on the code mechanism (no optimistic move path exists) and on #95682 not being the cause. Not log-verified that the backend performs the split online, but the reporter confirms the expense moves after reconnecting, which is consistent.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/96257) to create a draft PR that adds the optimistic split. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal (e.g. if paying-with-a-scan-failed-expense-offline is intended to remain a backend-only, online-only reconciliation).
Please re-state the problem that we are trying to solve in this issue.
When marking a report as paid offline, failed scan expenses (or expenses with violations) do not move to a new report. They stay in the current report and only move later when the app goes back online.
What is the root cause of that problem?
When you mark a report as paid offline, the app performs an "optimistic update" to show the payment instantly. It uses a helper function called getReportFromHoldRequestsOnyxData (in src/libs/actions/IOU/Hold.ts) to split unpayable expenses into a new report.
There are two missing pieces in the current logic:
The payment action assumes everything is payable: The payMoneyRequest function defaults to full = true. Because full is true, it completely bypasses the splitting logic.
The splitting logic only checks for "held" expenses: Even if we enabled the split, getReportFromHoldRequestsOnyxData only separates expenses that are on hold (transaction?.comment?.hold). It completely ignores expenses with blocking violations (like failed SmartScans or missing receipts).
Because of this, the frontend keeps the failed scans in the paid report, while the backend correctly splits them out when it processes the payment later.
What changes do you think we should make in order to solve the problem?
We need to update the frontend's optimistic update to match the backend's behavior: it should split out both held transactions and transactions with violations. 1. Update the split logic in src/libs/actions/IOU/Hold.ts
Rename getHoldReportActionsAndTransactions to getUnpayableReportActionsAndTransactions. Update it to also check for blocking violations:
// Fetch the violations for the transactionconsttransactionViolations=getAllTransactionViolations()?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`];consthasBlockingViolation=transactionViolations?.some((violation)=>violation.type===CONST.VIOLATION_TYPES.VIOLATION);// Split if it's on hold OR has a blocking violationif(transaction?.comment?.hold||hasBlockingViolation){unpayableReportActions.push(actionasOnyxTypes.ReportAction<typeofCONST.REPORT.ACTIONS.TYPE.IOU>);unpayableTransactions.push(transaction);}
2. Pass the correct full flag when paying
In the UI components where payment happens (PayPrimaryAction.tsx, PayActionButton.tsx, and MoneyReportHeaderSecondaryActions.tsx), we need to check for violations and held expenses, and pass that to payMoneyRequest.
// Calculate if there are violations or held expensesconsthasViolations=hasViolationsReportUtils(moneyRequestReport?.reportID,allTransactionViolations,accountID,email??'');consthasHeldExpenses=hasHeldExpensesReportUtils(Object.values(reportTransactions));// Pass full = false if there are unpayable expensespayMoneyRequest({
...
full: !(hasViolations||hasHeldExpenses),});
3. Update payMoneyRequest and approveMoneyRequest
Ensure both actions use the newly updated getReportFromUnpayableRequestsOnyxData helper so that when full is false, they properly move both held and failed scan expenses into the new optimistic report.
This perfectly aligns the offline behavior with the backend.
Activity
applause-bot commentedon Jul 16, 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/78387e4fd33b6a229ce19a4d2c91fc8b0397f503a324cda03a3573dd7d8ba3c0
melvin-bot commentedon Jul 16, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #95682
melvin-bot commentedon Jul 16, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jul 16, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Jul 16, 2026
Issue Analysis
Root Cause: Moving a SmartScan-failed expense out of a report into a new report on Submit/Approve/Pay is done only by the backend response — the App has no optimistic (client-side) logic for it. So offline the split can't happen; it reconciles the moment the queued command is processed after reconnect. This is expected given the current architecture, not a broken state.
The only report-splitting the App does optimistically is the held-expenses split in
Hold.ts:707(viagetReportFromHoldRequestsOnyxData), and it selects transactions strictly bytransaction.comment.holdatHold.ts:598-615— never by scan-failed status, and only for a partial (!full) action. There is nohasSmartScanFailed/isTransactionSubmittablecheck feeding any optimistic report split in the Pay/Approve/Submit builders.This is not caused by PR #95682 (the PR this deploy blocker was auto-assigned from by merge timing). That PR only changed the Submit button/To-Do visibility logic (
isSubmitAction/canSubmitReport); it does not touch optimistic data or the move-to-new-report behavior. Recommend removing theDeployBlockerCashlabel — nothing in that PR regressed this, and the behavior is a pre-existing offline limitation of a backend-only feature.Recommended Fix (if the offline UX is deemed worth fixing): Add an optimistic split in the Pay/Approve/Submit builders that mirrors the held-expenses split but keys off scan-failed / non-submittable transactions (e.g. reuse
isTransactionSubmittable/hasSmartScanFailedWithMissingFieldsfromTransactionUtils), building an optimistic new report withbuildOptimisticExpenseReportand reassigning those transactions'reportID. This must exactly mirror what the server does, so it's a non-trivial change and not deploy-blocker-urgent.Investigation details & evidence
ReportWorkflow.tssubmitReport builds optimistic data that only flipsstateNum/statusNum/nextStepon the same report;SubmitReportParamscarries no move/new-report fields.ReportWorkflow.ts:742-761: the only split is the held-expenses one, gated behind!full.PayMoneyRequest.ts:502-514: same held-only split, also gated behind!full. No scan-failed detection.getReportFromHoldRequestsOnyxData(Hold.ts:707) builds an optimistic new report and moves transactions, but only those returned bygetHoldReportActionsAndTransactions, which filters ontransaction?.comment?.holdatHold.ts:598-615.hasSmartScanFailedWithMissingFields/isTransactionSubmittablelive inTransactionUtilsand are used only for button-enablement (canSubmitReport), never for an optimistic report split.Data flow (offline): User taps Pay/Approve/Submit → optimistic builders run → only the held-expenses split path exists, and scan-failed transactions aren't held → nothing moves → command queues → on reconnect the backend performs the split and returns updated Onyx data → only now does the moved expense appear. That exactly matches the reported symptom.
Alternative explanations considered: A regression from #95682 (ruled out — it only changes Submit visibility), or a broken/lost-data state (ruled out — the expense reconciles correctly once online; it's a delayed-optimistic-UI gap, not data loss).
Confidence: High on the code mechanism (no optimistic move path exists) and on #95682 not being the cause. Not log-verified that the backend performs the split online, but the reporter confirms the expense moves after reconnecting, which is consistent.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/96257)to create a draft PR that adds the optimistic split.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal (e.g. if paying-with-a-scan-failed-expense-offline is intended to remain a backend-only, online-only reconciliation).
Pintu-Jha commentedon Jul 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When marking a report as paid offline, failed scan expenses (or expenses with violations) do not move to a new report. They stay in the current report and only move later when the app goes back online.
What is the root cause of that problem?
When you mark a report as paid offline, the app performs an "optimistic update" to show the payment instantly. It uses a helper function called
getReportFromHoldRequestsOnyxData(insrc/libs/actions/IOU/Hold.ts) to split unpayable expenses into a new report.There are two missing pieces in the current logic:
payMoneyRequestfunction defaults tofull = true. Becausefullis true, it completely bypasses the splitting logic.getReportFromHoldRequestsOnyxDataonly separates expenses that are on hold (transaction?.comment?.hold). It completely ignores expenses with blocking violations (like failed SmartScans or missing receipts).Because of this, the frontend keeps the failed scans in the paid report, while the backend correctly splits them out when it processes the payment later.
What changes do you think we should make in order to solve the problem?
We need to update the frontend's optimistic update to match the backend's behavior: it should split out both held transactions and transactions with violations.
1. Update the split logic in
src/libs/actions/IOU/Hold.tsRename
getHoldReportActionsAndTransactionstogetUnpayableReportActionsAndTransactions. Update it to also check for blocking violations:2. Pass the correct
fullflag when payingIn the UI components where payment happens (
PayPrimaryAction.tsx,PayActionButton.tsx, andMoneyReportHeaderSecondaryActions.tsx), we need to check for violations and held expenses, and pass that topayMoneyRequest.3. Update
payMoneyRequestandapproveMoneyRequestEnsure both actions use the newly updated
getReportFromUnpayableRequestsOnyxDatahelper so that whenfullis false, they properly move both held and failed scan expenses into the new optimistic report.This perfectly aligns the offline behavior with the backend.
jasperhuangg commentedon Jul 16, 2026
This can be demoted because it's behind the beta.
65 remaining items
yusufdeveloper2903 commentedon Sep 18, 2026
@mallenexpensify Thanks for checking. I agree with $125 for this one
melvin-bot commentedon Sep 18, 2026
@brunovjk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
mallenexpensify commentedon Sep 19, 2026
@deetergp 👀 above please. Thx
deetergp commentedon Sep 19, 2026
Agreed that $125 sounds like the right amount 👍
melvin-bot commentedon Sep 19, 2026
@mallenexpensify — to hire @yusufdeveloper2903 on Upwork, add the External label so a job is created and the offer is sent automatically.
mallenexpensify commentedon Sep 19, 2026
Payment Summary
Contributor: @yusufdeveloper2903 paid $125 via Upwork
Contributor+: @brunovjk due $125 via NewDot
@yusufdeveloper2903 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022101108479971088512
yusufdeveloper2903 commentedon Sep 19, 2026
@mallenexpensify Thanks! I've accepted the job offer on Upwork
laurenreidexpensify commentedon Sep 21, 2026
Approved $125 @brunovjk New Expensify
mallenexpensify commentedon Sep 21, 2026
@yusufdeveloper2903 paid, summary updated above. Thx.