Skip to content

[Due for payment 2026-01-28] Expense-Thread loads infinitely when thread is created offline via Explain button and reopened #79831

Closed

Description

@nlemma

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: 9.3.4-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #78487
Email or phone of affected tester (no customers): josidnjsoijdsodjoisjij@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with Starbucks as merchant and no category.
  4. Open the expense report.
  5. Wait for Concierge message "Set the category based on past activity..." to appear.
  6. Go offline.
  7. Click Explain.
  8. Return to the expense report.
  9. Right click on Concierge message "Set the category based on past activity..." > Reply in thread.

Expected Result:

Since thread is created in Step 7 by clicking Explain, thread will load without issue when opening the same thread via right-click menu > Reply in thread.

Actual Result:

Thread loads infinitely when thread is created via Explain button and reopened via Reply in thread option in right-click menu.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7051929_1768661965055.8.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @johncschuster

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 18, 2026
  2. melvin-bot commented on Jan 18, 2026

    @melvin-bot

    @marcaaron recently merged #78487, but they are OOO right now, so I'll auto-assign someone else.

  3. melvin-bot commented on Jan 18, 2026

    @melvin-bot

    Triggered auto assignment to @johncschuster (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.

  4. melvin-bot commented on Jan 18, 2026

    @melvin-bot

    Triggered auto assignment to @cristipaval (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  5. melvin-bot commented on Jan 18, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. github-actions commented on Jan 18, 2026

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  7. OSBotify commented on Jan 18, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #78487 - "feat: Implement "Explain" button for report actions with Concierge reasoning" by @samranahm (High confidence)
    Related Issues: None identified

    Recommendation: REVERT

    PR #78487 introduced the "Explain" button feature and refactored the navigateToAndOpenChildReport() function. The refactoring extracted a new buildOptimisticChildReport() function that is now called by both explain() and navigateToAndOpenChildReport(). This creates a race condition when a thread is created offline via the Explain button and then reopened via the "Reply in thread" context menu option.

    Labels: No label changes needed - keeping DeployBlockerCash as this is a frontend bug caused by an App PR.

    Detailed Analysis

    Evidence

    The issue is reproducible only on staging (version 9.3.4-0) and involves the new "Explain" button feature. The bug was reported against PR #78487, which was merged on 2026-01-15 and is included in the current StagingDeployCash release.

    The reproduction steps clearly show the issue occurs when:

    1. A thread is created offline via the new "Explain" button
    2. The user returns to the parent report
    3. The same thread is reopened via right-click → "Reply in thread"
    4. Result: Infinite loading

    Verification

    PR #78487 modified the following key files related to thread creation:

    • src/libs/actions/Report.ts - Refactored navigateToAndOpenChildReport() and added new explain() and buildOptimisticChildReport() functions
    • src/pages/home/report/ContextMenu/ContextMenuActions.tsx - Added "Explain" context menu action
    • src/pages/home/report/PureReportActionItem.tsx - Added "Explain" link handling in messages

    These are exactly the files involved in the thread creation and navigation flow that is failing.

    Root Cause

    The refactoring in PR #78487 introduced a new shared function buildOptimisticChildReport() that is called by both:

    1. explain() - when clicking the Explain button
    2. navigateToAndOpenChildReport() - when clicking "Reply in thread"

    The problem occurs in the following scenario:

    Step 1: Offline - Click "Explain"

    function explain(reportAction, originalReportID, ...) {
        const existingChildReport = allReports[reportAction.childReportID];  // undefined initially
        const report = existingChildReport ?? buildOptimisticChildReport(reportAction.childReportID, ...);
        if (!existingChildReport) {
            openReport(...);  // Queued while offline
        }
        Navigation.navigate(report.reportID);
        requestAnimationFrame(() => {
            addComment(report, ...);  // Adds "Please explain this to me."
        });
    }

    Step 2: Still offline - Click "Reply in thread"

    function navigateToAndOpenChildReport(childReportID, parentReportAction, parentReportID) {
        const existingChildReport = allReports[childReportID];
        const report = existingChildReport ?? buildOptimisticChildReport(childReportID, parentReportAction, parentReportID);
        
        if (!existingChildReport) {
            openReport(...);  // Called again!
        }
        
        Navigation.navigate(report.reportID);
    }

    The issue is that when buildOptimisticChildReport() is called multiple times with the same parameters but in different offline/online states, or when the report data is in an incomplete state, it can create conflicting optimistic data. The navigation then tries to load a thread that is not properly initialized, causing the infinite loading state.

    The old implementation before PR #78487 handled this differently - it had inline logic that better managed the create-once semantics for child reports. The extraction of buildOptimisticChildReport() into a reusable function inadvertently introduced this edge case where the function can be called multiple times for the same thread, especially in offline scenarios.

  8. samranahm commented on Jan 18, 2026

    @samranahm
    Contributor

    Opened PR #79845 to fix this blocker.

  9. m-natarajan commented on Jan 19, 2026

    @m-natarajan

    No Explain hyperlink, Chrome / v9.3.4-3

    Screen.Recording.2026-01-19.at.18.35.08.mp4
  10. Beamanator commented on Jan 19, 2026

    @Beamanator
    Contributor

    Noice, that means we'll close this one!

  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 21, 2026
  12. changed the title [-]Expense-Thread loads infinitely when thread is created offline via Explain button and reopened[/-] [+][Due for payment 2026-01-28] Expense-Thread loads infinitely when thread is created offline via Explain button and reopened[/+] on Jan 21, 2026
  13. melvin-bot commented on Jan 21, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Jan 21, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.5-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-01-28. 🎊

  15. melvin-bot commented on Jan 21, 2026

    @melvin-bot

    @cristipaval @johncschuster 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions