Skip to content

Old DM Message Showing GBR in LHN Without Any Action Required #69688

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


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:

  1. Log into the app and open the LHN
  2. Observe a GBR appearing next to an old DM
  3. Click into the DM
  4. The DM initially scrolls to an old completed task, then navigates to the bottom of the chat automatically
  5. 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:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

The screenshots, logs and onyx state are in OP

View all open jobs on GitHub

Activity

  1. added
    Daily
    Bug
    on Sep 2, 2025
  2. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    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.

  3. nkuoch commented on Sep 3, 2025

    @nkuoch
    Contributor

    @danielrvidal I need to know on which account (email) it happened, and which report had the GBR please

  4. danielrvidal commented on Sep 3, 2025

    @danielrvidal
    Contributor

    Let me know if you have anything else needed:

    Image
  5. nkuoch commented on Sep 3, 2025

    @nkuoch
    Contributor

    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

  6. nkuoch commented on Sep 3, 2025

    @nkuoch
    Contributor

    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
    
  7. nkuoch commented on Sep 3, 2025

    @nkuoch
    Contributor

    In focus mode, seems like the report is properly NOT returned. Bug happens in recent mode

  8. nkuoch commented on Sep 3, 2025

    @nkuoch
    Contributor

    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
    
  9. moved this to Second Cohort - MEDIUM or LOW in [#whatsnext] #migrateon Sep 3, 2025
  10. danielrvidal commented on Sep 3, 2025

    @danielrvidal
    Contributor

    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:

    1. I created a task assigned to me in a DM with @luacmartins in March 2024.
    2. We have talked a fair amount since then.
    3. I no longer see a GBR at all on his DM in my LHN.
    4. Sporadically a GBR will show up (I don't know why)
    5. 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.
    6. 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.

  11. nkuoch commented on Sep 4, 2025

    @nkuoch
    Contributor

    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.

  12. nkuoch commented on Sep 4, 2025

    @nkuoch
    Contributor

    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

  13. nkuoch commented on Sep 5, 2025

    @nkuoch
    Contributor

    Ok, seems like parentReportActionID is more reliable than parentReportID. So changing the query accordingly in this PR.

    Image

    TODO: Check if there are some rnvps with parentReportID but no parentReportActionID

    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 1;
  14. nkuoch commented on Sep 5, 2025

    @nkuoch
    Contributor

    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
    
  15. nkuoch commented on Sep 8, 2025

    @nkuoch
    Contributor

    @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).

  16. danielrvidal commented on Sep 9, 2025

    @danielrvidal
    Contributor

    Awesome this fixed mine so please feel free to close!

  17. melvin-bot commented on Sep 11, 2025

    @melvin-bot

    @nkuoch, @laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. melvin-bot commented on Sep 15, 2025

    @melvin-bot

    @nkuoch, @laurenreidexpensify Still overdue 6 days?! Let's take care of this!

  19. moved this from Second Cohort - MEDIUM or LOW to Done in [#whatsnext] #migrateon Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDaily

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions