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
Old DM Message Showing GBR in LHN Without Any Action Required #69688
Version Number: Reproducible in staging?: Needs Reproduction Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@danielrvidal Slack conversation (hyperlinked to channel name): #Quality
Action Performed:
Log into the app and open the LHN
Observe a GBR appearing next to an old DM
Click into the DM
The DM initially scrolls to an old completed task, then navigates to the bottom of the chat automatically
GBR is dismissed without the user performing any action.
Expected Result:
GBR should only appear for new or unread actionable items, not old completed tasks, Opening a DM should not scroll to an old message before jumping to the bottom.
Actual Result:
GBR appears on an old DM without any actionable item, Clicking into the DM clears the GBR automatically.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Platforms Tested:
On which of our officially supported platforms was this issue tested:
Child task is STATE_MANUALREIMBURSED / STATUS_APPROVED
nkuoch@db1.lax:~$ sudo readdb.sh -tsv -risky "SELECT state, status FROM reports WHERE reportID=8589299638174046"
Only 4 quorum nodes are FOLLOWING or LEADING, more than 4 required.
You set RISKY=true in the environment so running anyways.
state status
2 3
hmmm maybe it's considering 97222345 as the parent report of 6916339587142255, because their parentReportActionID belongs to 97222345:
reportID name value
6916339587142255 parentReportActionID 7369311143570994767
And as 6916339587142255 is OPEN, it thinks it has an outstanding task.
nkuoch@db1.lax:~$ sudo readdb.sh -tsv -risky "SELECT * FROM reports WHERE reportID=6916339587142255"
created submitted approved reportID accountID managerID reportName state total currency cachedData status details
2024-03-28 19:36:19 6916339587142255 1520269 1520269 Find examples for past SL answers 00USD {"submitted":"","submittedTo":"","approved":"","unapproved":"","reimbursed":"","shared":"","type":"task","retracted":"","expensify_policyID":"_FAKE_","policyLastModified":0,"isSmartReport":false,"cacheComputedBy":1520269,"inbox":{"wasComputedInReportCache":false,"policyType":"corporate","isSubmitPolicy":false,"isClosable":false,"isApprovable":false,"isReimbursable":false,"isEmpty":true,"nextReceiver":"","hasHarvesting":false,"statementPeriodEnd":null,"hasSmartScanningReceipts":false,"reimburserEmail":null,"achEnabled":false,"achTotal":0,"integrationToExportTo":null,"hasDEW":false,"shouldSubmitToBill":false,"firstSubmittedDate":"","violations":{"oldestExpenseDate":null,"newestExpenseDate":null,"maxAge":null,"potentialRTERViolations":[],"cacheableViolationTypes":[],"ignoredWarnings":[],"hasTransactionsWithDifferentCurrency":false,"violationsReportAmount":0,"totalViolations":0},"waitingOnBankAccount":false,"hasBeenExported":false},"reimburserEmail":"daniel@expensify.com","queuedForAutoExport":{"queued":false,"connections":[],"exportFailed":false,"failedConnections":[]},"hasBeenExportedToIntegration":false,"wasReimbursedViaACH":false,"statementCardID":null,"statementBank":null,"statementPeriodEndDay":null,"isWaitingOnBankAccount":false,"isABAReimbursed":false,"expectedReimbursementDate":null,"canMarkReimbursementReceived":true,"hasReimbursableTotal":false,"hasTransactions":false,"hasBillableTransactions":false,"reportOwners":[],"managerOnVacation":"","isSmartReportOnFile":false,"invoiceID":0,"billID":0} 0 �^ZGtypeGtask�policyIDg_FAKE_
nkuoch@db1.lax:~$ sudo readdb.sh -tsv "SELECT * FROM reportActions WHERE reportID=6916339587142255"
created reportID accountID action message reportActionID
2024-03-28 19:36:19.603 6916339587142255 1520269 CREATED 1444066332781754889
2024-04-04 01:13:13.372 6916339587142255 1520269 ADDCOMMENT {"html":"Just as an fyi, I'll do this before our next meeting! I didn't get to it before I head to Japan but figured its not super time pressing.","lastModified":"2024-04-04 01:13:13.372"} 1234633336907037565
nkuoch@db1.lax:~$ sudo readdb.sh -tsv "SELECT * FROM reportNameValuePairs WHERE reportID=6916339587142255"
reportID name value
6916339587142255 lastReadTime_1520269 2024-04-04 01:13:13.372
6916339587142255 notificationPreferences {"1520269":"always"}
6916339587142255 parentReportActionID 7369311143570994767
So after diagnosing this with @nkuoch it looks like I did have a assigned task that is not actually checked off, so the bug is actually that there is an incomplete task that is not generating a GBR in my Inbox LHN.
To rewrite up the steps:
I created a task assigned to me in a DM with @luacmartins in March 2024.
We have talked a fair amount since then.
I no longer see a GBR at all on his DM in my LHN.
Sporadically a GBR will show up (I don't know why)
When I click into it when seeing the GBR, it takes me to a task that I created on May 17 2025 and have since completed.
It quickly loads and then goes to the bottom of our chat.
So the expected behavior should be that I always see the GBR in our DM because the task is not complete from Mar 2024, rather than showing up sporadically.
Report 97222345 is returning with GBR when in recent mode or when calling GetChats, but not when in focus mode (which uses another logic, directly at query level). In focus mode, it's not returning because 6916339587142255 doesn't have a parentReportID NVP (but maybe it should have and this is the bug?). It does have a parentReportActionID belonging to 6916339587142255 though.
Asking Chirag if it is valid to have a reportA with a parentReportActionID NVP pointing to an action belonging to a reportB that is not listed as the parentReportID NVP of reportA
Ok, seems like parentReportActionID is more reliable than parentReportID. So changing the query accordingly in this PR.
TODO: Check if there are some rnvps with parentReportID but no parentReportActionID
SELECTr.created, p.*FROM reportNameValuePairs p INNER JOIN reports r ON (p.reportID=r.reportID) LEFT JOIN reportNameValuePairs a ON (p.reportID=a.reportIDANDa.name='parentReportActionID') WHEREp.name='parentReportID'ANDa.reportID IS NULLLIMIT1;
Report with parentReportActionID NVP but without parentReportID NVP:
Count:
nkuoch@db1.lax:~$ sudo readdb.sh -tsv "SELECT COUNT(1), MAX(created) FROM reportNameValuePairs p INNER JOIN reports r ON (p.reportID = r.reportID) LEFT JOIN reportNameValuePairs a ON (p.reportID = a.reportID AND a.name = 'parentReportActionID') WHERE p.name = 'parentReportID' AND a.reportID IS NULL;"
COUNT(1) MAX(created)
32164 2025-09-05 06:34:56
Oldest:
nkuoch@db1.lax:~$ sudo readdb.sh -tsv "SELECT r.created, p.* FROM reportNameValuePairs p INNER JOIN reports r ON (p.reportID = r.reportID) LEFT JOIN reportNameValuePairs a ON (p.reportID = a.reportID AND a.name = 'parentReportActionID') WHERE p.name = 'parentReportID' AND a.reportID IS NULL LIMIT 10;"
created reportID name value
2017-10-08 16:54:23 24510751 parentReportID 410842222604009
2020-01-03 08:23:47 56063197 parentReportID 551207305462122
2020-01-09 22:05:57 56389910 parentReportID 830032927328277
2021-05-11 09:21:18 73771213 parentReportID 65311326
2021-05-11 09:58:58 73771688 parentReportID 64233822
2021-05-12 08:24:54 73827602 parentReportID 73826698
2021-05-12 17:35:30 73842343 parentReportID 72962098
2021-05-12 19:49:46 73847679 parentReportID 64224791
2021-05-12 19:54:21 73847842 parentReportID 73847843
2021-05-13 13:46:52 73884313 parentReportID 68000217
Newest:
nkuoch@db1.lax:~$ sudo readdb.sh -tsv "SELECT r.created, p.* FROM reportNameValuePairs p INNER JOIN reports r ON (p.reportID = r.reportID) LEFT JOIN reportNameValuePairs a ON (p.reportID = a.reportID AND a.name = 'parentReportActionID') WHERE p.name = 'parentReportID' AND a.reportID IS NULL ORDER BY created DESC LIMIT 10;"
created reportID name value
2025-09-05 06:34:56 3934487636960566 parentReportID 6712317956780328
2025-09-05 06:34:55 2271711286261257 parentReportID 5985920716225133
2025-09-05 06:29:57 1229849679877988 parentReportID 5594914106440413
2025-09-05 06:29:14 4628651883514232 parentReportID 2686083469131540
2025-09-05 06:18:45 3017126315235636 parentReportID 2802112353752900
2025-09-05 02:09:12 324524504978925 parentReportID 5195910023177706
2025-09-05 02:05:40 3717290280591975 parentReportID 6659720354236184
2025-09-04 19:30:21 5377711043540265 parentReportID 3220990806920562
2025-09-04 19:26:30 6218520359606210 parentReportID 6506275684826293
2025-09-04 18:01:26 465651149949910 parentReportID 3235688002080350
@danielrvidal In https://github.com/Expensify/Auth/pull/17044, I'm fixing your chat sometimes not being displayed as GBR in LHN in focus mode. Once it's deployed, let me know if you still have any issue, like not being redirect to the right task when clicking on the chat (which may still happen, as I didn't try to fix anything about it).
Activity
melvin-bot commentedon Sep 2, 2025
Triggered auto assignment to @laurenreidexpensify (
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.nkuoch commentedon Sep 3, 2025
@danielrvidal I need to know on which account (email) it happened, and which report had the GBR please
danielrvidal commentedon Sep 3, 2025
Let me know if you have anything else needed:
nkuoch commentedon Sep 3, 2025
Indeed when openin OpenApp from this account, I see for this report
hasOutstandingChildTask=true"report_97222345":{"avatarUrl":null,"chatReportID":null,"chatType":"","currency":"USD","description":"","errorFields":{"export":null,"notFound":null},"fieldList":null,"hasOutstandingChildRequest":false,"hasOutstandingChildTask":true,"hasParentAccess":null,"invoiceReceiver":null,"iouReportID":null,"isCancelledIOU":false,"isDeletedParentAction":null,"isOwnPolicyExpenseChat":false,"isPinned":false,"isWaitingOnBankAccount":false,"lastActionType":"ADDCOMMENT","lastActorAccountID":"10185791","lastMentionedTime":"2025-03-17 17:15:23.814","lastMessageHtml":"MESSAGE_REDACTED","lastMessageText":"MESSAGE_REDACTED","lastReadSequenceNumber":3,"lastReadTime":"2025-07-23 21:41:08.422","lastVisibleActionCreated":"2025-07-23 21:20:31.576","lastVisibleActionLastModified":"2025-07-23 21:20:31.576","managerID":0,"nonReimbursableTotal":0,"oldPolicyName":"","ownerAccountID":0,"parentReportActionID":null,"parentReportID":null,"participants":{"10185791":{"notificationPreference":"always"},"1520269":{"notificationPreference":"always"}},"permissions":["read","write"],"policyAvatar":null,"policyID":"_FAKE_","policyName":null,"private_isArchived":"","reportID":"97222345","reportName":"Chat Report","stateNum":0,"statusNum":0,"total":0,"tripData":null,"type":"chat","unheldNonReimbursableTotal":0,"unheldTotal":0,"visibility":null,"welcomeMessage":"","writeCapability":"all"}Looking
nkuoch commentedon Sep 3, 2025
Child task is STATE_MANUALREIMBURSED / STATUS_APPROVED
nkuoch commentedon Sep 3, 2025
In focus mode, seems like the report is properly NOT returned. Bug happens in recent mode
nkuoch commentedon Sep 3, 2025
hmmm maybe it's considering 97222345 as the parent report of 6916339587142255, because their parentReportActionID belongs to 97222345:
And as 6916339587142255 is OPEN, it thinks it has an outstanding task.
danielrvidal commentedon Sep 3, 2025
So after diagnosing this with @nkuoch it looks like I did have a assigned task that is not actually checked off, so the bug is actually that there is an incomplete task that is not generating a GBR in my Inbox LHN.
To rewrite up the steps:
So the expected behavior should be that I always see the GBR in our DM because the task is not complete from Mar 2024, rather than showing up sporadically.
nkuoch commentedon Sep 4, 2025
Report 97222345 is returning with GBR when in recent mode or when calling GetChats, but not when in focus mode (which uses another logic, directly at query level). In focus mode, it's not returning because 6916339587142255 doesn't have a parentReportID NVP (but maybe it should have and this is the bug?). It does have a parentReportActionID belonging to 6916339587142255 though.
nkuoch commentedon Sep 4, 2025
Asking Chirag if it is valid to have a reportA with a parentReportActionID NVP pointing to an action belonging to a reportB that is not listed as the parentReportID NVP of reportA
nkuoch commentedon Sep 5, 2025
Ok, seems like parentReportActionID is more reliable than parentReportID. So changing the query accordingly in this PR.
TODO: Check if there are some rnvps with parentReportID but no parentReportActionID
nkuoch commentedon Sep 5, 2025
Report with parentReportActionID NVP but without parentReportID NVP:
Count:
Oldest:
Newest:
nkuoch commentedon Sep 8, 2025
@danielrvidal In https://github.com/Expensify/Auth/pull/17044, I'm fixing your chat sometimes not being displayed as GBR in LHN in focus mode. Once it's deployed, let me know if you still have any issue, like not being redirect to the right task when clicking on the chat (which may still happen, as I didn't try to fix anything about it).
danielrvidal commentedon Sep 9, 2025
Awesome this fixed mine so please feel free to close!
melvin-bot commentedon Sep 11, 2025
@nkuoch, @laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Sep 15, 2025
@nkuoch, @laurenreidexpensify Still overdue 6 days?! Let's take care of this!