Skip to content

[Due for payment 2026-11-07] [$175] LHN - #admin room already read after signed up as "submit expense to my employer" intention #101182

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.78-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: https://test-management.browserstack.com/projects/2219752/test-runs/73892537/folder/13176724/41237069/1758021327?sort=%2Bidentifier
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: iPhone 13 / iOS 27 Beta / Safari, Samsung Galaxy A52 / Android 14 / Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

Preconditions: Uninstall Expensify from your device

Steps:

  1. Search for "Expensify" on Safari / Chrome
  2. Click on the Expensify search result
  3. Change the URL to staging so we can test this in the test environment
  4. On the Expensify Homepage - select Organize my own expenses
  5. Enter a public domain account in the email/phone number field (without +)
  6. Click on Get Started
  7. Click on Join
  8. Click on "Submit expenses to my employer" from the intent selector on ND
  9. Enters a first and last name
  10. Click Continue
  11. Navigate to Inbox

Expected Result:

the #admins conversation is unread on mobile web

Actual Result:

the #admins conversation is already read on mobile web. on Android chrome, it displayed as unread briefly then immediately changed to read state

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7259920_1789438569770.IMG_8176.1.mp4

View all open jobs on GitHub

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

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

Activity

  1. added
    Daily
    Bug
    on Sep 15, 2026
  2. applause-bot commented on Sep 15, 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/71c0734c0da54a5a676ee4a4e91e67b3a887da0636cbe0ac79168d07cddc7819

  3. MelvinBot commented on Sep 15, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    After onboarding with "Submit expenses to my employer", the app points the web-only Side Panel at the brand-new #admins room. The Side Panel mounts a full ReportScreen for that room, and useMarkAsRead's one-shot mount effect marks the report read with no visibility or focus gate at all — so #admins gets marked read without the user ever opening it.

    The two links in the chain:

    1. src/libs/navigateAfterOnboarding.ts:147-158 — this intent's exit path sets ONBOARDING_RHP_VARIANT.RHP_ADMINS_ROOM and calls openSidePanel(). The variant makes SidePanelContextProvider.tsx:88-96 resolve the panel's reportID to activePolicy.chatReportIDAdmins, and SidePanelReport/index.tsx:24 renders a real ReportScreen for it.

    2. src/hooks/useMarkAsRead.ts:166-183 — the mount effect calls readNewestAction as soon as the list mounts. Its only guards are hasNewerActions || !isScrolledToEnd. Compare the report-change path just below it at :202, which correctly requires isVisible && Visibility.hasFocus(). Any mount of that list marks the room read, visible or not.

    This also explains the reported platform matrix exactly. Native is structurally exempt — RootNavigatorExtraContent/index.native.tsx never renders <SidePanel> and isSidePanelReportSupported/index.native.ts:3 returns false. So the bug is web-only, matching iOS/Android App being unchecked in the report.

    The #admins room is genuinely unread for a moment first: buildOptimisticChatReport creates it already-read (lastReadTime === lastVisibleActionCreated), then the server pushes the Concierge welcome message, which makes it unread — and the mount effect immediately consumes it. That round trip is the "unread briefly, then flips to read" flash on Android Chrome.

    Supporting detail: why it fires on a phone, and how the guards got weaker

    The narrow-screen path is a secondary defect. navigateAfterOnboarding.ts:157 calls openSidePanel(!shouldUseNarrowLayout) intending "don't show the panel on phones". But SidePanel.ts:11-15 only sets openNarrowScreen: true on the truthy branch — it never clears it on the falsy one. Since NVP_SIDE_PANEL is a server-persisted NVP and useSidePanelDisplayStatus.tsx:21 reads openNarrowScreen on non-XL screens, a stale true silently defeats the intent and the panel does open on mWeb. Note RHPVariantTest/index.ts:74,88 hardcode openSidePanel(true) for other onboarding variants — on phones too. There is also a brief mount window even when hidden: SidePanel/index.tsx:29 bails only when isSidePanelTransitionEnded && shouldHideSidePanel.

    Guard history. The ungated mount mark-as-read was introduced by #51366 (f32cd9fb45dd609ecc6bd887695a0437dc073e8c), moved verbatim into useMarkAsRead.ts by #91179, and only partially fenced by #100025 (merged 2026-09-15, i.e. after the reported 9.4.78-0 build). #100025 added shouldRequireScreenFocus, but it is passed only by MoneyRequestReportActionsList.tsx:314-324 — the chat list at ReportActionsList.tsx:200-206 leaves it at the false default, and even where it is passed it is only checked on the report-change path, never on mount.

    Alternatives considered and ruled out in code. Nothing in onboarding, OpenApp/ReconnectApp handling, or the LHN marks a report read — readNewestAction for a chat room requires a mounted ReportActionsList. prepareOnboardingOnyxData never writes lastReadTime. On narrow layout SplitRouter.ts:107 does not push the central REPORT screen, so the Inbox itself cannot mount #admins. One non-lastReadTime alternative remains possible but unconfirmed: SidebarUtils.ts:831 suppresses the LHN bold when report.lastActorAccountID is falsy, and the optimistic value is 0.

    Prior art. #61641 ("#admins room is unread with GBR, then automatically becomes read") is the same symptom. It was closed as not reproducible with no fixing PR, so there is no earlier fix that regressed.

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

    1. Gate the mount mark-as-read the same way the report-change path is gated. In useMarkAsRead.ts:166-183, require isVisible && Visibility.hasFocus() — and isFocused, to cover side-panel and frozen-screen mounts — before calling readNewestAction. This is the actual fix; the report should not be consumed by a surface the user never looked at.

    2. Pass shouldRequireScreenFocus from the chat list at ReportActionsList.tsx:200-206, and honour it on the mount path, not just on report change.

    3. Make openSidePanel symmetric. In SidePanel.ts:11-15, explicitly write openNarrowScreen: false when the caller passes a falsy shouldOpenOnNarrowScreen, so "don't open on phones" can't be defeated by a stale NVP.

    4. Optionally, have navigateAfterOnboarding.ts:157 pass !isExtraLargeScreenWidth (1300px) rather than !shouldUseNarrowLayout (800px), so the flag it writes matches the breakpoint it is later read against.

    Worth noting: on desktop web the panel opens by design and legitimately marks #admins read. If that is also undesirable, fixing only (1) will change desktop behaviour too — please confirm the intent before implementing.

    What alternative solutions did you explore? (Optional)

    Rendering the Side Panel's #admins view in a read-only mode that never calls readNewestAction would fix this flow specifically, but it leaves the ungated mount effect in place for every other surface that mounts a ReportActionsList off-screen — the same defect would resurface elsewhere.


    Confidence and what is not yet verified

    Medium confidence. The mechanism, the file:line references, and the web-vs-native split are all verified in code at 50b3c85. Two things are not confirmed:

    • I could not get a runtime repro — the test session was already broken (the CI prestart onboarding replay diverged, and the browser rendered a blank page), so nothing here is backed by live evidence.
    • Static analysis says that on a clean mWeb session openNarrowScreen is unset, so the panel should stay hidden. The stale-NVP path in (3) is the most likely explanation for it firing anyway, but it is inferred, not proven.

    To settle both, check for ReadNewestAction / OpenReport calls against the new policy's chatReportIDAdmins within ~2s of CompleteGuidedSetup, bucketed by user agent, and inspect the NVP_SIDE_PANEL value (specifically openNarrowScreen) for an affected mWeb account at signup.

    Possibly related issues

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


    view run · no recording available

  4. added
    External
    on Sep 15, 2026
  5. melvin-bot commented on Sep 18, 2026

    @melvin-bot

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

  6. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    📣 @alimmiftah32-glitch! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  7. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  8. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    Still overdue 6 days?! Let's take care of this!

  9. elecelias-ux commented on Sep 23, 2026

    @elecelias-ux

    Proposal

    What is the root cause of that problem?

    After onboarding with "Submit expenses to my employer", web opens the Side Panel on the new #admins room (navigateToSubmitWorkspaceAfterOnboarding → ONBOARDING_RHP_VARIANT.RHP_ADMINS_ROOM → SidePanelActions.openSidePanel, then SidePanelContextProvider resolves chatReportIDAdmins and SidePanelReport mounts a full ReportScreen).

    That mount runs useMarkAsRead's one-shot initial effect (src/hooks/useMarkAsRead.ts, the effect that calls readNewestAction once on mount). That path only checks preloaded-tab / already-read / newer-actions / scrolled-to-end. It does not check isVisible, Visibility.hasFocus(), or isFocused.

    The report-change and app-visibility paths in the same hook already require visibility/focus (and optionally shouldRequireScreenFocus). So a Side Panel #admins ReportScreen marks the room read as soon as the list mounts — even though the user never opened that chat in the LHN. That matches the bug (mWeb: already read; Android Chrome: brief unread then flip to read).

    ReportActionsList also never passes shouldRequireScreenFocus, and today that flag is only consulted on the report-change path anyway — so even opting in would not protect the mount path.

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

    1. In the initial useMarkAsRead effect, apply the same gates the other paths already use: require isVisible && Visibility.hasFocus(), and if shouldRequireScreenFocus is set, require isFocused. Do not call readNewestAction on a background Side Panel mount.
    2. Wire shouldRequireScreenFocus into that initial effect (not only report-change), so callers that opt in are actually protected on mount.
    3. From ReportActionsList when rendered inside the Side Panel (useIsInSidePanel), pass shouldRequireScreenFocus: true (same pattern as MoneyRequestReportActionsList).
    4. Add / extend useMarkAsRead unit tests: Side Panel / unfocused mount must not mark read; focusing the real report still marks read.

    No change to onboarding navigation intent (Side Panel may still open on #admins); we only stop treating that mount as “user read the room”.

    What alternative solutions did you explore? (Optional)

    • Stop opening the Side Panel on #admins after employer onboarding — rejected; product wants Concierge Anywhere to show that room; the bug is false mark-as-read, not the panel itself.
    • Only latch on isInPreloadedTab — rejected; Side Panel is a parallel ReportScreen, not a preloaded main tab, so that guard never fires here.
    • Mark-as-read debounce / delay — rejected; hides the race without fixing the ungated mount path.
  10. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

  11. melvin-bot commented on Sep 28, 2026

    @melvin-bot

    12 days overdue now... This issue's end is nigh!

  12. melvin-bot commented on Sep 29, 2026

    @melvin-bot

    this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  13. 54 remaining items

  14. melvin-bot commented on Nov 6, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Nov 6, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  16. mukhrr commented on Nov 7, 2026

    @mukhrr
    Contributor

    Reviewer: @mukhrr owed $175 via NewDot

    Reviewer: @eh2077 owed $175 via NewDot

    I think payment is due $250 here

    We were brought here without proposal before Help Wanted

    @mukhrr feel free to work on a PR

    And what melvin proposed was not enough to fix the bug

    Melvin's solution doesnt work. So fixed bug on this following direction

    cc @dmkt9 @luacmartins

  17. mallenexpensify commented on Nov 9, 2026

    @mallenexpensify
    Contributor

    @eh2077 plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  18. melvin-bot commented on Nov 9, 2026

    @melvin-bot

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

  19. eh2077 commented on Nov 10, 2026

    @eh2077
    Contributor

    Contributor+ Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: NA. This isn't a bug introduced by a previous PR, instead, it's a complement enhancement of this old issue [Tracking] "Replay effect" when sequential actions are taken offline, and user subsequently comes online #12775
      Link to the comment on the Issue: NA

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Precondition:

    • a fresh account on mWeb or a narrow web window.

    Test:

    1. Sign up with a new account
    2. Click Join
    3. Choose "Submit expenses to my employer" in the intent selector
    4. Enter a first and last name and click Continue
    5. Open Inbox without opening #admins
    6. Verify #admins is unread and its preview is the Concierge "Welcome to Expensify! What do you want to do first?" message
    7. Open #admins and verify the welcome message is there and the room is now read

    Do we agree 👍 or 👎

  20. eh2077 commented on Nov 10, 2026

    @eh2077
    Contributor

    @mallenexpensify thanks for the ping, checklist done. I also think payment should be $250 here.

  21. mallenexpensify commented on Nov 11, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @mukhrr due $175 via NewDot
    Contributor+: @eh2077 due $175 via NewDot

    @mukhrr unfortunately, for now, Help Wanted has to be added in order for the price to be increased (it's a technicality for a handful of reasons). The assigned C+ can request an increase if they think the amount of work on a PR warrants it.

  22. flaviadefaria commented on Nov 24, 2026

    @flaviadefaria
    Contributor

    Approved: @mukhrr due $175 via NewDot

  23. laurenreidexpensify commented on Nov 26, 2026

    @laurenreidexpensify
    Contributor

    Approved @eh2077 $175 New Expensify

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

Metadata

Metadata

Labels

Awaiting PaymentBugDaily

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions