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-08-25] Invoice - "marked as paid" system message is different when copied as sender #97152
Version Number: 9.4.45-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:#97022 Email or phone of affected tester (no customers):sdsjodijnsdojsosjio@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Precondition:
User has sent an invoice. The invoice is paid by the receiver.
Perform the steps below as sender:
Go to staging.new.expensify.com
Go to invoice room.
Open the paid invoice.
Right click on the paid system message > Copy to clipboard.
Paste the message on the composer.
Expected Result:
"marked as paid" will be pasted.
Actual Result:
"paid . Add a bank account to receive your payment." is pasted.
For the sender, hasMissingInvoiceBankAccount returns true (they own the settled invoice and have no invoice bank account on the policy), so it returns payerSettledWithMissingBankAccount — "paid ${amount}. Add a bank account to receive your payment." — and the branch passes an emptyamount (ReportUtils.ts:10993-10994). That yields the exact broken string reported: paid . Add a bank account to receive your payment.
Note the in-code comment on that heuristic already flags it as a temporary/buggy behavior tied to an internal tracking issue (Expensify/Expensify#507850).
Why the on-screen text still shows "marked as paid" (the display/copy mismatch)
The on-screen render also calls the same function (IouReportActionMessage.tsx:45), so in principle both paths should produce the same string. The difference is that hasMissingInvoiceBankAccount reads non-reactive module caches (deprecatedAllReports, getPolicy, isSettled) rather than the useOnyx subscriptions the component re-renders on. The displayed value is computed/memoized at one moment (when the heuristic returned false → paidElsewhere → "marked as paid"), while the right-click copy recomputes it later against updated caches (heuristic now true). This exact-mechanism part is not runtime-verified — confirming it would require inspecting Onyx policy.invoice.bankAccount and the invoice statusNum at both moments. What is confirmed by code is which branch produces the copied string and why the amount is empty.
What changes do you think we should make in order to solve the problem?
Fix the broken string regardless of the mismatch: the payerSettledWithMissingBankAccount branch always passes an empty amount, so the copy (and any surface using it) reads "paid . Add a bank account…". Either pass the real formatted amount into that branch, or reword the string so it doesn't depend on an amount.
Make copy consistent with what's displayed: the copied text of a "marked as paid" system message should match the visible message. The cleanest options are (a) copy the report action's stored message rather than recomputing the heuristic in the copy path, or (b) make hasMissingInvoiceBankAccount reactive so display and copy always agree.
The underlying heuristic is already earmarked for a proper fix under the internal issue referenced in the code comment; the App-side changes above address the user-visible symptom in the meantime.
What alternative solutions did you explore? (Optional)
Confirming the exact display-vs-copy timing via a runtime repro (Onyx state inspection at render time vs. copy time) would let us decide between fix (2a) and (2b) with certainty.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/97152) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@MelvinBot Your root cause looks wrong. Please re-investigate.
You say the on-screen render also calls getIOUReportActionDisplayMessage (via IouReportActionMessage.tsx:45), and that display and copy diverge because hasMissingInvoiceBankAccount reads stale non-reactive caches. I don't think either part is true.
IouReportActionMessage is never reached here. ActionContentRouter.tsx:280 catches every IOU action with originalMessage.type === PAY and sends it to PaymentContent, before the ChatMessageContent fallback at line 506 that would reach IouReportActionMessage. So display goes through PaymentContent.tsx:37-39:
That never calls hasMissingInvoiceBankAccount. It always gives "marked as paid".
I added logs at all three sites and reproduced:
On render, only PaymentContent fires -> "marked as paid".
getIOUReportActionDisplayMessage does not fire on render at all. It fires only on right-click -> Copy, with hasMissingInvoiceBankAccount: true and the clipboard string "paid . Add a bank account to receive your payment.".
At that moment ownerAccountID === currentUserAccountID, transferBankAccountID is undefined, and isSettled is true. All three genuinely hold, so the value isn't stale — it's correct for a check that shouldn't run in the copy path.
Staleness would require the heuristic to run twice with different results. It runs once, only on copy.
So the real cause looks like duplicated logic: PaymentContent and getIOUReportActionDisplayMessage are two separate implementations of the same message, and only the second has the hasMissingInvoiceBankAccount check plus the empty-amount translate(translationKey, '') in the payerSettledWithMissingBankAccount branch. Fix should remove that divergence rather than make the heuristic reactive.
Also, in the render log the action's reportID was undefined while in the copy log it was set, same reportActionID. Since getIOUReportActionDisplayMessage derives IOUReportID from reportAction?.reportID, the two sites aren't even getting the same inputs — reactivity alone wouldn't make them match.
Same divergence likely affects invoice payments via Expensify/VBBA: PaymentContent.tsx:63-76 formats a real amount, while getIOUReportActionDisplayMessage passes an empty amount to iou.settleInvoiceBusiness/iou.settleInvoicePersonal. Less visible because those strings handle an empty amount gracefully.
Can you verify the above and confirm before we settle on a fix?
You're right on every point — thanks for the careful re-investigation. My earlier "stale non-reactive caches / display and copy diverge" mechanism was wrong. Verified against 4793a8f:
Corrected root cause: display and copy are two separate implementations of the same message, and only the copy path runs the hasMissingInvoiceBankAccount heuristic with an empty amount. There is no staleness — the heuristic runs exactly once, on copy.
Display: ActionContentRouter.tsx:280 routes every IOU PAY action to PaymentContent before the ChatMessageContent fallback, so IouReportActionMessage is never reached. PaymentContent's ELSEWHERE branch (PaymentContent.tsx:37-39) calls getElsewherePaymentReportActionMessage, which never calls hasMissingInvoiceBankAccount → always iou.paidElsewhere → "marked as paid".
Copy: ContextMenuActions.tsx:991 → getIOUReportActionDisplayMessage, whose own ELSEWHERE branch has the heuristic (ReportUtils.ts:10996) and, when it returns true, emits payerSettledWithMissingBankAccount with an empty amount (ReportUtils.ts:11024-11026). String template is paid ${amount}. Add a bank account… → "paid . Add a bank account to receive your payment." — the exact reported output.
Recommended fix (matches your direction): remove the divergence rather than make the heuristic reactive. Either copy the same message the display path renders, or have getIOUReportActionDisplayMessage's ELSEWHERE branch delegate to getElsewherePaymentReportActionMessage so both surfaces share one implementation.
Invoice VBBA/Expensify divergence also confirmed: display formats a real amount (PaymentContent.tsx:63-76) while copy passes '' to settleInvoiceBusiness/settleInvoicePersonal (ReportUtils.ts:11001). It's just less visible because those strings degrade gracefully on an empty amount ("Paid with business account" vs. "paid $X with business account …"). Consolidating the two implementations fixes this case too.
On the render-log reportID: undefined observation
Consistent with your point that the two sites aren't even fed the same inputs: PaymentContent never reads reportID at all (it works purely off originalMessage), whereas the copy path derives IOUReportID = reportAction?.reportID (ReportUtils.ts:10984) and feeds it to hasMissingInvoiceBankAccount. So even if reactivity were the issue, it couldn't reconcile the two — they're different code paths with different inputs.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/97152) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Thanks for the correction — we're aligned on the root cause now. A few things I'd like to clarify before moving forward, plus one additional finding.
New finding
I think the remaining callers of hasMissingInvoiceBankAccount are actually unreachable.
The function itself requires the report to be settled (isSettled(iouReportID)), but both remaining callers also check !isSettled(...), so the condition is self-contradictory and should always evaluate to false.
Could you please verify that? If that's correct, the HAS_MISSING_INVOICE_BANK_ACCOUNT attention/RBR state never fires today, so removing this copy isn't hiding an existing product nudge. It probably deserves its own issue rather than being bundled into this PR.
A few things to clarify
Could we explicitly decide the scope here? Either:
the minimal fix (remove the ternary so the ELSEWHERE branch always uses iou.paidElsewhere), or
fully consolidate the logic into a shared helper used by both PaymentContent and the copy path.
Small correction: the ELSEWHERE branch already delegates to getElsewherePaymentReportActionMessage via the translationKey === 'iou.paidElsewhere' check. The delegation isn't missing—the heuristic is just routing around it. So the minimal fix is removing the ternary.
Your comment gets cut off at "On the render-log reportID: undefined observation...". I'd like to understand that part, especially if we're planning to share the helper. Why do the two call sites receive different action shapes?
What should we do with payerSettledWithMissingBankAccount? It becomes unused across all language files. Remove it now, or leave it until Expensify/Expensify#507850?
Could you also confirm getIOUReportActionDisplayMessage at ReportUtils.ts:5664 (isSentMoneyReportAction) isn't affected? I don't think it is, but it would be good to confirm.
Finally, could you please add a unit test covering the ELSEWHERE branch for an invoice sender, asserting the copied string is "marked as paid"? That should prevent this from regressing.
@MelvinBot check these new findings and update your proposal and then we can proceed with the PR.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
As the invoice sender, open an invoice room with a paid invoice.
Right-click the "marked as paid" system message > Copy to clipboard.
Paste into the composer.
Verify the pasted text is marked as paid (not paid . Add a bank account to receive your payment.).
Activity
applause-bot commentedon Jul 27, 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/56c039c06beb6e20545dce90e1a476abeba8447c728bfdf699a2e26d1049601a
MelvinBot commentedon Jul 27, 2026
Proposal
What is the root cause of that problem?
Copying the message does not copy the "marked as paid" text you see on screen — it recomputes the text from scratch via
getIOUReportActionDisplayMessagein the copy handler atContextMenuActions.tsx:990.Inside that function, the
ELSEWHERE(marked-as-paid) branch picks between two strings based on a heuristic:(
ReportUtils.ts:10968)For the sender,
hasMissingInvoiceBankAccountreturnstrue(they own the settled invoice and have no invoice bank account on the policy), so it returnspayerSettledWithMissingBankAccount—"paid ${amount}. Add a bank account to receive your payment."— and the branch passes an emptyamount(ReportUtils.ts:10993-10994). That yields the exact broken string reported:paid . Add a bank account to receive your payment.Note the in-code comment on that heuristic already flags it as a temporary/buggy behavior tied to an internal tracking issue (
Expensify/Expensify#507850).Why the on-screen text still shows "marked as paid" (the display/copy mismatch)
The on-screen render also calls the same function (
IouReportActionMessage.tsx:45), so in principle both paths should produce the same string. The difference is thathasMissingInvoiceBankAccountreads non-reactive module caches (deprecatedAllReports,getPolicy,isSettled) rather than theuseOnyxsubscriptions the component re-renders on. The displayed value is computed/memoized at one moment (when the heuristic returnedfalse→paidElsewhere→ "marked as paid"), while the right-click copy recomputes it later against updated caches (heuristic nowtrue). This exact-mechanism part is not runtime-verified — confirming it would require inspecting Onyxpolicy.invoice.bankAccountand the invoicestatusNumat both moments. What is confirmed by code is which branch produces the copied string and why the amount is empty.What changes do you think we should make in order to solve the problem?
payerSettledWithMissingBankAccountbranch always passes an empty amount, so the copy (and any surface using it) reads"paid . Add a bank account…". Either pass the real formatted amount into that branch, or reword the string so it doesn't depend on an amount.hasMissingInvoiceBankAccountreactive so display and copy always agree.What alternative solutions did you explore? (Optional)
Confirming the exact display-vs-copy timing via a runtime repro (Onyx state inspection at render time vs. copy time) would let us decide between fix (2a) and (2b) with certainty.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/97152)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Jul 27, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (
External)melvin-bot commentedon Jul 27, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022081833556087764882
melvin-bot commentedon Jul 30, 2026
@Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Krishna2323 commentedon Aug 3, 2026
@MelvinBot Your root cause looks wrong. Please re-investigate.
You say the on-screen render also calls
getIOUReportActionDisplayMessage(viaIouReportActionMessage.tsx:45), and that display and copy diverge becausehasMissingInvoiceBankAccountreads stale non-reactive caches. I don't think either part is true.IouReportActionMessageis never reached here.ActionContentRouter.tsx:280catches everyIOUaction withoriginalMessage.type === PAYand sends it toPaymentContent, before theChatMessageContentfallback at line 506 that would reachIouReportActionMessage. So display goes throughPaymentContent.tsx:37-39:That never calls
hasMissingInvoiceBankAccount. It always gives "marked as paid".I added logs at all three sites and reproduced:
PaymentContentfires -> "marked as paid".getIOUReportActionDisplayMessagedoes not fire on render at all. It fires only on right-click -> Copy, withhasMissingInvoiceBankAccount: trueand the clipboard string "paid . Add a bank account to receive your payment.".ownerAccountID === currentUserAccountID,transferBankAccountIDis undefined, andisSettledis true. All three genuinely hold, so the value isn't stale — it's correct for a check that shouldn't run in the copy path.Staleness would require the heuristic to run twice with different results. It runs once, only on copy.
So the real cause looks like duplicated logic:
PaymentContentandgetIOUReportActionDisplayMessageare two separate implementations of the same message, and only the second has thehasMissingInvoiceBankAccountcheck plus the empty-amounttranslate(translationKey, '')in thepayerSettledWithMissingBankAccountbranch. Fix should remove that divergence rather than make the heuristic reactive.Also, in the render log the action's
reportIDwasundefinedwhile in the copy log it was set, samereportActionID. SincegetIOUReportActionDisplayMessagederivesIOUReportIDfromreportAction?.reportID, the two sites aren't even getting the same inputs — reactivity alone wouldn't make them match.Same divergence likely affects invoice payments via Expensify/VBBA:
PaymentContent.tsx:63-76formats a real amount, whilegetIOUReportActionDisplayMessagepasses an empty amount toiou.settleInvoiceBusiness/iou.settleInvoicePersonal. Less visible because those strings handle an empty amount gracefully.Can you verify the above and confirm before we settle on a fix?
MelvinBot commentedon Aug 3, 2026
You're right on every point — thanks for the careful re-investigation. My earlier "stale non-reactive caches / display and copy diverge" mechanism was wrong. Verified against
4793a8f:Corrected root cause: display and copy are two separate implementations of the same message, and only the copy path runs the
hasMissingInvoiceBankAccountheuristic with an empty amount. There is no staleness — the heuristic runs exactly once, on copy.ActionContentRouter.tsx:280routes every IOUPAYaction toPaymentContentbefore theChatMessageContentfallback, soIouReportActionMessageis never reached.PaymentContent'sELSEWHEREbranch (PaymentContent.tsx:37-39) callsgetElsewherePaymentReportActionMessage, which never callshasMissingInvoiceBankAccount→ alwaysiou.paidElsewhere→ "marked as paid".ContextMenuActions.tsx:991→getIOUReportActionDisplayMessage, whose ownELSEWHEREbranch has the heuristic (ReportUtils.ts:10996) and, when it returnstrue, emitspayerSettledWithMissingBankAccountwith an empty amount (ReportUtils.ts:11024-11026). String template ispaid ${amount}. Add a bank account…→"paid . Add a bank account to receive your payment."— the exact reported output.Recommended fix (matches your direction): remove the divergence rather than make the heuristic reactive. Either copy the same message the display path renders, or have
getIOUReportActionDisplayMessage'sELSEWHEREbranch delegate togetElsewherePaymentReportActionMessageso both surfaces share one implementation.Invoice VBBA/Expensify divergence also confirmed: display formats a real amount (
PaymentContent.tsx:63-76) while copy passes''tosettleInvoiceBusiness/settleInvoicePersonal(ReportUtils.ts:11001). It's just less visible because those strings degrade gracefully on an empty amount ("Paid with business account" vs. "paid $X with business account …"). Consolidating the two implementations fixes this case too.On the render-log
reportID: undefinedobservationConsistent with your point that the two sites aren't even fed the same inputs:
PaymentContentnever readsreportIDat all (it works purely offoriginalMessage), whereas the copy path derivesIOUReportID = reportAction?.reportID(ReportUtils.ts:10984) and feeds it tohasMissingInvoiceBankAccount. So even if reactivity were the issue, it couldn't reconcile the two — they're different code paths with different inputs.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/97152)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
Krishna2323 commentedon Aug 4, 2026
Thanks for the correction — we're aligned on the root cause now. A few things I'd like to clarify before moving forward, plus one additional finding.
New finding
I think the remaining callers of
hasMissingInvoiceBankAccountare actually unreachable.The function itself requires the report to be settled (
isSettled(iouReportID)), but both remaining callers also check!isSettled(...), so the condition is self-contradictory and should always evaluate tofalse.Could you please verify that? If that's correct, the
HAS_MISSING_INVOICE_BANK_ACCOUNTattention/RBR state never fires today, so removing this copy isn't hiding an existing product nudge. It probably deserves its own issue rather than being bundled into this PR.A few things to clarify
Could we explicitly decide the scope here? Either:
iou.paidElsewhere), orPaymentContentand the copy path.Small correction: the ELSEWHERE branch already delegates to
getElsewherePaymentReportActionMessagevia thetranslationKey === 'iou.paidElsewhere'check. The delegation isn't missing—the heuristic is just routing around it. So the minimal fix is removing the ternary.Your comment gets cut off at "On the render-log
reportID: undefinedobservation...". I'd like to understand that part, especially if we're planning to share the helper. Why do the two call sites receive different action shapes?What should we do with
payerSettledWithMissingBankAccount? It becomes unused across all language files. Remove it now, or leave it untilExpensify/Expensify#507850?Could you also confirm
getIOUReportActionDisplayMessageatReportUtils.ts:5664(isSentMoneyReportAction) isn't affected? I don't think it is, but it would be good to confirm.Finally, could you please add a unit test covering the ELSEWHERE branch for an invoice sender, asserting the copied string is "marked as paid"? That should prevent this from regressing.
@MelvinBot check these new findings and update your proposal and then we can proceed with the PR.
23 remaining items
Krishna2323 commentedon Aug 19, 2026
Not overdue, PR deployed to prod yesterday.
Krishna2323 commentedon Aug 19, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: feat: standardize pay button for expenses and IOUs #66790 (comment)
Link to the comment on the Issue: [Due for payment 2025-08-13] Fix system messages with MoveIOUReportToExistingPolicy command #61744 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
marked as paid(notpaid . Add a bank account to receive your payment.).Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-0937-a091-ef24-3d4586fd6214melvin-bot commentedon Aug 24, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 24, 2026
Payment Summary
Resolving PRs:
Fix invoice "marked as paid" copy diverging from displayed message #97999
Reviewer: @Krishna2323 owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 26, 2026
Payment Summary
Contributor+: @Krishna2323 due $250 via NewDot
laurenreidexpensify commentedon Sep 24, 2026
$250 Approved @Krishna2323 New Expensify