Skip to content

[$250] Thread - Hidden in LHN and loading header when thread reply on system message #77346

Closed

Description

@jponikarchuk

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: v9.2.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: #76209
Email or phone of affected tester (no customers): applausetester+dp301n@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:

  1. Go to workspace chat (WS chat).
  2. Create an expense.
  3. Open the expense.
  4. Click “Report”.
  5. Remove the expense from report.
  6. Go to your self DM chat.
  7. Open the “unreported expense” message.
  8. Right-click on the system message that indicates the report was moved.
  9. Submit a message in the thread.

Expected Result:

The reply message appears immediately with the correct header.
The thread is visible in the Left-Hand Navigation (LHN) as expected.

Actual Result:

After submitting the message, the header stays in “loading” mode.
The thread is hidden in the LHN.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021999592012393993056
  • Upwork Job ID: 1999592012393993056
  • Last Price Increase: 2026-03-02
Issue OwnerCurrent Issue Owner: @akinwale

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 11, 2025
  2. melvin-bot commented on Dec 11, 2025

    @melvin-bot

    Triggered auto assignment to @isabelastisser (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 12, 2025
  4. changed the title [-]Thread - Hidden in LHN and loading header when thread reply on system message[/-] [+][$250] Thread - Hidden in LHN and loading header when thread reply on system message[/+] on Dec 12, 2025
  5. melvin-bot commented on Dec 12, 2025

    @melvin-bot
  6. melvin-bot commented on Dec 12, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (External)

  7. marufsharifi commented on Dec 14, 2025

    @marufsharifi

    This seems to be a BE issue
    When adding a comment to a child thread, the backend sends an Onyx merge that first sets the parent report action to null, then merges back only child-thread metadata fields.
    This permanently removes required fields (actionName, message, originalMessage) from the parent action in Onyx, causing the report title to disappear until OpenReport rehydrates the action.

    Image
  8. melvin-bot commented on Dec 16, 2025

    @melvin-bot

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

  9. melvin-bot commented on Dec 17, 2025

    @melvin-bot

    @akinwale Huh... This is 4 days overdue. Who can take care of this?

  10. 36 remaining items

  11. Harmatta commented on Feb 7, 2026

    @Harmatta

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When replying in a thread on a system message (e.g. after unreporting an expense), the thread becomes hidden in the LHN and the thread header remains stuck in a loading state indefinitely. The reply is lost from the UI until a manual refresh or OpenReport call rehydrates the data.

    What is the root cause of that problem?

    As identified by @marufsharifi, the backend sends a two-step Onyx update sequence in response.onyxData when processing a thread reply on a system message:

    1. {[parentReportActionID]: null} — nullifies the entire parent report action
    2. {[parentReportActionID]: {childReportID: "...", childType: "chat"}} — merges back only child-thread metadata

    In src/libs/actions/OnyxUpdates.ts (around line 41), response.onyxData is applied before request.successData. Since Onyx's merge is shallow, step 1 deletes the full action object (including actionName, message, originalMessage), and step 2 creates a skeleton with only childReportID and childType.

    This breaks two downstream consumers:

    • src/libs/SidebarUtils.ts (line ~831): The LHN thread visibility check lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT fails because actionName is now undefined, so the thread disappears from the sidebar.
    • Thread header component: Depends on the parent action's actionName/message fields to render — without them, it shows an infinite loading state.

    What changes do you think we should make in order to solve the problem?

    Add a parent-action preservation step in the addActions function in src/libs/actions/Report/index.ts so that request.successData can restore the parent action after the backend response corrupts it.

    Specific implementation:

    1. In src/libs/actions/Report/index.ts — addActions() function (around lines 700-730 where successData is built):
      When the reply is to a thread whose parent is on a different report, read the current parent report action from Onyx and include its full field set in successData. After response.onyxData applies (and potentially corrupts the action), request.successData applies next and restores all required fields alongside the new child-thread metadata.

    2. Defense-in-depth in src/libs/SidebarUtils.ts (line ~831):
      Make the thread visibility check resilient to temporarily missing actionName by also checking whether the report is a thread via report.parentReportActionID:

      const isThreadMessage = isThread(report) && (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT || !!report.parentReportActionID) && lastAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
      

    This two-layer approach ensures:

    • The primary fix restores the parent action from successData after backend corruption
    • The defensive check keeps the thread visible in the LHN even during the brief window between onyxData and successData application

    What alternative solutions did you explore? (Optional)

    • Coalescing null+merge in OnyxUpdates.ts: Pre-processing response.onyxData to detect and merge sequential null-then-partial updates for the same key. Rejected because it changes infrastructure-level Onyx update behavior and risks side effects across the app.
    • Triggering OpenReport on missing fields: Adding a rehydration call when the parent action is corrupted. Rejected because it adds a network round-trip and doesn't prevent the UI flash.

    How will you test this?

    Manual (staging):

    1. Go to workspace chat, create an expense, open it, click "Report", then remove from report
    2. Go to self DM, open the "unreported expense" system message, reply in thread
    3. Verify: thread appears in LHN immediately, header renders correctly, parent action retains all fields in Onyx

    Regression:

    • Delete a comment/report action and confirm it still disappears from UI
    • Reply in a normal (non-system-message) thread and confirm behavior unchanged
    • Verify other thread reply flows (group chat, DM) are unaffected

    Automated:

    • Unit test simulating the Onyx update sequence: existing parent action → null merge → partial metadata merge → assert actionName, message, originalMessage are preserved after successData applies

    Contributor details:
    Email: storefile996@gmail.com
    Upwork: https://www.upwork.com/freelancers/~01184f546f3a74ab48

  12. melvin-bot commented on Feb 11, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  13. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  14. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    @akinwale 10 days overdue. I'm getting more depressed than Marvin.

  15. mvtglobally commented on Feb 28, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Fifth week)

  16. melvin-bot commented on Mar 2, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  17. sakluger commented on Mar 4, 2026

    @sakluger
    Contributor

    Let's request a retest.

  18. m-natarajan commented on Mar 4, 2026

    @m-natarajan

    Passed, Chrome / v9.3.31-0

    Screen.Recording.2026-03-04.at.22.52.06.mp4
  19. sakluger commented on Mar 5, 2026

    @sakluger
    Contributor

    Thanks! We can close this one since it's no longer reproducible.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions