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-04-14] Expense - Extra hold expense comment appears after splitting held expense #86798
Version Number: 9.3.51-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#84551 Email or phone of affected tester (no customers):snodijosdnjoijiosnj@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Chat Report View
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat.
Create an expense.
Open the expense.
Hold the expense.
Click More > Split > Save.
Open any held split expense.
Expected Result:
Only one hold expense comment will appear in the transaction thread.
Actual Result:
Extra hold expense comment appears after splitting held expense.
👋 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.
Classification: Frontend bug Causing PR: #84551 - "Fix/73390 - Split Transaction - Reply link is shown after deleting an expense" by @dmkt9 (High confidence) Related Issues: #73390
Recommendation: REVERT
This PR introduced logic to copy comments and hold state when splitting transactions. The bug occurs in the copyCommentsAndHoldState function where duplicate hold comments are created when splitting a held expense.
Labels: No changes needed. DeployBlockerCash is correctly applied (blocks App deploy for this frontend bug).
I confirmed that PR #84551 modified this exact file, adding 408 additions and 109 deletions to src/libs/actions/IOU/Split.ts.
Root Cause
The bug is in lines 1623-1627 of Split.ts:
// If the commentAction is not found, it means the action has been deleted.// We call insertHoldState here to ensure the hold state is always added.if(!hasInsertedHoldState){insertHoldState();}
The problem: When splitting a held expense, the code iterates through comment actions to find the hold comment action (lines 1614-1618). If the hold comment action is not found in the iteration (due to filtering, timing issues, or timestamp mismatches in the isHoldComment comparison), the fallback logic at line 1626 calls insertHoldState() without a comment action parameter.
This creates a hold report action WITHOUT the associated comment. However, the original hold state/comment may still exist or be added elsewhere, resulting in duplicate hold comments appearing in the transaction thread.
Expected behavior: Only ONE hold expense comment should appear Actual behavior: Extra hold expense comment appears after splitting held expense
PR #84551 added comment-copying logic to src/libs/actions/IOU/Split.ts so that when a transaction is split, comments from the original thread are carried over to each split transaction's thread. For held expenses, the code also copies the hold state (HOLD action + hold reason comment) to each split.
The problem is in the isHoldComment matching function at src/libs/actions/IOU/Split.ts:1607-1612. When a transaction is held, two report actions are created in the thread:
A HOLD action (type HOLD) — the system marker
An ADDCOMMENT action — the hold reason text, created 1ms after the HOLD
The comment-copying code at line 1172-1174 collects all ADDCOMMENT actions from the original thread (including the hold reason). The copyCommentsAndHoldState function (line 1587-1628) iterates over these comments and uses isHoldComment to detect which ADDCOMMENT is the hold reason, so it can intercept it and create a proper HOLD+comment pair in the split thread instead of copying it as a regular comment.
isHoldComment identifies the hold comment by matching timestamps between the HOLD action and each ADDCOMMENT:
If holdReportAction.timestamp is defined (server data): compares holdReportAction.timestamp === commentAction.timestamp
If undefined (optimistic data): checks if commentAction.created - 1ms === holdReportAction.created
This matching is fragile. When it fails (e.g., server-returned timestamp values differ between the HOLD action and its paired ADDCOMMENT, or one has timestamp defined while the other doesn't), the hold reason ADDCOMMENT is not intercepted. It falls through to addCommentToSplitTransactionThread (line 1620) and gets copied as a regular comment. Then, after the loop, the fallback at line 1625-1626 calls insertHoldState() without a comment argument, creating a HOLD action with no paired comment.
The split thread then contains:
A HOLD action ("held this expense") — from the fallback insertHoldState()
The hold reason text as a separate regular comment — from addCommentToSplitTransactionThread
This appears to the user as an extra hold comment in the split transaction thread.
What changes do you think we should make in order to solve the problem?
Make the isHoldComment matching more robust in src/libs/actions/IOU/Split.ts. Instead of relying solely on exact timestamp comparison, the function should:
First try the existing timestamp comparison (when both actions have timestamp defined)
If only one has timestamp defined, fall through to the created comparison instead of returning false
For the created comparison, use a small window (e.g., within 2 seconds) rather than requiring an exact 1ms gap, since server-assigned created values may not preserve the client-side 1ms offset
Specifically, update isHoldComment at line 1607-1612 to handle the case where the HOLD action has timestamp but the ADDCOMMENT doesn't (or vice versa) by falling back to the created-based comparison. Also widen the created comparison to check if commentAction.created is within a small time window after holdReportAction.created, rather than requiring exactly 1ms difference.
What alternative solutions did you explore? (Optional)
An alternative approach would be to filter the hold reason ADDCOMMENT out of allCommentActionsFromOriginalTransactionThread before the copying loop, using the originalTransaction.comment.hold field to identify the HOLD action and then finding its paired ADDCOMMENT. However, this would require a separate mechanism to identify the paired comment and would be more complex.
Another option would be to add an explicit flag or property to hold reason ADDCOMMENT actions (e.g., a isHoldReasonComment field) so they can be identified reliably without timestamp matching. This would require changes to both buildOptimisticHoldReportActionComment in ReportUtils.ts and the backend.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
@luacmartins I just checked and the HoldRequest API no longer returns the timestamp field for the two reportActions (HOLD and ADDCOMMENT). At the same time, the created values of these two reportActions have also changed compared to optimisticData (they are no longer offset by 1ms). As a result, both checks fail, and the comment ends up being treated as a normal comment, which leads to incorrect params when splitting the transaction.
Are we removing the timestamp field from those reportActions on the backend?
changed the title [-]Expense - Extra hold expense comment appears after splitting held expense[/-][+][Due for payment 2026-04-14] Expense - Extra hold expense comment appears after splitting held expense[/+]on Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.53-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@luacmartins The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Activity
melvin-bot commentedon Mar 31, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #84551
melvin-bot commentedon Mar 31, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 31, 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:
OSBotify commentedon Mar 31, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #84551 - "Fix/73390 - Split Transaction - Reply link is shown after deleting an expense" by @dmkt9 (High confidence)
Related Issues: #73390
Recommendation: REVERT
This PR introduced logic to copy comments and hold state when splitting transactions. The bug occurs in the
copyCommentsAndHoldStatefunction where duplicate hold comments are created when splitting a held expense.Labels: No changes needed.
DeployBlockerCashis correctly applied (blocks App deploy for this frontend bug).📋 Detailed Analysis
Evidence
Verification
The bug affects the split transaction functionality in:
src/libs/actions/IOU/Split.tscopyCommentsAndHoldState(lines 1587-1628)I confirmed that PR #84551 modified this exact file, adding 408 additions and 109 deletions to
src/libs/actions/IOU/Split.ts.Root Cause
The bug is in lines 1623-1627 of
Split.ts:The problem: When splitting a held expense, the code iterates through comment actions to find the hold comment action (lines 1614-1618). If the hold comment action is not found in the iteration (due to filtering, timing issues, or timestamp mismatches in the
isHoldCommentcomparison), the fallback logic at line 1626 callsinsertHoldState()without a comment action parameter.This creates a hold report action WITHOUT the associated comment. However, the original hold state/comment may still exist or be added elsewhere, resulting in duplicate hold comments appearing in the transaction thread.
Expected behavior: Only ONE hold expense comment should appear
Actual behavior: Extra hold expense comment appears after splitting held expense
luacmartins commentedon Mar 31, 2026
@dmkt9 can you please take a look at this?
MelvinBot commentedon Mar 31, 2026
Proposal
What is the root cause of that problem?
PR #84551 added comment-copying logic to
src/libs/actions/IOU/Split.tsso that when a transaction is split, comments from the original thread are carried over to each split transaction's thread. For held expenses, the code also copies the hold state (HOLD action + hold reason comment) to each split.The problem is in the
isHoldCommentmatching function atsrc/libs/actions/IOU/Split.ts:1607-1612. When a transaction is held, two report actions are created in the thread:HOLD) — the system markerThe comment-copying code at line 1172-1174 collects all
ADDCOMMENTactions from the original thread (including the hold reason). ThecopyCommentsAndHoldStatefunction (line 1587-1628) iterates over these comments and usesisHoldCommentto detect which ADDCOMMENT is the hold reason, so it can intercept it and create a proper HOLD+comment pair in the split thread instead of copying it as a regular comment.isHoldCommentidentifies the hold comment by matching timestamps between the HOLD action and each ADDCOMMENT:holdReportAction.timestampis defined (server data): comparesholdReportAction.timestamp === commentAction.timestampcommentAction.created - 1ms === holdReportAction.createdThis matching is fragile. When it fails (e.g., server-returned
timestampvalues differ between the HOLD action and its paired ADDCOMMENT, or one hastimestampdefined while the other doesn't), the hold reason ADDCOMMENT is not intercepted. It falls through toaddCommentToSplitTransactionThread(line 1620) and gets copied as a regular comment. Then, after the loop, the fallback at line 1625-1626 callsinsertHoldState()without a comment argument, creating a HOLD action with no paired comment.The split thread then contains:
insertHoldState()addCommentToSplitTransactionThreadThis appears to the user as an extra hold comment in the split transaction thread.
What changes do you think we should make in order to solve the problem?
Make the
isHoldCommentmatching more robust insrc/libs/actions/IOU/Split.ts. Instead of relying solely on exact timestamp comparison, the function should:timestampcomparison (when both actions havetimestampdefined)timestampdefined, fall through to thecreatedcomparison instead of returning falsecreatedcomparison, use a small window (e.g., within 2 seconds) rather than requiring an exact 1ms gap, since server-assignedcreatedvalues may not preserve the client-side 1ms offsetSpecifically, update
isHoldCommentat line 1607-1612 to handle the case where the HOLD action hastimestampbut the ADDCOMMENT doesn't (or vice versa) by falling back to thecreated-based comparison. Also widen thecreatedcomparison to check ifcommentAction.createdis within a small time window afterholdReportAction.created, rather than requiring exactly 1ms difference.What alternative solutions did you explore? (Optional)
An alternative approach would be to filter the hold reason ADDCOMMENT out of
allCommentActionsFromOriginalTransactionThreadbefore the copying loop, using theoriginalTransaction.comment.holdfield to identify the HOLD action and then finding its paired ADDCOMMENT. However, this would require a separate mechanism to identify the paired comment and would be more complex.Another option would be to add an explicit flag or property to hold reason ADDCOMMENT actions (e.g., a
isHoldReasonCommentfield) so they can be identified reliably without timestamp matching. This would require changes to bothbuildOptimisticHoldReportActionCommentinReportUtils.tsand the backend.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.dmkt9 commentedon Apr 1, 2026
@luacmartins I just checked and the
HoldRequestAPI no longer returns thetimestampfield for the tworeportActions(HOLDandADDCOMMENT). At the same time, thecreatedvalues of these tworeportActionshave also changed compared tooptimisticData(they are no longer offset by 1ms). As a result, both checks fail, and the comment ends up being treated as a normal comment, which leads to incorrect params when splitting the transaction.Are we removing the
timestampfield from thosereportActionson the backend?9 remaining items
Merge pull request #86931 from dmkt9/fix/86798-regression-of-84551
melvin-bot commentedon Apr 7, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
luacmartins commentedon Apr 7, 2026
This is fixed
[-]Expense - Extra hold expense comment appears after splitting held expense[/-][+][Due for payment 2026-04-14] Expense - Extra hold expense comment appears after splitting held expense[/+]melvin-bot commentedon Apr 7, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.53-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-04-14. 🎊
melvin-bot commentedon Apr 7, 2026
@luacmartins The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Apr 7, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)