Skip to content

Fix unread marker disappears after revealing Concierge history in side panel - #100038

Merged
mountiny merged 5 commits into
Expensify:mainfrom
software-mansion-labs:collectioneur/fix-marker
Sep 9, 2026
Merged

mountiny merged 5 commits into
Expensify:mainfrom
software-mansion-labs:collectioneur/fix-marker

Conversation

@collectioneur

@collectioneur collectioneur commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixes the "New" unread marker disappearing when Concierge hidden history is revealed via "Show history". useUnreadMarker now only advances the read watermark when the newest visible action actually advances (a bulk history reveal no longer pushes it past unread messages), ignores the synthetic Concierge greeting as a push target, and a new newMessageBoundaryTime param prevents revealed history actions from being treated as read-on-arrival.

Fixed Issues

$ #100006

Tests

  1. Send a message to Concierge so the chat has a few messages.
  2. Long-press (or right-click) one of the earlier Concierge messages and mark it as unread.
  3. Navigate to any other chat.
  4. Open the Concierge chat in the side panel.
  5. Click "Show history".
  6. Verify that the green "New" unread marker appears right above the message you marked as unread.
  • Verify that no errors appear in the JS console

Offline tests

  1. Mark an earlier Concierge message as unread while online, then go offline.
  2. Open another chat, open Concierge in the side panel, and click "Show history".
  3. Verify that the "New" unread marker appears above the marked message and remains stable while offline.

QA Steps

Same as tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-02.at.12.09.15.mov

@collectioneur

Copy link
Copy Markdown
Contributor Author

@codex review

@collectioneur collectioneur changed the title fixmarker Fix unread marker disappears after revealing Concierge history in side panel Sep 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90afad24e9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@collectioneur

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90afad24e9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@collectioneur
collectioneur marked this pull request as ready for review September 3, 2026 14:28
@collectioneur
collectioneur requested review from a team as code owners September 3, 2026 14:28
@melvin-bot
melvin-bot Bot requested review from heyjennahay and mananjadhav and removed request for a team September 3, 2026 14:28
@melvin-bot

melvin-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team September 3, 2026 14:28
const isInSidePanel = useIsInSidePanel();
const {sessionStartTime: mainDMSessionStartTime} = useConciergeSessionState();
const {sessionStartTime: sidePanelSessionStartTime} = useSidePanelState();
return isInSidePanel ? sidePanelSessionStartTime : mainDMSessionStartTime;

@mananjadhav mananjadhav Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: For visibility we use isConciergeSidePanel (useReportActionsVisibility.ts) and this hook uses isInSidePanel. Do you think this can be an issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the hook simple to avoid extra lookup. In practice, they never diverge because the hook's output is gated behind isConciergeHiddenHistory in ReportActionsList.tsx.

Since that gate guarantees it's a Concierge report, isInSidePanel effectively means the exact same thing as isConciergeSidePanel. Also in our one edge case (the #admins side panel), the gate is false, so the hook's value is just safely ignored

Comment thread tests/unit/useUnreadMarkerTest.ts Outdated
@@ -123,6 +124,117 @@ describe('useUnreadMarker', () => {
expect(result.current.unreadMarkerReportActionIndex).toBe(-1);
});

it('keeps the unread marker when Concierge hidden history is revealed at once (side panel "Show history")', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: This test is named after the side-panel "Show history" bug, but it never passes newMessageBoundaryTime, bumps the greeting to after the unread message, and needs a second rerender(fullHistory) before asserting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but these details are actually intentional! This test tests the fallback scenario when no session boundary is available.

  • The greeting tracks "now", so bumping it after the unread message simulates production. It forces the created time to go backwards, which is what our guard needs to test.
  • The second rerender(fullHistory) is required because, without a boundary, the marker legitimately doesn't show on the first render. The fix stops that first render from incorrectly pushing the read watermark, allowing the marker to appear on the next render.

I’ll rename the test to make this setup more obvious

// report.lastReadTime and would drag the watermark to "now".
const newestVisibleReportActionCreated = sortedVisibleReportActions.at(0)?.created ?? '';
const prevNewestVisibleReportActionCreated = usePrevious(newestVisibleReportActionCreated);
const mostRecentReportActionCreated = sortedVisibleReportActions.find((action) => action.reportActionID !== CONST.CONCIERGE_GREETING_ACTION_ID)?.created ?? '';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortedVisibleReportActions.find(...) runs on every render before the guards that usually skip the watermark push (isAnonymousUser, existing marker, newest created actually advanced). usePrevious must stay unconditional; the scan does not. The greeting is at index 0 when present, so this does not need a full walk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the list is newest-first, find always short-circuits at index 0 or 1. The cost is basically constant anyway, so moving it behind guards won't change performance

@mananjadhav mananjadhav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few small comments.

@collectioneur

Copy link
Copy Markdown
Contributor Author

@mananjadhav comments addressed 🙂

@mananjadhav

Copy link
Copy Markdown
Collaborator

Code changes are all fine. Testing this out.

@mananjadhav

mananjadhav commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android-unread-marker.mov
Android: mWeb Chrome
mweb-chrome-unread-marker.mov
iOS: HybridApp
ios-unread-marker.mov
iOS: mWeb Safari
mweb-safari-unread-marker.mov
MacOS: Chrome / Safari
web-unread-maker.mov

@melvin-bot
melvin-bot Bot requested a review from mountiny September 7, 2026 16:18

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me

@mountiny
mountiny merged commit 3e85d1b into Expensify:main Sep 9, 2026
35 of 37 checks passed
@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify OSBotify mentioned this pull request Sep 9, 2026
83 tasks done
@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.75-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site changes required

This PR is a bug fix that restores already-intended behavior. It adds no feature, setting, button, or user-facing copy, so nothing under docs/articles needs to change. I did not create a draft docs PR.

Why I reached that conclusion

What the PR changes: it fixes the green New unread divider disappearing when Concierge hidden history is revealed in the side panel. The change is entirely internal read-watermark logic:

The linked issue, #100006, confirms this: the expected result was already "the green New divider is visible in the side-panel chat." The PR makes the app match documented-as-intended behavior rather than changing it.

What the help site currently says: no article documents the unread New divider, marking a message as unread, or the Concierge Show history reveal. The only Concierge side-panel coverage is the generic entry point in docs/articles/new-expensify/concierge-ai/Concierge-Basics.md ("Click the Concierge icon at the top right corner of the page"), which this PR does not affect. Unread coverage elsewhere is about the Inbox Unread tab and #focus priority mode, neither of which this PR touches.

Because I wrote no article text, there were no feature names, tab names, or button labels to verify against the live UI.

One optional gap, unrelated to this PR: the message context menu actions Mark as unread / Mark as read and the New divider aren't documented anywhere on the help site, even though Chat-Features-and-Moderation-Tools.md covers neighboring actions like Edit comment and Reply in thread. That's a pre-existing gap, not something this PR created. Say the word if you'd like a docs PR for it and I'll open one.

@collectioneur, no help site PR was created because no changes are required. If you disagree — for example if Concierge Anywhere and Show history should be documented as part of this feature's rollout — reply with @MelvinBot and what you'd like covered, and I'll draft it.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants