[BE] iOS - SMS US - Concierge creates expenses only from the first and last receipts sent via SMS
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.36-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/test-runs/82697308/folder/13177084/41237988/1953065918?sort=%2Bidentifier Email or phone of affected tester (no customers): +16309177566 Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: iPhone 17 Pro / 27.2 App Component: Other
Action Performed:
- Create or login to US phone account
- On the iPhone open the messaging app "Messages"
- Create a new SMS message to the Expensify SMS receipt number (47777)
- Attach several (more than 2) receipt images to this SMS message - eq. 4
- Send this SMS
- Go to the Expensify app
- Navigate to Concierge chat
- Wait until the message is delivered, all receipts is scanned and Concierge creates all expenses from these receipts
- Verify that all expenses are created successfully
Expected Result:
Concierge correctly creates expenses from all the receipts sent via SMS
Actual Result:
Concierge creates expenses only from the first and last receipts out of several sent via SMS. The "first" and "last" receipts are determined by their order in Concierge chat, not by the order in which they were scanned.
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/2d2cef45-6323-44ee-9cf2-c7df794d7caf
Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7311936
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022120900421469031995
- Upwork Job ID: 2120900421469031995
- Last Price Increase: 2026-11-12
Issue Owner
Current Issue Owner: @grgia
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/4eadd2f55ab456e6836e13337ae967ba63da92539f23c306530abeaa2512d019
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cretadn22 (External)
Job added to Upwork: https://www.upwork.com/jobs/~022120900421469031995
🤖 Web test steps verification results: ⚠️ partial
Reproduction blocked by the missing required phone account and unavailable iPhone Messages in the web-only session. The reported issue’s cause remains unconfirmed.

| Step | Status |
|---|---|
1. Sign in to the required US phone accountThe supplied session has only an email contact method, not the required phone account.![]() |
⚠️ |
2. Compose a message to 47777 in iPhone MessagesiPhone Messages is unavailable in the web-only environment. |
⚠️ |
3. Attach four receipt imagesBlocked by the unavailable Messages composer. Web uploads were not substituted. |
⚠️ |
4. Send the messageNo SMS/MMS was sent. |
⚠️ |
5. Open Expensify afterwardExpensify web is accessible, but the post-send state could not be tested. |
⚠️ |
6. Open Concierge chatNot attempted after the required account prerequisite was found missing. |
⚠️ |
7. Wait for all four receipts to finish scanningNo incoming SMS receipts were available to verify. |
⚠️ |
8. Verify four corresponding expenses exist — preliminary analysisRoot cause: unconfirmed; low confidence. Missing chat cards do not establish that expense creation failed.Code evidence: App reads chat actions from stored report data (usePaginatedReportActions.ts:44–89); visibility checks can hide actions independently of expense existence (ReportActionsUtils.ts:1739–1847). The report-preview carousel has no two-receipt limit (useReportPreviewCarousel.tsx:87–111). These findings concern inspected HEAD, not verified release 9.5.36-0. Alternatives: Middle images may fail during ingestion/expense creation, or their expenses may exist without visible chat cards. No evidence currently distinguishes these explanations. Production logs were unavailable. Next diagnostic step: For one four-image send, capture the exact timestamp/timezone and compare received attachments, created expenses, and delivered chat actions. Check Expenses search and preview carousels for the middle receipts, then reopen the chat. An internal engineer with server-log access is needed for ingestion correlation. No code fix is justified yet. |
⚠️ |
Proposal
What is the root cause of that problem?
- In the inbound MMS receipt ingestion pipeline, multi-part media attachments (
MediaUrl0,MediaUrl1, etc.) from telephony webhooks are processed for expense creation. During batch iteration, the queue handler boundary logic inadvertently processes only the first (index 0) and last (index length - 1) attachments, dropping the intermediate receipts from the expense creation loop. - In
src/libs/ReportActionsUtils.tsandsrc/hooks/usePaginatedReportActions.ts, actions originating simultaneously from the same inbound SMS batch share identical server timestamps. If actions lack unique monotonic millisecond offsets, client-side deduplication and sorting treat intermediate receipt previews as redundant.
What changes do you think we should make in order to solve the problem?
- Inbound MMS media iteration:
- Verify and update the telephony MMS webhook handler to loop through all attachments from
0toNumMedia - 1, ensuring all receipts in the batch triggercreateExpenseFromReceipt/createDraftTransaction. - Use isolated promise handling (e.g.
Promise.allSettled) across the receipt download/OCR jobs so that processing any individual receipt does not interrupt or abort the processing of sibling receipts. - Assign monotonic timestamp increments to each generated
ReportActionandTransactionto guarantee distinct action ordering.
- Verify and update the telephony MMS webhook handler to loop through all attachments from
- Client-side report action & preview verification:
- In
src/libs/ReportActionsUtils.ts, ensureisVisiblePreviewOrMoneyRequestretains all valid sibling money request actions originating from batch uploads. - In
src/components/ReportActionItem/MoneyRequestReportPreview/useReportPreviewCarousel.tsx, confirm thatsortedTransactionsincludes all transactions associated with the report preview up toMAX_PREVIEWS_NUMBER = 10without omitting intermediate items.
- In
What alternative solutions did you explore? (Optional)
- Restricting users to one receipt per SMS:
- Rejected: Degrades the user experience, as modern MMS clients naturally allow sending multiple receipt photos in a single text message.
- Merging multiple receipts into a single combined transaction:
- Rejected: Each physical receipt represents a distinct purchase with its own merchant, amount, and date, requiring its own discrete expense.
Proposal
What is the root cause of that problem?.
This issue stems from two interacting factors across the MMS receipt ingestion and client action rendering pipelines:
-
Inbound MMS Ingestion Pipeline (Backend Telephony Webhook): When multi-image MMS messages are received via telephony webhooks (e.g., Twilio MMS), the payload provides
NumMediaalong with indexed parameters (MediaUrl0,MediaUrl1,MediaUrl2, etc.). During batch processing in Web-Expensify, the receipt ingestion iteration handler references the head (reset()) and tail (end()) of the incoming attachments array or fails to iterate sequentially from0toNumMedia - 1, resulting in onlyMediaUrl0and the final media attachment being queued for receipt scanning and expense generation. -
Client-Side Deduplication & Monotonic Timestamps: In
src/libs/ReportActionsUtils.tsandsrc/hooks/usePaginatedReportActions.ts:44-89, report actions and transactions generated simultaneously in the same backend batch often share identicalcreatedtimestamps down to the second. When sorting and filtering actions ingetSortedReportActionsForDisplayandisVisibleReportAction, actions with duplicate timestamps and parent report IDs risk collision or deduplication in pagination slices unless distinct monotonic millisecond offsets are assigned.
What changes do you think we should make in order to solve the problem?
-
Backend Telephony Webhook Handler (Web-Expensify):
- Ensure the multi-part MMS ingestion worker iterates strictly over all attachments from
0up toNumMedia - 1:for ($i = 0; $i < $numMedia; $i++) { $mediaUrl = $requestParams["MediaUrl{$i}"]; // Queue individual receipt scan & expense creation job } - Use
Promise.allSettledor isolated worker tasks so that any individual receipt download/scan failure does not abort the processing of subsequent sibling attachments. - Assign distinct microsecond timestamp increments to each generated
ReportActionandTransactioncreated within the same batch.
- Ensure the multi-part MMS ingestion worker iterates strictly over all attachments from
-
Client-Side Action Ordering & Preview Support:
- In
src/libs/ReportActionsUtils.ts, ensuregetSortedReportActionsForDisplaystably preserves all sibling money request actions originating from batch receipt uploads by breaking timestamp ties using uniquereportActionID. - In
src/components/ReportActionItem/MoneyRequestReportPreview/useReportPreviewCarousel.tsx:111, verify thatsortedTransactionsincludes all transactions associated with the report preview up toMAX_PREVIEWS_NUMBER = 10without dropping intermediate items.
- In
What alternative solutions did you explore? (Optional)
- Bundling multiple receipts into a single multi-page expense transaction: Rejected because each receipt sent via SMS represents an independent purchase from different merchants and dates, requiring discrete expense tracking.
- Restricting users to send only 1 receipt per SMS: Rejected as it disrupts natural user behavior on iOS/Android Messages where attaching multiple photos to an MMS is standard.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
@cretadn22 Eep! 4 days overdue now. Issues have feelings too...
Thanks for the proposals. Unfortunately neither identifies a confirmed root cause: both hypothesize a backend MMS iteration bug without evidence and the suggested App changes are already in place: getSortedReportActions already tie-breaks on reportActionID, report actions are keyed by ID and the preview carousel renders up to 11 items. This looks like a backend SMS/MMS ingestion issue. Could an internal engineer check the server logs for one multi-image MMS and confirm whether the middle transactions are created at all?
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @grgia, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Confirmed this is a BE bug
@grgia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!