Skip to content

GBR persists on old policy expense chats with no actionable items #84337

@mountiny

Description

@mountiny

Problem

Old policy expense chats show a persistent GBR (Green Brick Road) indicator in the LHN, but the user cannot take any action on them. When navigating to the report, there are no actionable items visible.

Root Cause

There is a data availability mismatch between the backend and the frontend:

  1. Backend (Auth) computes hasOutstandingChildRequest: true on policy expense chats by querying for linked child expense/IOU reports in OPEN or SUBMITTED state via Report::getLinkedOutstandingReports() and Report::isAwaitingActionFromCurrentUser(). For old policies, there are stale child reports that genuinely need action according to the database.

  2. Frontend (App) trusts the hasOutstandingChildRequest flag alone to show GBR in getReasonAndReportActionThatRequiresAttention() (src/libs/ReportUtils.ts line 4289). The condition (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) means the flag alone is sufficient.

  3. However, the actual child report data (REPORT_PREVIEW actions) is not present in local Onyx because those old report actions are not included in the initial data sync (likely due to pagination). The user sees a GBR but has no way to interact with the underlying child reports.

Observed Behavior

  • Two policy expense chats for old policies show GBR in LHN
  • Clicking into them reveals no actionable content
  • Debug mode shows the reports have hasOutstandingChildRequest: true but total: 0, transactionCount: 0
  • The child expense reports causing the flag are not loaded in local Onyx

Expected Behavior

Either:

  • The child report data should be sent to the client alongside the flag so the user can act on it, OR
  • The GBR should not show if there are no actionable items available in the client

Relevant Code

Backend (Auth):

  • Auth/auth/lib/Report.cpp - getLinkedOutstandingReports() (line ~12401), batchHasOutstandingChildRequest() (line ~12449), setLinkedReportFields (line ~12345), getAccountIDAwaitingAction() (line ~11557)

Frontend (App):

  • src/libs/ReportUtils.ts - getReasonAndReportActionThatRequiresAttention() (line ~4289)
  • src/libs/actions/IOU/index.ts - getIOUReportActionToApproveOrPay() (line ~10543)
  • src/libs/actions/OnyxDerived/configs/reportAttributes.ts - derives brickRoadStatus (line ~193)

Example Report Data

{
    "chatType": "policyExpenseChat",
    "hasOutstandingChildRequest": true,
    "isOwnPolicyExpenseChat": true,
    "total": 0,
    "transactionCount": 0,
    "policyName": "zInactive-Free Lunch",
    "reportID": "5231722064997962",
    "stateNum": 0,
    "statusNum": 0,
    "private_isArchived": ""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions