Skip to content

[Due for payment 2026-09-30] [$300] Android - Show history button is not displayed in Concierge chat #97187

Closed

Description

@applause-bot

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


Version Number: 9.4.45-1
Reproducible in staging?: Yes
Reproducible in production?: Unable to validate in Prod - Provide reasoning.
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #94814
Email or phone of affected tester (no customers): gocemate+ddfdfj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: samsung galaxy a34/16
App Component: Other

Action Performed:

Precondition: the test account has a previous chat history with Concierge.

Steps:

  1. Open the app and navigate to any conversation or workspace chat
  2. Click the search icon in the top right corner
  3. Type a query intended for Concierge (e.g. "How to connect QBD")
  4. Click "Ask Concierge" shown below the search input results
  5. Verify the side panel shows the just-sent question with "Concierge is thinking…" underneath it
  6. Wait until the reply arrives and verify the question + reply stay visible (the panel does NOT collapse to "Hi there, how can I help?")

Expected Result:

Concierge history should remain hidden until "Show history" is clicked

Actual Result:

Concierge history is not hidden, no "Show history" button

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7219136_1785181852242.Recording__1269.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7219136

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

Activity

  1. applause-bot commented on Jul 28, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/b46c62e2de4cf19492d98c3670b236d554b7b710befaf9ca1146ec74ebfe13cd

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 28, 2026
  3. MelvinBot commented on Jul 28, 2026

    @MelvinBot
    Contributor

    Proposal

    This is a QA regression of the merged PR #94814 (fix for #90974). That PR made the Concierge "hidden history" feature work correctly on the side panel, but the exact same flow on Android native goes through a different code path that still breaks.

    What is the root cause of that problem?

    On Android native there is no Concierge side panel (isSidePanelReportSupported/index.native.ts:3 is false), so "Ask Concierge" from search opens the main Concierge DM instead (useOpenConciergeAnywhere/index.native.tsx:22-26 → navigateToConciergeChat, isInSidePanel: false). That makes isConciergeMainDM = true.

    Whether history is hidden and whether the "Show history" button shows both hinge on hadUserMessageAtSessionStart, computed as hasUserMessageInLoadedSet || hasOlderActions (useConciergeSidePanelReportActions.ts:84-100). When it is false, filterActions returns all actions (no hiding) and hasPreviousMessages short-circuits to false (no button) — exactly the reported symptom.

    On the main-DM path both inputs are false at first render:

    • The main DM renders cached actions immediately — the loading skeleton is intentionally skipped when isConciergeMainDM && hasCachedReportActions (ReportActionsListContext.tsx:90-101).
    • At that first render REPORT_ACTIONS_PAGES pagination metadata is empty, so hasOlderActions (= hasNextPage) is false (PaginationUtils.ts:391-392) — even though the server has prior history.
    • The small cached window often contains no prior user message with created < sessionStartTime, so hasUserMessageInLoadedSet is also false.

    Result: hadUserMessageAtSessionStart = false → prior history is shown unfiltered and no "Show history" button appears.

    The side panel avoids this because it keeps showing the skeleton until hasOnceLoadedReportActions is true, so by the time it renders hasOlderActions is reliable. The main DM does not, which is why the regression is Android/main-DM-specific. The deeper defect is that hasOlderActions is not a reliable "unloaded prior history exists" signal — it is false whenever pagination metadata hasn't loaded yet.

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

    On the main-DM path, do not decide hadUserMessageAtSessionStart (and thus reveal all history / hide the button) until report actions have actually finished loading. Concretely: gate that decision on a reliable "loaded" signal — mirror the side panel and wait for hasOnceLoadedReportActions before falling back to "no prior history", or keep the main DM in a loading/skeleton state until the first OpenReport populates REPORT_ACTIONS_PAGES so hasOlderActions is trustworthy. The memos already depend on hasOlderActions, so once it flips to true after load, the correct hidden state will recompute.

    What alternative solutions did you explore? (Optional)

    Use a more robust "prior history exists" indicator than hasOlderActions for the main-DM case (e.g. derive it from report metadata that is known before pagination pages load), so a self-contained cached page whose lastID === PAGINATION_END_ID doesn't permanently suppress the button.

    Confidence & verification

    Medium-High. The code path and the exact failing branch are directly evidenced end-to-end; the two independent investigations agreed. Not yet confirmed on-device — an instrumented Android repro capturing hasOlderActions / REPORT_ACTIONS_PAGES length and sessionStartTime at first render vs. after OpenReport would raise this to High. This is client-side render timing, so there are no server logs to check.

    Key references:

    Related issues

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

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 28, 2026
  5. melvin-bot commented on Jul 28, 2026

    @melvin-bot

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

  6. melvin-bot commented on Jul 28, 2026

    @melvin-bot
  7. David-2002065 commented on Jul 28, 2026

    @David-2002065
    Contributor

    @thesahindia this one traces back to #94814, which I authored — it's the Android / main-DM counterpart of that same Concierge hidden-history behavior. I've left a proposal above with the root cause (confirmed against the attached recording) and the fix approach. Since I already have full context on this logic, could you assign me here?

  8. yusufdeveloper2903 commented on Jul 28, 2026

    @yusufdeveloper2903
    Contributor

    Proposal

    What is the root cause of that problem?

    The flow is Android-only because "Ask Concierge" resolves to a different surface per platform. useAskConcierge calls openConciergeAnywhere() and then addComment(...) (useAskConcierge.tsx:29-47). On web useOpenConciergeAnywhere opens the Concierge side panel (isInSidePanel: true); on native it returns isInSidePanel: false and navigateToConciergeChat navigates to the Concierge main DM:

    const openConciergeAnywhere = (_options?: {forceConcierge?: boolean}) => {
    navigateToConciergeChat(conciergeReportID, introSelected, currentUserAccountID, isSelfTourViewed, betas);
    };
    return {openConciergeAnywhere, isInSidePanel: false};

    So on Android the hidden-history view is driven by the main-DM session, whose boundary is mainDMSessionStartTime (useReportActionsVisibility.ts:74-75). That value is produced by startSession(oldestUnreadReportAction?.created):

    useLayoutEffect(() => {
    if (!isConciergeMainDM || !canStartConciergeSession) {
    return;
    }
    // Anchor the session to the unread action's created time, a stable pre-read
    // boundary, rather than the live report.lastReadTime which readNewestAction
    // bumps to `now` when the report opens. Re-runs when oldestUnreadReportAction
    // resolves so a session that locked to `now` before the anchor loaded is
    // pulled back to keep the unread message visible.
    startSession(oldestUnreadReportAction?.created);
    }, [isConciergeMainDM, startSession, canStartConciergeSession, oldestUnreadReportAction?.created]);
    // On native the component stays mounted in the navigation stack, so the
    // effect above never re-fires (its isConciergeMainDM dep is always true).
    // Re-trigger startSession when the globally-focused report matches this
    // report so the session age check runs after navigating away and back.
    useLayoutEffect(() => {
    if (!isConciergeMainDM || !canStartConciergeSession || currentReportID !== reportID) {
    return;
    }
    startSession(oldestUnreadReportAction?.created);
    }, [currentReportID, reportID, isConciergeMainDM, canStartConciergeSession, startSession, oldestUnreadReportAction?.created]);

    oldestUnreadReportAction is sortedAllReportActions.findLast((a) => a.created > initialLastReadTime), where initialLastReadTime for Concierge is firstDefinedLastReadTime = useInitial(report?.lastReadTime) — a value latched once on first render and never refreshed:

    // Default (regular inbox chats): snapshot lastReadTime at first render via a ref — production behavior.
    const firstRenderLastReadTime = useRef(report?.lastReadTime);
    // Concierge only: snapshot the first non-undefined lastReadTime. On a cold open the report can be
    // undefined on first render; useInitial waits for the first defined (pre-read) value instead of
    // latching undefined like a first-render ref, so the unread anchor can still resolve after the report loads.
    const firstDefinedLastReadTime = useInitial(report?.lastReadTime);
    const id = useMemo(() => {
    /* eslint-disable react-hooks/refs -- firstRenderLastReadTime snapshots lastReadTime at first render for a stable unread anchor */
    if (treatAsNoPaginationAnchor) {
    return undefined;
    }
    if (reportActionID) {
    return reportActionID;
    }
    if (!shouldLinkToOldestUnreadReportAction) {
    return undefined;
    }
    const initialLastReadTime = shouldSnapshotInitialLastReadTime ? firstDefinedLastReadTime : firstRenderLastReadTime.current;
    if (!initialLastReadTime || !sortedAllReportActions?.length) {
    return undefined;
    }
    return sortedAllReportActions.findLast((reportAction) => reportAction.created > initialLastReadTime)?.reportActionID;

    On native the Concierge report screen stays mounted in the navigation stack (see the comment at useStartConciergeSession.ts:46-48), so that snapshot holds a stale, pre-read lastReadTime from an earlier visit. oldestUnreadReportAction therefore points at an old, already-read action, and startSession pulls the boundary back to its created — either through the active-session pull-back or the base branch:

    // isn't hidden behind "Show full history". The session age (sessionCreatedAtRef)
    // is unchanged — only the display boundary is refined.
    if (unreadBoundary && unreadBoundary < prev) {
    return unreadBoundary;
    }
    return prev;
    }
    sessionExpired = true;
    }
    sessionCreatedAtRef.current = Date.now();
    const now = getServerAnchoredDBTime();
    if (unreadBoundary && unreadBoundary < now) {
    return unreadBoundary;
    }
    return now;

    sessionStartTime now sits earlier than the account's prior user messages. In hadUserMessageAtSessionStart the test action.created < sessionStartTime is then false for every prior user message (they are all >= the pulled-back boundary), and with the history fitting one page hasOlderActions is false, so the memo returns false:

    const hadUserMessageAtSessionStart = useMemo(() => {
    if (!isConciergeHiddenHistory || !sessionStartTime) {
    return false;
    }
    const hasUserMessageInLoadedSet = visibleReportActions.some(
    (action) => !isCreatedAction(action) && action.actorAccountID === currentUserAccountID && action.created < sessionStartTime,
    );
    return hasUserMessageInLoadedSet || hasOlderActions;
    }, [isConciergeHiddenHistory, visibleReportActions, currentUserAccountID, sessionStartTime, hasOlderActions]);

    With hadUserMessageAtSessionStart === false, filterActions returns the actions unfiltered so prior history is not hidden (useConciergeSidePanelReportActions.ts:178-180), and both showConciergeGreeting and hasPreviousMessages are gated on it (useConciergeSidePanelReportActions.ts:111-112), so ShowPreviousMessagesButton early-returns on !hasPreviousMessages (ShowPreviousMessagesButton.tsx:48-49). That is the exact symptom: history not hidden, no "Show history" button.

    Sibling contrast. On web the same query opens the side panel, whose sessionStartTime is set to getServerAnchoredDBTime() (now) by openSidePanel with no pull-back logic (SidePanelContextProvider.tsx:151-154), so prior messages are always < now, hadUserMessageAtSessionStart is true, and history hides with the button — which is why only Android reproduces. The same silence holds on native for a genuinely fresh mount, where useInitial latches the post-addComment lastReadTime (now) and no stale anchor exists; the bug needs the persisted-mount stale snapshot.

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

    We should only anchor the main-DM session to the unread action when it is still unread against the live lastReadTime, so an already-read stale anchor can no longer drag sessionStartTime behind the user's own question. In useStartConciergeSession, accept the report's current lastReadTime and gate the boundary before passing it to startSession:

    -function useStartConciergeSession({reportID, isConciergeMainDM, oldestUnreadReportAction, hasOnceLoadedReportActions, hasCachedReportActions}: UseStartConciergeSessionParams) {
    +function useStartConciergeSession({reportID, isConciergeMainDM, oldestUnreadReportAction, hasOnceLoadedReportActions, hasCachedReportActions, lastReadTime}: UseStartConciergeSessionParams) {
         ...
    +    // oldestUnreadReportAction is derived from a frozen first-render lastReadTime snapshot that, on native,
    +    // persists across navigations and can point at an already-read action. Only anchor to it while it is still
    +    // unread against the live lastReadTime; otherwise it would pull sessionStartTime before the user's own message.
    +    const unreadSessionBoundary =
    +        oldestUnreadReportAction && (!lastReadTime || oldestUnreadReportAction.created > lastReadTime) ? oldestUnreadReportAction.created : undefined;

    Then pass unreadSessionBoundary in place of oldestUnreadReportAction?.created in both startSession(...) calls (and their dependency arrays). Finally, add lastReadTime: report?.lastReadTime to the call site — report is already in scope there (ReportActionsSkeletonGuard.tsx:42-48).

    This is safe because:

    • addComment optimistically sets report.lastReadTime to the new message time (lastReadTime: currentTime, Report/index.ts:965-974), so after "Ask Concierge" the stale anchor is < lastReadTime and dropped; the session anchors to now and hides prior history with the "Show history" button, matching the web side panel.
    • A plain Concierge open with genuinely unread messages is unchanged: opening the report does not advance lastReadTime for Concierge (openReport doesn't set it and readNewestAction is task-gated), so oldestUnreadReportAction.created > lastReadTime still holds and the boundary is still passed — the pull-back keeps the notification message visible as designed (ConciergeSessionContext.tsx:82-90).
    • The cold-open fix (#93196) is preserved: while report.lastReadTime is still undefined the !lastReadTime branch keeps passing the boundary exactly as today; the guard only ever drops a boundary once the live lastReadTime proves it read.

    Note: the pull-back mechanism itself is untouched — we are not removing it, only refusing to feed it an already-read action as the boundary.

    What alternative solutions did you explore? (Optional)

    • Give the native "Ask Concierge" entry a fresh now-anchored session (mirroring openSidePanel) from useOpenConciergeAnywhere. This fails because the auto startSession in useStartConciergeSession immediately re-fires with the stale oldestUnreadReportAction, and its pull-back (unreadBoundary < prev) drags the boundary back again — the fresh anchor is undone unless the stale anchor is fixed at the source.
    • Enable firstUserMessageCreated for the main DM and hide everything before the user's question. This discards the main-DM unread-boundary behavior: genuinely unread messages that arrived before the question would be forced behind "Show history", regressing the intended notification-visible design.
  9. thesahindia commented on Jul 29, 2026

    @thesahindia
    Member

    @thesahindia this one traces back to #94814, which I authored — it's the Android / main-DM counterpart of that same Concierge hidden-history behavior. I've left a proposal above with the root cause (confirmed against the attached recording) and the fix approach. Since I already have full context on this logic, could you assign me here?

    cc: @thelullabyy

  10. thelullabyy commented on Jul 29, 2026

    @thelullabyy
    Contributor

    @dilshodmackbook-sketch Could you please confirm that whether it is our regression?

  11. David-2002065 commented on Jul 29, 2026

    @David-2002065
    Contributor

    @thesahindia thanks for checking — I looked at the #94814 diff to confirm, and I don't think this is a regression of it.

    So this is an uncovered edge of the existing main-DM behavior on the Android path (no side panel → main DM), rather than something my diff broke. My earlier "traces back to #94814" was about the same feature area, not the diff itself — sorry for the ambiguity.

    Either way I have full context on this logic, so I'm happy to own the fix; my proposal is above.

  12. 104 remaining items

  13. abbasifaizan70 commented on Oct 7, 2026

    @abbasifaizan70
    Contributor

    @blimpich fair question, and I checked it properly before answering rather than reasoning from the code alone.

    The side panel route isn't broken. On current main I opened the side panel on the Concierge chat and the "Show history" divider renders, history collapsed:

    Image

    The side panel never received the value this PR changed — useReportActionsVisibility passes conciergeShowFullHistory only when isConciergeMainDM, so the panel runs on its own local showFullHistory and hidden history has always been active there. There was nothing on that path for the fix to cover.

    What's failing is narrower than "the side panel": it's the thread that Ask Concierge now opens. With conciergeRespondInThread on, useAskConcierge generates a new report for the answer and the panel shows that thread instead of the Concierge chat, and ShowPreviousMessagesButton early-returns unless the report is the Concierge chat. Same panel, different report. That beta wasn't active when the issue was filed or when the PR was reviewed and QA'd, which is why it surfaced only in the regression pass.

    The reported Actual Result — "history is not hidden, no Show history button" — was root-caused on the main DM (hasOutstandingChildTask forcing showFullHistory), confirmed with device instrumentation from two contributors during proposal review, and that's what the PR fixed. On Android there's no side panel either, so following the issue's steps on the stated platform lands in the Concierge chat itself.

    Happy to take the thread route on, but I think it needs a product call first: a Concierge thread is a new report with no history of its own, so "Show history" there means surfacing the parent chat's history inside the thread. That's a design decision rather than a regression — want me to raise it as a separate issue?

  14. blimpich commented on Oct 8, 2026

    @blimpich
    Contributor

    Okay that does make sense. Okay in that case lets just pay out this issue and then we can ask @puneetlath about this since they are the lead on #94503

  15. mallenexpensify commented on Oct 8, 2026

    @mallenexpensify
    Contributor

    Can we close this? We already have a payment summary above
    #97187 (comment)

  16. puneetlath commented on Oct 9, 2026

    @puneetlath
    Contributor

    Happy to take the thread route on, but I think it needs a product call first: a Concierge thread is a new report with no history of its own, so "Show history" there means surfacing the parent chat's history inside the thread. That's a design decision rather than a regression — want me to raise it as a separate issue?

    If I'm understanding correctly, this is asking whether we should show a "show history" button inside of a thread off the Concierge DM? If so, I think the answer is no.

  17. abbasifaizan70 commented on Oct 10, 2026

    @abbasifaizan70
    Contributor

    @puneetlath yes, that’s exactly the question — and that answers it. Thanks.

    So the behaviour QA hit is working as intended: Ask Concierge opens a thread (conciergeRespondInThread), and ShowPreviousMessagesButton only renders in the Concierge chat itself, so no divider inside the thread is correct. Nothing further to fix here, and no separate issue needed.

    One suggestion for the regression test, since that’s where this came up (@m-natarajan): the step should be open Inbox → Concierge directly, rather than Search → “Ask Concierge”, which now lands in a thread. Precondition is an account with prior Concierge history and at least one incomplete Concierge task.

    @mallenexpensify fine to close from my side

  18. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @blimpich Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. mallenexpensify commented on Oct 13, 2026

    @mallenexpensify
    Contributor

    @abbasifaizan70 can you post the whole "Regression Test Proposal" and I'll copy/paste that over to get the test case updated? Thx

  20. abbasifaizan70 commented on Oct 14, 2026

    @abbasifaizan70
    Contributor

    Regression Test Proposal

    Precondition: a test account with prior Concierge chat history and at least one incomplete Concierge task (e.g. an onboarding task still open). The incomplete task is essential — it's what triggered the original bug.

    1. Open the app and go to Inbox → Concierge (open the Concierge chat directly; do not use Search → "Ask Concierge", which opens a thread).
    2. Verify the prior conversation is hidden, and a "Show history" divider button appears above the greeting.
    3. Verify the incomplete task still appears even though the rest of the history is hidden.
    4. Tap "Show history" and verify the full prior conversation loads.
    5. Go back, reopen Concierge, send a message to Concierge, and wait for the reply.
    6. Verify your sent message and the reply stay visible and the chat does not collapse back to "Hi there, how can I help?".
    7. Complete the pending task, reopen Concierge, and verify the completed task is now hidden with the rest of the history.
    8. Repeat steps 1–4 on an account with no pending Concierge task and verify behaviour is unchanged.
    9. On a brand-new account with only onboarding messages, open Concierge and verify all onboarding content renders and no "Show history" button appears.

    Platforms: Android, iOS, Web, Desktop.

    Note for QA: Search → "Ask Concierge" now opens a thread off the Concierge DM, and there is intentionally no "Show history" button inside a thread — confirmed by @puneetlath here. Please don't file that as a regression.

  21. m-natarajan commented on Oct 14, 2026

    @m-natarajan

    Thanks everyone, Updated the test case steps

  22. mallenexpensify commented on Oct 14, 2026

    @mallenexpensify
    Contributor
  23. laurenreidexpensify commented on Oct 27, 2026

    @laurenreidexpensify
    Contributor

    $250 Approved @thelullabyy New Expensify

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions