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-10-23] [$175] [Exploratory] Lost chat messages when login same account login on third device #100791
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority
Version Number: 9.4.75-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:#99774 Email or phone of affected tester (no customers):gocemate+buzz1993@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: windows 10/chrome App Component: Chat Report View
Action Performed:
Sign in on two devices to the same account and open the same chat on both
A full ReconnectAppreplaces the report-actions collections instead of merging into them, and it is triggered account-wide over Pusher — so a device that never signed in gets its stored chat messages wiped.
The reconnectApp Pusher event is delivered on the per-account channel private-encrypted-user-accountID-<accountID> (src/libs/PusherUtils.ts:19-20, src/CONST/index.ts:2841), not a per-device one. Every signed-in device of the account receives it, regardless of which device caused it.
The handler then chooses between an incremental and a full reconnect — and only anonymous users get the safe branch (src/libs/actions/User.ts:912-922):
// Anonymous public-room sessions already have report actions from OpenReport. A full ReconnectApp// uses setCollection and clears them, which flashes the loading skeleton until GetNewerActions// refills. Pass lastUpdateID so reconnect stays incremental for anonymous users (#97847).if(isAnonymousUser()){reconnectApp(lastUpdateIDAppliedToClient);}else{reconnectApp();}
Calling reconnectApp() with no argument sets isFullReconnect = true (src/libs/actions/App.ts:496), and that response is applied unconditionally — the "this update is older than our state" guard is explicitly skipped for full reconnects (src/libs/actions/OnyxUpdates.ts:173-177). Anything the device held that is not in the payload is dropped.
Signing in on a third device is what makes the server decide some device's updateIDFrom is unservable (the event fires "when we detect that the user passed updateID is not in the DB"). The resulting reconnectApp broadcast then hits all devices, so the two devices that were chatting happily lose messages they already had.
Supporting evidence, what I verified vs. inferred, and a second (separate) bug found nearby
Verified in App code at e029fad:
The Pusher channel is per-account, so reconnectApp reaches every device of the account.
Signed-in users unconditionally take the full-reconnect branch.
A full reconnect bypasses the staleness guard and always overwrites.
App applies whatever onyxMethod the server names, with no client-side guard — set/setcollection on reportActions_ is permitted by the type (src/types/onyx/Request.ts:18-32) and passed straight to Onyx.update. setcollection removes every collection member absent from the payload.
Not verified (needs backend eyes): that the ReconnectApp response genuinely carries setcollection for reportActions_, and what makes the server emit reconnectApp when a third session is created. The comment quoted above asserts the first; I could not confirm it from this repo. That part is a backend/internal question.
Also worth noting — how a partial loss becomes a large visual loss. Report-action continuity is tracked by the separate reportActionsPages_<reportID> key, and the rendered chain is hard-truncated at the newest page's last resolvable index (src/libs/PaginationUtils.ts:449-455). If the page row shrinks or splits, everything older stops rendering even though it is still in Onyx — the repo's own test asserts this (tests/unit/PaginationUtilsTest.ts:254-284). There is no proactive gap detection; the only automatic backfill requires the chain to yield zero visible actions (src/hooks/useBackfillWhenNoVisibleActions.ts:61-90). A partially truncated chat self-heals only when the user scrolls to the end.
Separate latent bug found while auditing that path (not this issue — worth its own issue). The failure latch is only armed when the failed update's ID is still above the live watermark (src/libs/actions/OnyxUpdates.ts:249-268). The deferred-WRITE path detaches its advance from the returned promise (:277-287) with no ordering against other transports, so a higher-ID update can advance the watermark first and the later flush failure then silently fails to arm the latch. No test interposes a successful higher-ID update between a staged WRITE and its failed flush. I could not execute a reproducing Jest run in this environment, so treat this as read-only analysis.
What changes do you think we should make in order to solve the problem?
Make the signed-in branch incremental too, exactly as the anonymous branch already is — in src/libs/actions/User.ts:912-922, pass lastUpdateIDAppliedToClient to reconnectApp() for all users, and fall back to a full reconnect only when the client genuinely has no watermark. The server already returns a full payload when it cannot serve the requested range, so this keeps the recovery path intact while stopping a healthy device from discarding data it correctly holds.
Two things a reviewer should decide alongside that:
Should reconnectApp be a per-account broadcast at all? A stale updateIDFrom belongs to one device. Scoping the event to the affected device would remove the blast radius entirely. That is a backend change, so it needs an internal engineer.
Confirm the setcollection-on-reportActions_ behaviour of ReconnectApp. If the response merges rather than replaces, the wipe has a different cause and this proposal needs revisiting.
What alternative solutions did you explore? (Optional)
Guard setcollection on reportActions_ client-side. Rejected — it hides a server/client contract mismatch rather than fixing it, and would break legitimate full-refresh cases.
Make the chat view repair a truncated chain automatically by widening useBackfillWhenNoVisibleActions from "zero visible actions" to "any detected break". Worth doing as defence in depth, but it repairs the symptom after the data is already gone, so it is not the fix.
Confidence: medium. The App-side mechanism is verified line by line and the symptom matches it precisely, including why it takes a third device. I have not confirmed it with a live repro or production logs, and one link in the chain (what the server sends and what triggers the broadcast) is backend.
How to confirm in one run: reproduce with two devices chatting, open the JS console on one of them, then sign in on a third. The decisive marker is [App] isLoadingReportData set to true with command: 'ReconnectApp (full)' appearing on a device that did not sign in.
I did not find an existing open issue covering this.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/100791) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority
Activity
applause-bot commentedon Sep 10, 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/48ba01e6e8b1c7d04c1fe1ff3a55883ee29825cd4274259c45d6cf8cc7645dee
MelvinBot commentedon Sep 24, 2026
Proposal
What is the root cause of that problem?
A full
ReconnectAppreplaces the report-actions collections instead of merging into them, and it is triggered account-wide over Pusher — so a device that never signed in gets its stored chat messages wiped.The
reconnectAppPusher event is delivered on the per-account channelprivate-encrypted-user-accountID-<accountID>(src/libs/PusherUtils.ts:19-20,src/CONST/index.ts:2841), not a per-device one. Every signed-in device of the account receives it, regardless of which device caused it.The handler then chooses between an incremental and a full reconnect — and only anonymous users get the safe branch (
src/libs/actions/User.ts:912-922):Calling
reconnectApp()with no argument setsisFullReconnect = true(src/libs/actions/App.ts:496), and that response is applied unconditionally — the "this update is older than our state" guard is explicitly skipped for full reconnects (src/libs/actions/OnyxUpdates.ts:173-177). Anything the device held that is not in the payload is dropped.Signing in on a third device is what makes the server decide some device's
updateIDFromis unservable (the event fires "when we detect that the user passed updateID is not in the DB"). The resultingreconnectAppbroadcast then hits all devices, so the two devices that were chatting happily lose messages they already had.The exact same mechanism already produced a shipped bug for anonymous users: [Due for payment 2026-09-25] Public room - Public room loads infinitely after dismissing AI modal. The fix there patched only the anonymous branch.
Supporting evidence, what I verified vs. inferred, and a second (separate) bug found nearby
Verified in App code at
e029fad:reconnectAppreaches every device of the account.onyxMethodthe server names, with no client-side guard —set/setcollectiononreportActions_is permitted by the type (src/types/onyx/Request.ts:18-32) and passed straight toOnyx.update.setcollectionremoves every collection member absent from the payload.Not verified (needs backend eyes): that the
ReconnectAppresponse genuinely carriessetcollectionforreportActions_, and what makes the server emitreconnectAppwhen a third session is created. The comment quoted above asserts the first; I could not confirm it from this repo. That part is a backend/internal question.Also worth noting — how a partial loss becomes a large visual loss. Report-action continuity is tracked by the separate
reportActionsPages_<reportID>key, and the rendered chain is hard-truncated at the newest page's last resolvable index (src/libs/PaginationUtils.ts:449-455). If the page row shrinks or splits, everything older stops rendering even though it is still in Onyx — the repo's own test asserts this (tests/unit/PaginationUtilsTest.ts:254-284). There is no proactive gap detection; the only automatic backfill requires the chain to yield zero visible actions (src/hooks/useBackfillWhenNoVisibleActions.ts:61-90). A partially truncated chat self-heals only when the user scrolls to the end.Alternative explanation I considered and set aside. Count in-flight Pusher applies as applied when detecting update gaps (merged 2026-09-09, the PR linked in the report) plus the warning in [Due for payment 2026-09-25] A single rejected Pusher apply poisons pusherEventsPromise, stopping all Pusher Onyx updates for the session describe a watermark-advances-past-a-failed-update data loss path. That was closed by the
highestFailedUpdateIDlatch that shipped with the poisoned-promise fix, and it is regression-tested (tests/unit/OnyxUpdatesPusherChainFailureTest.ts:33-72). It also only explains new messages never arriving, not messages already on screen vanishing, so it does not fit this report.Separate latent bug found while auditing that path (not this issue — worth its own issue). The failure latch is only armed when the failed update's ID is still above the live watermark (
src/libs/actions/OnyxUpdates.ts:249-268). The deferred-WRITE path detaches its advance from the returned promise (:277-287) with no ordering against other transports, so a higher-ID update can advance the watermark first and the later flush failure then silently fails to arm the latch. No test interposes a successful higher-ID update between a staged WRITE and its failed flush. I could not execute a reproducing Jest run in this environment, so treat this as read-only analysis.What changes do you think we should make in order to solve the problem?
Make the signed-in branch incremental too, exactly as the anonymous branch already is — in
src/libs/actions/User.ts:912-922, passlastUpdateIDAppliedToClienttoreconnectApp()for all users, and fall back to a full reconnect only when the client genuinely has no watermark. The server already returns a full payload when it cannot serve the requested range, so this keeps the recovery path intact while stopping a healthy device from discarding data it correctly holds.Two things a reviewer should decide alongside that:
reconnectAppbe a per-account broadcast at all? A staleupdateIDFrombelongs to one device. Scoping the event to the affected device would remove the blast radius entirely. That is a backend change, so it needs an internal engineer.setcollection-on-reportActions_behaviour ofReconnectApp. If the response merges rather than replaces, the wipe has a different cause and this proposal needs revisiting.What alternative solutions did you explore? (Optional)
setcollectiononreportActions_client-side. Rejected — it hides a server/client contract mismatch rather than fixing it, and would break legitimate full-refresh cases.useBackfillWhenNoVisibleActionsfrom "zero visible actions" to "any detected break". Worth doing as defence in depth, but it repairs the symptom after the data is already gone, so it is not the fix.Confidence: medium. The App-side mechanism is verified line by line and the symptom matches it precisely, including why it takes a third device. I have not confirmed it with a live repro or production logs, and one link in the chain (what the server sends and what triggers the broadcast) is backend.
How to confirm in one run: reproduce with two devices chatting, open the JS console on one of them, then sign in on a third. The decisive marker is
[App] isLoadingReportData set to truewithcommand: 'ReconnectApp (full)'appearing on a device that did not sign in.I did not find an existing open issue covering this.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/100791)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Sep 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @nyomanjyotisa (
External)melvin-bot commentedon Sep 24, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
nyomanjyotisa commentedon Sep 24, 2026
@MelvinBot’s proposal looks good. Reproduced on staging and verified the fix locally, including recovery with an unavailable update ID.
🎀 👀 🎀 C+ reviewed
24 remaining items
melvin-bot commentedon Oct 22, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 22, 2026
Payment Summary
Resolving PRs:
Keep ReconnectApp incremental for signed-in users so other devices don't lose chat messages #102247
Reviewer: @abzokhattab owed $175 via NewDot
Reviewer: @nyomanjyotisa owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 26, 2026
Payment Summary
Contributor+: @nyomanjyotisa due $175 via NewDot
Contributor+: @abzokhattab due $175 via NewDot
trjExpensify commentedon Nov 30, 2026
approved $175 for @nyomanjyotisa