Skip to content

[Due for payment 2026-07-02] [$250] Concierge notification email received, but corresponding message is hidden in the Concierge chat #93196

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number:
Reproducible in staging?: Needs Reproduction (Unable to receive email from Concierge for approval)
Reproducible in production?: Needs Reproduction
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @shawnborton
Slack conversation (hyperlinked to channel name): #Conciergr AI

Action Performed:

  1. Receive a email indicating a new message from Concierge regarding expense approvals.
  2. Login to NewExpensify
  3. Open the Concierge chat.
  4. Review the conversation history.

Expected Result:

The message referenced in the notification should be visible in the Concierge chat so the user can review and act on it.

Actual Result:

The Concierge chat only displays:
"Hi, how can I help?"
The Concierge message is displayed only after clicking the Show full history button

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

Screenshots/Videos

The screenshots for the issue are in Slack thread

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    InternalRequires API changes or must be handled by Expensify staff
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 10, 2026
  2. MelvinBot commented on Jun 10, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    This is the Concierge "hidden history" feature collapsing the chat to only the current session (plus the synthetic "Hi, how can I help?" greeting) and hiding everything older behind the Show full history button. The unread message referenced in the email gets caught in that collapse.

    The session boundary (sessionStartTime) is decided once when the main Concierge DM mounts, at ReportActionsView.tsx:137-143:

    startSession(oldestUnreadReportAction ? report?.lastReadTime : undefined);
    
    • If there is an unread action → the session starts at lastReadTime, so unread messages (created >= lastReadTime) stay visible. ✅
    • If oldestUnreadReportAction is falsy → the session starts at now, so every message created before this moment is treated as "previous history" and hidden. ❌

    The problem is that startSession runs in a useLayoutEffect gated on canStartConciergeSession, which flips true as soon as cached actions exist (ReportActionsView.tsx:135) — before openReport returns and oldestUnreadReportAction resolves. At that instant oldestUnreadReportAction is undefined, so the boundary locks to now. Once the session is set, it is not re-evaluated for ~2h (ConciergeSessionContext.tsx:72-93), so when the unread message finishes loading it is already on the wrong side of the boundary and stays hidden.

    Because the user has prior history, hadUserMessageAtSessionStart is true, which triggers the greeting + filtering path in useConciergeSidePanelReportActions.ts:108-165 — exactly the reported symptom: only "Hi, how can I help?" shows, and the real message appears only after Show full history.

    Evidence chain & alternative explanations considered
    • The filter that hides the message: isCurrentSessionAction keeps an action for the main DM only when action.created >= sessionStartTime (useConciergeSidePanelReportActions.ts:134-148). A message created before sessionStartTime=now fails this and is filtered out.
    • Alternative considered: lastReadTime had already advanced past the message (genuinely "read"), so oldestUnreadReportAction is legitimately null. Same end result (boundary = now, message hidden), but root cause would be read-state handling rather than mount timing. Production logs / a repro would distinguish these.
    • The startSession effect's deps are [isConciergeMainDM, startSession, canStartConciergeSession] and the oldestUnreadReportAction/lastReadTime values are captured "at mount only" (see the eslint-disable comment at ReportActionsView.tsx:142) — confirming the boundary is not recomputed when the unread action later resolves.
    • I could not reproduce this myself (the reporter also notes "Needs Reproduction — unable to receive email from Concierge"), so the mount-timing vs. read-state distinction is unconfirmed. Confidence: medium.

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

    Make the session boundary react to the unread anchor resolving instead of capturing it only at mount:

    1. When the main Concierge DM has an unread message, ensure startSession is (re-)invoked with report?.lastReadTime once oldestUnreadReportAction becomes available — not just on the initial mount when it may still be undefined. This keeps unread messages on the visible side of sessionStartTime.
    2. Alternatively / additionally, when oldestUnreadReportAction is unresolved at mount, defer starting the session until the unread state is known (rather than defaulting the boundary to now), so the boundary isn't locked prematurely.

    The fix is entirely within App/src (ReportActionsView.tsx + ConciergeSessionContext.tsx), so it does not require backend changes despite the Internal label — though confirming whether read-state (lastReadTime) is also a factor may need a backend look.

    What alternative solutions did you explore? (Optional)

    Treating any message newer than lastReadTime as in-session regardless of when the boundary was set — but that overlaps with fix (1) and risks regressing the intended "fresh session" collapse for already-read chats.

    Related issues

    Same Concierge hidden-history / Show-history cluster — worth cross-checking for shared root cause:


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93196) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 10, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 10, 2026
  5. trasnake87 commented on Jun 10, 2026

    @trasnake87
    Contributor

    Proposal

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

    After receiving an email about a new Concierge message, opening the Concierge chat shows only the synthetic greeting ("Hi, how can I help?"). The actual unread message stays hidden until the user clicks Show full history.

    What is the root cause of that problem?

    The Concierge main DM hides everything created before the "session start" boundary. That boundary is supposed to be the user's unread cutoff (lastReadTime) so unread messages render immediately. It only does this when an unread anchor exists:

    src/pages/inbox/report/ReportActionsView.tsx:141

    startSession(oldestUnreadReportAction ? report?.lastReadTime : undefined);

    When oldestUnreadReportAction is undefined, startSession falls back to now (ConciergeSessionContext.tsx:83-87). A message created moments earlier then lands before the boundary and is dropped by the session filter — main DM branch action.created >= sessionStartTime in useConciergeSidePanelReportActions.ts:139-141. Clicking Show full history sets showFullHistory=true, which short-circuits the filter at useConciergeSidePanelReportActions.ts:156, so the message reappears. That matches the symptom exactly.

    So the bug is that oldestUnreadReportAction is undefined on this flow. Its anchor is computed from a ref snapshot:

    src/hooks/usePaginatedReportActions.ts:47

    const initialReportLastReadTime = useRef(report?.lastReadTime);

    src/hooks/usePaginatedReportActions.ts:63-68

    const initialLastReadTime = initialReportLastReadTime.current;
    if (!initialLastReadTime || !sortedAllReportActions?.length) {
        return undefined;
    }
    return sortedAllReportActions.findLast((reportAction) => reportAction.created > initialLastReadTime)?.reportActionID;

    useRef(report?.lastReadTime) captures once at the first render. On the reported steps (log in → open Concierge), the Concierge report has not hydrated from disk yet at that first render, so report?.lastReadTime is undefined. The ref latches undefined and never recovers, even after lastReadTime loads (it isn't in the id deps). id permanently returns undefined → oldestUnreadReportAction is permanently undefined → boundary = now → unread message hidden.

    This is why it "needs reproduction": it only fires when the report isn't already cached at mount (cold login / notification deep-link). When Concierge is already in memory, lastReadTime is present at first render and the anchor works.

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

    Latch the first defined lastReadTime, not whatever happens to be present at first render. The codebase already has this exact pattern in src/hooks/useInitial.ts (returns the first non-undefined value).

    src/hooks/usePaginatedReportActions.ts:

    // import at top
    import useInitial from './useInitial';

    Replace line 47:

    const initialReportLastReadTime = useInitial(report?.lastReadTime);

    Update the consumer (lines 63, 70) to read the value directly and add it to the id memo deps so the anchor recomputes once lastReadTime first arrives:

    const initialLastReadTime = initialReportLastReadTime;
    ...
    }, [treatAsNoPaginationAnchor, reportActionID, shouldLinkToOldestUnreadReportAction, sortedAllReportActions, initialReportLastReadTime]);

    The react-hooks/refs eslint-disable comments around lines 50/69 can be removed since we no longer touch .current manually. This keeps the snapshot stable (still captured before openReport marks the report read) while fixing the cold-open case where it was undefined.

  6. melvin-bot commented on Jun 10, 2026

    @melvin-bot

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

  7. changed the title [-]Concierge notification email received, but corresponding message is hidden in the Concierge chat[/-] [+][$250] Concierge notification email received, but corresponding message is hidden in the Concierge chat[/+] on Jun 10, 2026
  8. melvin-bot commented on Jun 10, 2026

    @melvin-bot
  9. David-2002065 commented on Jun 10, 2026

    @David-2002065
    Contributor

    Proposal

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

    After getting an email about a new Concierge message, logging in and opening Concierge shows only the synthetic "Hi, how can I help?" greeting. The actual unread message stays hidden until Show full history is clicked.

    What is the root cause of that problem?

    The Concierge main DM hides everything created before the session boundary, and that boundary is supposed to be the user's unread cutoff (lastReadTime) so unread messages render immediately. When the unread anchor can't be resolved, startSession falls back to now:

    const now = DateUtils.getDBTime();
    if (unreadBoundary && unreadBoundary < now) {
    return unreadBoundary;
    }
    return now;

    A message created moments earlier then lands before the boundary and is dropped by the main-DM filter (action.created >= sessionStartTime):

    if (isConciergeMainDM) {
    return isCreatedAction(action) || action.created >= sessionStartTime;

    So the real question is why the unread anchor is lost on this exact flow. The anchor is derived from report?.lastReadTime, snapshotted at first render:

    const initialReportLastReadTime = useRef(report?.lastReadTime);
    const id = useMemo(() => {
    /* eslint-disable react-hooks/refs -- initialReportLastReadTime snapshots lastRead at first render for stable unread deep-link anchor */
    if (treatAsNoPaginationAnchor) {
    return undefined;
    }
    if (reportActionID) {
    return reportActionID;
    }
    if (!shouldLinkToOldestUnreadReportAction) {
    return undefined;
    }
    const initialLastReadTime = initialReportLastReadTime.current;
    if (!initialLastReadTime || !sortedAllReportActions?.length) {
    return undefined;
    }
    return sortedAllReportActions.findLast((reportAction) => reportAction.created > initialLastReadTime)?.reportActionID;

    The email→cold-login flow loses lastReadTime from both ends. On the first render the report isn't cached, so report?.lastReadTime is undefined. And by the time it hydrates, opening the report has already fired readNewestAction, which optimistically merges lastReadTime = now into the report — destroying the unread cutoff:

    const lastReadTime = getDBTimeWithSkew();
    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
    value: {
    lastReadTime,
    },
    },
    ];

    readNewestAction(report.reportID, !!reportLoadingState?.hasOnceLoadedReportActions);

    That's why "capture the first defined lastReadTime" isn't enough on its own: the first defined value the hook can observe is frequently already the post-read now written by readNewestAction. The anchor stays undefined, the boundary locks to now, and the just-arrived message is filtered out — reappearing only when Show full history bypasses the filter. It needs reproduction because a warm cache makes the pre-read lastReadTime available at first render.

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

    1. Snapshot the unread cutoff before readNewestAction overwrites it. readNewestAction already computes lastReadTime from the report's current value; capture the report's existing lastReadTime at the call sites that mark Concierge read on open (ReportActionsList.tsx:464, ReportFetchHandler.tsx:344) and feed that pre-read value into the Concierge session boundary, rather than re-reading report.lastReadTime after the optimistic merge has landed.

    2. In useConciergeSidePanelReportActions, harden the main-DM filter so a genuinely-unread action is never collapsed even if the boundary resolves late — keep actions newer than the captured pre-session cutoff:

      if (isConciergeMainDM) {
    -     return isCreatedAction(action) || action.created >= sessionStartTime;
    +     return isCreatedAction(action) || action.created >= sessionStartTime || (!!preSessionLastReadTime && action.created > preSessionLastReadTime);
      }
    1. As a complement to (1), usePaginatedReportActions should latch the first defined lastReadTime (via the existing useInitial hook) and add it to the id memo deps, so the anchor recomputes once a non-undefined cutoff first arrives instead of permanently latching undefined.

    Together this keeps the unread anchor alive across the cold-open + mark-as-read race, so the message that triggered the email renders without Show full history.

    What alternative solutions did you explore? (Optional)

    Re-invoking startSession once oldestUnreadReportAction resolves, or deferring the session start until the unread state is known. Both help, but they still read report.lastReadTime after readNewestAction has advanced it on this flow, so the boundary can still lock to now — which is why capturing the cutoff before the read merge (1) is the durable fix rather than only re-timing the session start.

  10. ReaperOAK commented on Jun 10, 2026

    @ReaperOAK
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  11. github-actions commented on Jun 10, 2026

    @github-actions
    Contributor

    ⚠️ @dilshodmackbook-sketch Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  12. github-actions commented on Jun 10, 2026

    @github-actions
    Contributor

    ⚠️ @ReaperOAK Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  13. 63 remaining items

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jun 30, 2026
  15. melvin-bot commented on Jul 1, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Jul 1, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2064760379422384270/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. mallenexpensify commented on Jul 3, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @Krishna2323 due $250 via NewDot

    ^ Test case created. Thx

  18. laurenreidexpensify commented on Jul 6, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @Krishna2323

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions