You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-13] [$250] Workspace - The member's WS chat is not displayed for admin #91779
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
Version Number: v9.3.83-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:#88455 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac 15.4.1 Safari/Chrome, iPhone 13 iOS 26.5 App Component: Workspace Settings
When an admin invites a member to a workspace, createPolicyExpenseChats creates the workspace chat with notificationPreference: HIDDEN as the default for all participants. Only the invited member's preference is then overridden to ALWAYS (Policy.ts:1654-1658) — the admin's preference stays HIDDEN.
The search router calls getSearchOptions with excludeHidden: true (OptionsListUtils:2740), and the filtering function at OptionsListUtils:2456-2469 checks the current user's notificationPreference. POLICY_EXPENSE_CHAT is not in the exemption list (only SELF_DM, POLICY_ADMINS, POLICY_ROOM, and GROUP are exempt), so the admin's HIDDEN preference causes the chat to be filtered out of search results.
The LHN sidebar doesn't have this problem because it has a special isOwnPolicyExpenseChat override at SidebarUtils.ts:335 — the search router has no equivalent exemption.
This is not a regression from PR #88455 — that PR only changed UI copy. This is a pre-existing gap in the search router's filtering logic.
What changes do you think we should make in order to solve the problem?
Add POLICY_EXPENSE_CHAT to the exemption list in the search router's excludeHidden filtering at OptionsListUtils/index.ts:2456-2462, so workspace member chats are not filtered out when the current user's notification preference is HIDDEN:
What alternative solutions did you explore? (Optional)
Override only for isOwnPolicyExpenseChat (matching the LHN approach) — this would be more targeted but requires threading the isOwnPolicyExpenseChat flag into the search filtering logic, which is more complex for the same outcome.
Set admin's notification preference to ALWAYS during chat creation — this would fix search visibility but changes the intentional "hidden until activity" behavior for workspace chats, potentially cluttering the LHN for admins of large workspaces.
Investigation details
Evidence chain:
createPolicyExpenseChats defaults notificationPreference to HIDDEN → both admin and member get HIDDEN initially
Only the invited member (owner) is overridden to ALWAYS; admin stays HIDDEN
Expensify/App#90900 — "Admin can't find room created by employee after navigating away" (related search/visibility issue)
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
On a "Track expenses for my business" workspace, after an admin invites a member, the admin opens the search router (chat finder) and cannot find the member's workspace (policy expense) chat. Expected: the member's WS chat should appear in the admin's search results so the admin can access it.
What is the root cause of that problem?
In src/libs/OptionsListUtils/index.ts, the excludeHidden filter inside getValidReports (lines 2456–2469) drops any non-thread/non-task report whose participants[currentUserAccountID].notificationPreference is hidden, unless its chatType is in an exemption list. The member's WS chat is a POLICY_EXPENSE_CHAT for which the admin participant is created with a hidden notification preference, and POLICY_EXPENSE_CHAT is not in the exemption list (lines 2459–2462), so line 2466–2467 returns false and removes it from the admin's search options. This is the same class of bug already fixed for group chats, task reports, policy admins, and policy rooms — each was added to this exemption as it surfaced.
What changes do you think we should make in order to solve the problem?
In src/libs/OptionsListUtils/index.ts (lines 2456–2462), add report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT to the exemption condition, mirroring the existing POLICY_ROOM/POLICY_ADMINS exemptions, so a policy expense chat with a hidden admin preference is not filtered out of search.
What alternative solutions did you explore? (Optional)
Gating the exemption on isPolicyAdmin(policy) so only admins see hidden member WS chats — rejected as narrower than the established sibling exemptions, which exempt the chat type unconditionally.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-27 03:02:28 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After an admin invites a new member to their workspace, the resulting member's workspace chat (the 1:1 POLICY_EXPENSE_CHAT between the admin's policy and the new member) is not discoverable when the admin opens the search router. The admin can see the chat via direct navigation but cannot find it through the chat finder, breaking the expected workflow on web and iOS.
What is the root cause of that problem?
When the admin invites a member, the write path runs through addMembersToWorkspace → buildAddMembersToWorkspaceOnyxData → createPolicyExpenseChats in src/libs/actions/Policy/Policy.ts. For each new member, that function calls buildOptimisticChatReport with participantList: [currentUserAccountID, cleanAccountID] and ownerAccountID: cleanAccountID, then deliberately overrides only the new member's participant entry to notificationPreference: ALWAYS, leaving every other participant (including the inviting admin) at the function's default HIDDEN. The intent is captured in the inline comment "Set correct notification preferences: visible for the submitter, hidden for others until there's activity":
So after the invite, the optimistic Onyx state for the new POLICY_EXPENSE_CHAT correctly contains the admin as a participant, but with participants[adminAccountID].notificationPreference = HIDDEN. This is intentional and matches the LHN contract — admins shouldn't get pinged for every workspace chat until something happens in it.
The read path is SearchRouter → SearchAutocompleteList → useFilteredOptions → getSearchOptions → getValidOptions in src/libs/OptionsListUtils/index.ts. getSearchOptions passes excludeHidden: true (line 2740) and includeOwnedWorkspaceChats: true. Inside getValidOptions's filteringFunction, the excludeHidden branch drops any non-thread, non-task, non-archived report whose participants[currentUserAccountID].notificationPreference is hidden — but the chat type exemption list only covers SELF_DM, POLICY_ADMINS, POLICY_ROOM, and GROUP. POLICY_EXPENSE_CHAT is conspicuously missing, so the member's WS chat is rejected before it ever reaches isValidReport:
This is the exact same shape as the bug fixed in PR #91171, which exempted POLICY_ROOM for an analogous reason: "Workspace rooms should always be discoverable by workspace members via search, regardless of notificationPreference. After opening a workspace room, the backend merges a 'hidden' participant entry which caused the room to disappear from subsequent searches." The same reasoning applies to POLICY_EXPENSE_CHAT — admins (and other workspace members who are participants but not the owner) carry a hidden preference by design, and the search router is precisely where they should still be able to surface those chats.
What changes do you think we should make in order to solve the problem?
Add report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT to the chat-type exemption list inside the excludeHidden branch of getValidOptions — extending the existing pattern that already exempts SELF_DM, POLICY_ADMINS, POLICY_ROOM, and GROUP. This makes the admin's member-WS-chat reachable from the search router while preserving every other gate: isValidReport still enforces includeOwnedWorkspaceChats, shouldReportBeInOptionList still drops malformed/empty/unsupported reports, and the LHN visibility logic in SidebarUtils.getOptionData remains untouched (it has its own shouldOverrideHidden rule at line 335 that already treats isOwnPolicyExpenseChat && !isReportArchived as visible).
This change is narrowly scoped to the search-router/chat-finder context (excludeHidden is opt-in and used only by getSearchOptions for the search surfaces — LHN computation uses SidebarUtils instead, so visual LHN noise from "hidden" workspace chats is not introduced). It also mirrors the established convention from PR #91171 (commit ce799404684), so reviewers have a direct precedent to compare against. Workspace expense chats are intrinsically scoped to the policy — if the admin is a participant at all, by definition they are a member of that policy and should be allowed to find that chat.
What alternative solutions did you explore? (Optional)
We considered flipping the admin's notificationPreference to ALWAYS at write time in createPolicyExpenseChats so the search filter would naturally let the report through, but that would contradict the explicit design comment at line 1653 ("hidden for others until there's activity") and would also start pinging admins for every newly invited member's workspace chat — a regression on notification volume. Exempting the chat type at the search layer matches the existing precedent and isolates the change to the surface that actually has the bug.
changed the title [-]Workspace - The member's WS chat is not displayed for admin[/-][+][$250] Workspace - The member's WS chat is not displayed for admin[/+]on May 27, 2026
Please re-state the problem that we are trying to solve in this issue.
[$250] Workspace - The member's WS chat is not displayed for admin
This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.
What is the root cause of that problem?
The stack trace shows the crash originates from a runtime error in the code:
(See Sentry issue for full stack trace)
The root cause is that the application code at the crash site does not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.
What changes do you think we should make in order to solve the problem?
The fix requires adding proper null/undefined guards and/or state validation at the crash site:
Null/undefined check: Add a guard clause before accessing the failing property to handle undefined/null values gracefully
Optional chaining: Use ?. operator where applicable to safely access nested properties
Error boundary: For render-related crashes, wrap the component in an error boundary or return null/fallback UI when data is unavailable
State validation: Ensure the state/context being consumed has the expected shape before access
The exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.
What alternative solutions did you explore? (Optional)
Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.
[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: This isn't caused by any specific PR. We simply didn't account for this scenario when implementing the logic to show members' workspace chats in the Search router.
Link to the comment on the Issue: This isn't caused by any specific PR. We simply didn't account for this scenario when implementing the logic to show members' workspace chats in the Search router.
[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: N/A
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
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
Activity
applause-bot commentedon May 27, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/8804e832899cfd0450dfaaa97f4fc443253b0886d026c00a0674f2d5b8ffa9ef
MelvinBot commentedon May 27, 2026
Proposal
What is the root cause of that problem?
When an admin invites a member to a workspace,
createPolicyExpenseChatscreates the workspace chat withnotificationPreference: HIDDENas the default for all participants. Only the invited member's preference is then overridden toALWAYS(Policy.ts:1654-1658) — the admin's preference staysHIDDEN.The search router calls
getSearchOptionswithexcludeHidden: true(OptionsListUtils:2740), and the filtering function at OptionsListUtils:2456-2469 checks the current user'snotificationPreference.POLICY_EXPENSE_CHATis not in the exemption list (onlySELF_DM,POLICY_ADMINS,POLICY_ROOM, andGROUPare exempt), so the admin'sHIDDENpreference causes the chat to be filtered out of search results.The LHN sidebar doesn't have this problem because it has a special
isOwnPolicyExpenseChatoverride at SidebarUtils.ts:335 — the search router has no equivalent exemption.This is not a regression from PR #88455 — that PR only changed UI copy. This is a pre-existing gap in the search router's filtering logic.
What changes do you think we should make in order to solve the problem?
Add
POLICY_EXPENSE_CHATto the exemption list in the search router'sexcludeHiddenfiltering atOptionsListUtils/index.ts:2456-2462, so workspace member chats are not filtered out when the current user's notification preference isHIDDEN:if ( !report.isThread && !report.isTaskReport && report.item?.chatType !== CONST.REPORT.CHAT_TYPE.SELF_DM && report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_ADMINS && report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_ROOM && report.item?.chatType !== CONST.REPORT.CHAT_TYPE.GROUP && + report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT && !report.private_isArchived )What alternative solutions did you explore? (Optional)
isOwnPolicyExpenseChat(matching the LHN approach) — this would be more targeted but requires threading theisOwnPolicyExpenseChatflag into the search filtering logic, which is more complex for the same outcome.ALWAYSduring chat creation — this would fix search visibility but changes the intentional "hidden until activity" behavior for workspace chats, potentially cluttering the LHN for admins of large workspaces.Investigation details
Evidence chain:
createPolicyExpenseChatsdefaultsnotificationPreferencetoHIDDEN→ both admin and member getHIDDENinitiallyALWAYS; admin staysHIDDENgetSearchOptionspassesexcludeHidden: truenotificationPreference, findsHIDDEN, returnsfalseRelated issues:
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.aswin-s commentedon May 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On a "Track expenses for my business" workspace, after an admin invites a member, the admin opens the search router (chat finder) and cannot find the member's workspace (policy expense) chat. Expected: the member's WS chat should appear in the admin's search results so the admin can access it.
What is the root cause of that problem?
In
src/libs/OptionsListUtils/index.ts, theexcludeHiddenfilter insidegetValidReports(lines 2456–2469) drops any non-thread/non-task report whoseparticipants[currentUserAccountID].notificationPreferenceis hidden, unless itschatTypeis in an exemption list. The member's WS chat is aPOLICY_EXPENSE_CHATfor which the admin participant is created with a hidden notification preference, andPOLICY_EXPENSE_CHATis not in the exemption list (lines 2459–2462), so line 2466–2467 returnsfalseand removes it from the admin's search options. This is the same class of bug already fixed for group chats, task reports, policy admins, and policy rooms — each was added to this exemption as it surfaced.What changes do you think we should make in order to solve the problem?
src/libs/OptionsListUtils/index.ts(lines 2456–2462), addreport.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHATto the exemption condition, mirroring the existingPOLICY_ROOM/POLICY_ADMINSexemptions, so a policy expense chat with a hidden admin preference is not filtered out of search.What alternative solutions did you explore? (Optional)
Gating the exemption on
isPolicyAdmin(policy)so only admins see hidden member WS chats — rejected as narrower than the established sibling exemptions, which exempt the chat type unconditionally.MobileMage commentedon May 27, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-27 03:02:28 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After an admin invites a new member to their workspace, the resulting member's workspace chat (the 1:1
POLICY_EXPENSE_CHATbetween the admin's policy and the new member) is not discoverable when the admin opens the search router. The admin can see the chat via direct navigation but cannot find it through the chat finder, breaking the expected workflow on web and iOS.What is the root cause of that problem?
When the admin invites a member, the write path runs through
addMembersToWorkspace→buildAddMembersToWorkspaceOnyxData→createPolicyExpenseChatsinsrc/libs/actions/Policy/Policy.ts. For each new member, that function callsbuildOptimisticChatReportwithparticipantList: [currentUserAccountID, cleanAccountID]andownerAccountID: cleanAccountID, then deliberately overrides only the new member's participant entry tonotificationPreference: ALWAYS, leaving every other participant (including the inviting admin) at the function's defaultHIDDEN. The intent is captured in the inline comment "Set correct notification preferences: visible for the submitter, hidden for others until there's activity":App/src/libs/actions/Policy/Policy.ts
Lines 1653 to 1659 in 8d99383
So after the invite, the optimistic Onyx state for the new
POLICY_EXPENSE_CHATcorrectly contains the admin as a participant, but withparticipants[adminAccountID].notificationPreference = HIDDEN. This is intentional and matches the LHN contract — admins shouldn't get pinged for every workspace chat until something happens in it.The read path is
SearchRouter→SearchAutocompleteList→useFilteredOptions→getSearchOptions→getValidOptionsinsrc/libs/OptionsListUtils/index.ts.getSearchOptionspassesexcludeHidden: true(line 2740) andincludeOwnedWorkspaceChats: true. InsidegetValidOptions'sfilteringFunction, theexcludeHiddenbranch drops any non-thread, non-task, non-archived report whoseparticipants[currentUserAccountID].notificationPreferenceis hidden — but the chat type exemption list only coversSELF_DM,POLICY_ADMINS,POLICY_ROOM, andGROUP.POLICY_EXPENSE_CHATis conspicuously missing, so the member's WS chat is rejected before it ever reachesisValidReport:App/src/libs/OptionsListUtils/index.ts
Lines 2456 to 2469 in 8d99383
This is the exact same shape as the bug fixed in PR #91171, which exempted
POLICY_ROOMfor an analogous reason: "Workspace rooms should always be discoverable by workspace members via search, regardless of notificationPreference. After opening a workspace room, the backend merges a 'hidden' participant entry which caused the room to disappear from subsequent searches." The same reasoning applies toPOLICY_EXPENSE_CHAT— admins (and other workspace members who are participants but not the owner) carry a hidden preference by design, and the search router is precisely where they should still be able to surface those chats.What changes do you think we should make in order to solve the problem?
Add
report.item?.chatType !== CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHATto the chat-type exemption list inside theexcludeHiddenbranch ofgetValidOptions— extending the existing pattern that already exemptsSELF_DM,POLICY_ADMINS,POLICY_ROOM, andGROUP. This makes the admin's member-WS-chat reachable from the search router while preserving every other gate:isValidReportstill enforcesincludeOwnedWorkspaceChats,shouldReportBeInOptionListstill drops malformed/empty/unsupported reports, and the LHN visibility logic inSidebarUtils.getOptionDataremains untouched (it has its ownshouldOverrideHiddenrule at line 335 that already treatsisOwnPolicyExpenseChat && !isReportArchivedas visible).App/src/libs/OptionsListUtils/index.ts
Lines 2459 to 2462 in 8d99383
This change is narrowly scoped to the search-router/chat-finder context (
excludeHiddenis opt-in and used only bygetSearchOptionsfor the search surfaces — LHN computation usesSidebarUtilsinstead, so visual LHN noise from "hidden" workspace chats is not introduced). It also mirrors the established convention from PR #91171 (commitce799404684), so reviewers have a direct precedent to compare against. Workspace expense chats are intrinsically scoped to the policy — if the admin is a participant at all, by definition they are a member of that policy and should be allowed to find that chat.What alternative solutions did you explore? (Optional)
We considered flipping the admin's
notificationPreferencetoALWAYSat write time increatePolicyExpenseChatsso the search filter would naturally let the report through, but that would contradict the explicit design comment at line 1653 ("hidden for others until there's activity") and would also start pinging admins for every newly invited member's workspace chat — a regression on notification volume. Exempting the chat type at the search layer matches the existing precedent and isolates the change to the surface that actually has the bug.melvin-bot commentedon May 27, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (
External)[-]Workspace - The member's WS chat is not displayed for admin[/-][+][$250] Workspace - The member's WS chat is not displayed for admin[/+]melvin-bot commentedon May 27, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022059470114660258285
lxyct825-ops commentedon May 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
[$250] Workspace - The member's WS chat is not displayed for admin
This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.
What is the root cause of that problem?
The stack trace shows the crash originates from a runtime error in the code:
The root cause is that the application code at
the crash sitedoes not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.What changes do you think we should make in order to solve the problem?
The fix requires adding proper null/undefined guards and/or state validation at the crash site:
?.operator where applicable to safely access nested propertiesThe exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.
What alternative solutions did you explore? (Optional)
Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.
lxyct825-ops commentedon May 27, 2026
Contributor details
Your Expensify account email: lxyct825+expensify@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01174eaf71ab8fc150
28 remaining items
melvin-bot commentedon Jul 9, 2026
@jayeshmangwani Whoops! This issue is 2 days overdue. Let's get this updated quick!
jayeshmangwani commentedon Jul 10, 2026
BugZero 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: This isn't caused by any specific PR. We simply didn't account for this scenario when implementing the logic to show members' workspace chats in the Search router.
Link to the comment on the Issue: This isn't caused by any specific PR. We simply didn't account for this scenario when implementing the logic to show members' workspace chats in the Search router.
[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: N/A
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/659170
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-c376-a207-8e11-d05bde36bde4melvin-bot commentedon Jul 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jul 12, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 14, 2026
Payment Summary
Contributor+: @jayeshmangwani due $250 via NewDot
^ Test case created. Thx
quinthar commentedon Jul 31, 2026
Approved $250 to @jayeshmangwani