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-10] [$500] LHN - Report Remains Marked as Unread After Returning Online Despite Message Being Read Offline #79837
Version Number: v9.3.4-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:#79632 Email or phone of affected tester (no customers):applausetester+dp501@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac / Safari App Component: Left Hand Navigation (LHN)
Action Performed:
Create a report with multiple expense items.
Open the report.
Switch the app to offline mode.
Send several messages within the report.
Mark the last message as unread.
Navigate to the Inbox, then reopen the same report so the message becomes marked as read.
Open any other report.
Switch the app back online.
Expected Result:
The report should be displayed as read in the LHN, since the message was opened and read before going online.
Actual Result:
After returning online, the report is displayed as unread (bold) in the LHN, even though the message was previously read.
changed the title [-]LHN - Report Remains Marked as Unread After Returning Online Despite Message Being Read Offline[/-][+][$250] LHN - Report Remains Marked as Unread After Returning Online Despite Message Being Read Offline[/+]on Jan 22, 2026
Please re-state the problem that we are trying to solve in this issue.
In the OP repro, a report is read while offline after offline-authored messages exist, but after reconnect it can appear unread again in LHN. The correct behavior is: messages the user already read before reconnect must stay read, while another participant's genuinely unseen message in the same report must still remain unread.
What is the root cause of that problem?
The current unread model relies on replay-time transport timestamps instead of a canonical unread timestamp.
readNewestAction() snapshots a single lastReadTime value and bakes it into the queued request when the user reads the report offline:
That works only if created is already the correct unread boundary. In this issue it is not, because offline-authored visible actions can receive newer server created timestamps when they replay online, while the queued read boundary remains the older offline value.
As pointed out, swapping steps 3 and 4 makes the bug disappear. That only makes sense if the problem is tied to when the action timestamps become canonical: when messages are sent online first, the server timestamps already exist before the read boundary is captured.
Also, as regression case shows, any fix that simply bumps the read boundary forward or hides unread based on actor identity can auto-read another user's unseen message in the same report. So the real problem is not “self-authored messages should be treated as read”. The real problem is that unread semantics currently infer correctness from replay-time created values, while the frontend needs a canonical unread timestamp that survives offline replay.
What changes do you think we should make in order to solve the problem?
The current implementation keeps ordering and sorting on created, but changes unread semantics to consume canonical unread timestamps when available, with full fallback to today's fields until backend support lands. Below are the local diffs from the current implementation.
1. Add optional canonical unread-time fields to the FE contract.
This gives unread logic a dedicated source-of-truth without changing request payloads or sorting behavior.
diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts
@@
/** The time of the last message on the report */
lastVisibleActionCreated?: string;
++ /** The canonical event time of the last visible action, used for unread semantics */+ lastVisibleActionOccurredAt?: string;diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts
@@
/** ISO-formatted datetime */
created: string;
++ /** Canonical event time used for unread semantics */+ occurredAt?: string;diff --git a/src/types/utils/whitelistedReportKeys.ts b/src/types/utils/whitelistedReportKeys.ts
@@
lastVisibleActionCreated: unknown;
+ lastVisibleActionOccurredAt: unknown;
2. Route report-level and action-level unread checks through shared fallback helpers.
This keeps unread semantics centralized instead of letting each caller compare against replay-time created directly.
3. Update unread consumers to use the effective unread timestamp, while keeping ordering on created.
This changes only unread-marker time, app-visibility read logic, and unread badges. It does not turn occurredAt into a new list-sorting field.
4. Keep action-side read/unread operations consistent with the same helper.
This is not a queue fix. It simply makes manual unread and delayed-notification logic respect the same effective unread timestamp used everywhere else.
diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts
@@
- (!latest || current.created > latest.created) &&+ (!latest || ReportActionsUtils.getReportActionOccurredAt(current) > ReportActionsUtils.getReportActionOccurredAt(latest)) &&
@@
- const actionCreationTime =- reportAction?.created || (latestReportActionFromOtherUsers?.created ?? getReportLastVisibleActionCreated(report, transactionThreadReport) ?? DateUtils.getDBTime(0));+ const actionCreationTime =+ ReportActionsUtils.getReportActionOccurredAt(reportAction) ||+ ReportActionsUtils.getReportActionOccurredAt(latestReportActionFromOtherUsers) ||+ getReportLastVisibleActionOccurredAt(report, transactionThreadReport) ||+ DateUtils.getDBTime(0);
@@
- if (action && report?.lastReadTime && report.lastReadTime >= action.created) {- Log.info(`${tag} No notification because the comment was already read`, false, {created: action.created, lastReadTime: report.lastReadTime});+ const actionOccurredAt = ReportActionsUtils.getReportActionOccurredAt(action);+ if (action && report?.lastReadTime && report.lastReadTime >= actionOccurredAt) {+ Log.info(`${tag} No notification because the comment was already read`, false, {occurredAt: actionOccurredAt, created: action.created, lastReadTime: report.lastReadTime});
return false;
}
5. Add focused tests that prove precedence and fallback behavior.
These tests verify the new canonical field precedence without changing unrelated ordering behavior.
diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts
@@
+ it('should prefer lastVisibleActionOccurredAt when determining whether a report is unread', () => {+ const report = {+ reportID: '1',+ lastMessageText: 'Test message',+ lastReadTime: '2024-01-01 10:00:00.000',+ lastVisibleActionCreated: '2024-01-01 10:05:00.000',+ lastVisibleActionOccurredAt: '2024-01-01 09:59:59.999',+ } as OnyxTypes.Report;++ expect(ReportUtils.isUnread(report, undefined, undefined)).toBe(false);+ });++ it('should fall back to lastVisibleActionCreated when no canonical unread time is available', () => {+ const report = {+ reportID: '1',+ lastMessageText: 'Test message',+ lastReadTime: '2024-01-01 10:00:00.000',+ lastVisibleActionCreated: '2024-01-01 10:05:00.000',+ } as OnyxTypes.Report;++ expect(ReportUtils.isUnread(report, undefined, undefined)).toBe(true);+ });diff --git a/tests/unit/ReportActionsUtilsTest.ts b/tests/unit/ReportActionsUtilsTest.ts
@@
+ describe('isReportActionUnread', () => {+ it('should prefer occurredAt when available', () => {+ const reportAction = {+ actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT,+ created: '2024-01-01 10:05:00.000',+ occurredAt: '2024-01-01 10:00:00.000',+ message: [{type: 'COMMENT', html: 'Test', text: 'Test'}],+ reportActionID: '1',+ shouldShow: true,+ } as ReportAction;++ expect(ReportActionsUtils.isReportActionUnread(reportAction, '2024-01-01 10:02:00.000')).toBe(false);+ expect(ReportActionsUtils.isReportActionUnread(reportAction, '2024-01-01 09:59:59.999')).toBe(true);+ });++ it('should fall back to created when occurredAt is missing', () => {+ const reportAction = {+ actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT,+ created: '2024-01-01 10:05:00.000',+ message: [{type: 'COMMENT', html: 'Test', text: 'Test'}],+ reportActionID: '1',+ shouldShow: true,+ } as ReportAction;++ expect(ReportActionsUtils.isReportActionUnread(reportAction, '2024-01-01 10:04:59.999')).toBe(true);+ expect(ReportActionsUtils.isReportActionUnread(reportAction, '2024-01-01 10:05:00.000')).toBe(false);+ });+ });
Why this is best practice. This fixes unread behavior at the source-of-truth unread layer instead of masking it in the UI or mutating one specific queued API request. It avoids unique client-side handling for ReadNewestAction, does not mutate queued transport requests, does not hide unread based on actor identity, and remains backward compatible until backend data is available.
Backend dependency. The FE implementation is already safe because every helper falls back to created / lastVisibleActionCreated when the new fields are absent. To fully solve the issue, backend still needs to emit ReportAction.occurredAt and Report.lastVisibleActionOccurredAt in HTTPS and Pusher onyxData, deriving them from a canonical event-time source. For client-authored visible actions, that canonical time should come from validated clientCreatedTime when available, otherwise fall back to server created. No FE request shape changes are needed.
What alternative solutions did you explore? (Optional)
⚠️@marufsharifi Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Job price $500, taken from the title. This is the only issue in today's batch above the standard amount, and the percentage runs off $500, not off the standard price.
Both payees 100%. No reduction applies. The checklist is complete with evidence on all five platforms.
No regression cut.#100257 was auto-linked here and has been traced elsewhere to Mobile-Expensify#14097, with @JS00001 calling it an "Unrelated blocker".
No increase. 2 files and +326 lines sit below the 25 file and 1000 line thresholds.
Note on the rail.@abbasifaizan70 is a Contributor, so the block above says "paid via Upwork". Change it to NewDot if he is not on an Upwork contract.
There is no Melvin payment summary on this issue. The payees above come from the assignees and the posted checklist. Worth a sanity check before paying.
Claude posting on behalf of Matt. PAYRUBRICTEST v2
Activity
melvin-bot commentedon Jan 18, 2026
Triggered auto assignment to @stephanieelliott (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.[-]LHN - Report Remains Marked as Unread After Returning Online Despite Message Being Read Offline[/-][+][$250] LHN - Report Remains Marked as Unread After Returning Online Despite Message Being Read Offline[/+]melvin-bot commentedon Jan 22, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022014478668144857937
melvin-bot commentedon Jan 22, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)marufsharifi commentedon Jan 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the OP repro, a report is read while offline after offline-authored messages exist, but after reconnect it can appear unread again in LHN. The correct behavior is: messages the user already read before reconnect must stay read, while another participant's genuinely unseen message in the same report must still remain unread.
What is the root cause of that problem?
The current unread model relies on replay-time transport timestamps instead of a canonical unread timestamp.
readNewestAction()snapshots a singlelastReadTimevalue and bakes it into the queued request when the user reads the report offline:App/src/libs/actions/Report/index.ts
Lines 2288 to 2313 in 84815b8
lastReadTimeonly againstlastVisibleActionCreated:App/src/libs/ReportUtils.ts
Lines 9011 to 9029 in 84815b8
lastReadTimeonly againstreportAction.created:App/src/libs/ReportActionsUtils.ts
Lines 2463 to 2468 in 84815b8
createdtimestamps in the two report action lists:1_
App/src/pages/inbox/report/ReportActionsList.tsx
Lines 339 to 440 in 84815b8
2_
App/src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx
Lines 391 to 625 in 84815b8
That works only if
createdis already the correct unread boundary. In this issue it is not, because offline-authored visible actions can receive newer servercreatedtimestamps when they replay online, while the queued read boundary remains the older offline value.As pointed out, swapping steps 3 and 4 makes the bug disappear. That only makes sense if the problem is tied to when the action timestamps become canonical: when messages are sent online first, the server timestamps already exist before the read boundary is captured.
Also, as regression case shows, any fix that simply bumps the read boundary forward or hides unread based on actor identity can auto-read another user's unseen message in the same report. So the real problem is not “self-authored messages should be treated as read”. The real problem is that unread semantics currently infer correctness from replay-time
createdvalues, while the frontend needs a canonical unread timestamp that survives offline replay.What changes do you think we should make in order to solve the problem?
The current implementation keeps ordering and sorting on
created, but changes unread semantics to consume canonical unread timestamps when available, with full fallback to today's fields until backend support lands. Below are the local diffs from the current implementation.1. Add optional canonical unread-time fields to the FE contract.
This gives unread logic a dedicated source-of-truth without changing request payloads or sorting behavior.
2. Route report-level and action-level unread checks through shared fallback helpers.
This keeps unread semantics centralized instead of letting each caller compare against replay-time
createddirectly.3. Update unread consumers to use the effective unread timestamp, while keeping ordering on
created.This changes only unread-marker time, app-visibility read logic, and unread badges. It does not turn
occurredAtinto a new list-sorting field.4. Keep action-side read/unread operations consistent with the same helper.
This is not a queue fix. It simply makes manual unread and delayed-notification logic respect the same effective unread timestamp used everywhere else.
5. Add focused tests that prove precedence and fallback behavior.
These tests verify the new canonical field precedence without changing unrelated ordering behavior.
Why this is best practice. This fixes unread behavior at the source-of-truth unread layer instead of masking it in the UI or mutating one specific queued API request. It avoids unique client-side handling for
ReadNewestAction, does not mutate queued transport requests, does not hide unread based on actor identity, and remains backward compatible until backend data is available.Backend dependency. The FE implementation is already safe because every helper falls back to
created/lastVisibleActionCreatedwhen the new fields are absent. To fully solve the issue, backend still needs to emitReportAction.occurredAtandReport.lastVisibleActionOccurredAtin HTTPS and PusheronyxData, deriving them from a canonical event-time source. For client-authored visible actions, that canonical time should come from validatedclientCreatedTimewhen available, otherwise fall back to servercreated. No FE request shape changes are needed.What alternative solutions did you explore? (Optional)
github-actions commentedon Jan 24, 2026
marufsharifi commentedon Jan 24, 2026
Solution demo:
ProposalDemo.mp4
181 remaining items
melvin-bot commentedon Sep 9, 2026
Current assignee @mallenexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.
melvin-bot commentedon Sep 14, 2026
@mallenexpensify Eep! 4 days overdue now. Issues have feelings too...
mallenexpensify commentedon Sep 14, 2026
Claude posting on behalf of Matt:
$500 to @abbasifaizan70 (Contributor) and $500 to @situchan (Contributor+).
To pay, copy this block and paste it into the comment box:
How the amount is reached
Note on the rail. @abbasifaizan70 is a Contributor, so the block above says "paid via Upwork". Change it to NewDot if he is not on an Upwork contract.
There is no Melvin payment summary on this issue. The payees above come from the assignees and the posted checklist. Worth a sanity check before paying.
Claude posting on behalf of Matt.
PAYRUBRICTEST v2mallenexpensify commentedon Sep 15, 2026
Payment Summary
Contributor: @abbasifaizan70 paid $500 via Upwork
Contributor+: @situchan due $500 via NewDot
@abbasifaizan70 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022099659017576756604
abbasifaizan70 commentedon Sep 15, 2026
@mallenexpensify offer accepted but it was for 250. submitted for payment
mallenexpensify commentedon Sep 15, 2026
@abbasifaizan70 paid $500, summary updated above. Thx.
laurenreidexpensify commentedon Sep 28, 2026
Approved $500 @situchan New Expensify