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-08-10] [$250] Not here page appears when assignee leave the task report #96421
Leaving a task report wipes the report object from Onyx, and the report screen then renders the "Not here" (notFound.noAccess) page.
The "Leave" button calls leaveChat() → leaveRoom() (DynamicReportDetailsPage.tsx:372-380). Inside leaveRoom, the "safe" behavior (only setting notificationPreference: hidden and keeping the report) is gated on isWorkspaceMemberLeavingWorkspaceRoom || isChatThread (Report/index.ts:4907-4949).
A task report is a thread, but isChatThread() requires type === CHAT, and a task's type is TASK, so isChatThread(taskReport) is false (ReportUtils.ts:1844-1846). The task therefore takes the destructive else branch:
Success: Onyx.SET the report to just {reportName}, dropping reportID and statusNum entirely.
The guard then evaluates reportExists = !!reportID || isOptimisticDelete || userLeavingStatus (ReportNotFoundGuard.tsx:53-73). On API success the report has no reportID and no statusNum (so isOptimisticDelete is false), and userLeavingStatus has cleared → all three terms are false → shouldShowNotFoundPage becomes true → "Not here".
(Leaving the group chat as User B is incidental — the same happens whenever a task assignee leaves the task; it just wipes the assignee's own report object.)
What changes do you think we should make in order to solve the problem?
Treat a task report the same way as a chat thread in leaveRoom so that leaving only hides it (sets notificationPreference: hidden) instead of nulling reportID/statusNum.
Concretely, extend the branch condition in Report/index.ts:4908 (and the matching successData/failureData conditions at :4930) to also cover task reports — e.g. compute const isTaskReport = isTaskReportReportUtils(report); and use isWorkspaceMemberLeavingWorkspaceRoom || isChatThread || isTaskReport. This keeps the report object intact after leaving, so the guard's reportExists check stays true and the user is navigated away cleanly rather than landing on "Not here".
What alternative solutions did you explore? (Optional)
Alternatively, ReportNotFoundGuard could treat a report emptied by a successful leave as "left, not missing", but fixing the destructive branch in leaveRoom is the more targeted change and keeps the leave semantics consistent with chat threads and workspace rooms.
Confidence & evidence
Confidence: High — the code path was traced end to end and each link verified by reading the files at SHA 5ed347bd61d2e69d2fd6405d38c8a88464e4e76b.
Data flow:
Task assignee opens the task and taps Leave → leaveChat() → leaveRoom() (task is not a root group chat).
isChatThread(task) is false (type === TASK, not CHAT) and it isn't a workspace room → destructive else branch runs.
ReportNotFoundGuard: reportExists = !!reportID || (statusNum===CLOSED) || userLeavingStatus → all false after success → shouldShowNotFoundPage true → "Not here" (notFound.noAccess).
If runtime confirmation is desired, look for the [ReportScreen] Displaying NotFound Page log (ReportNotFoundGuard.tsx:79) around the leave time — it logs reportID, isOptimisticDelete, and userLeavingStatus.
Possibly related (different flow, same "Not here" symptom): #96295.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/96421) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When the assignee of a task (User A) opens the task from Reports and taps Leave on the details page, the app briefly shows the "Not here" (FullPageNotFoundView) error page instead of navigating cleanly to a valid chat. This happens on Web (Windows/Chrome) when the task creator (User B) has already left the parent group chat before User A leaves the task thread. The expected result is that leaving the task should dismiss the details modal and land User A on a valid report without the "Not here" screen flashing.
What is the root cause of that problem?
leaveRoom in src/libs/actions/Report/index.ts (lines 4883–5002) is called when User A leaves the task report. The key branch condition inside that function is:
isChatThread (defined at src/libs/ReportUtils.ts:1844) returns true only when isThread(report) && report?.type === CONST.REPORT.TYPE.CHAT. A task report has type === CONST.REPORT.TYPE.TASK, notCHAT, so isChatThread is false for task reports.
Because isChatThread is false and isWorkspaceMemberLeavingWorkspaceRoom is also false, leaveRoom takes the plain "room deleted" branch for the optimistic update (lines 4906–4915):
// isChatThread=false, so this branch runs:{reportID: null,stateNum: CONST.REPORT.STATE_NUM.APPROVED,statusNum: CONST.REPORT.STATUS_NUM.CLOSED,participants: {[currentUserAccountID]: {notificationPreference: HIDDEN}},}
Writing reportID: null optimistically to Onyx before navigation completes causes withReportOrNotFound (src/pages/inbox/report/withReportOrNotFound.tsx:116) to immediately re-evaluate its guard. The guard calls canAccessReport (src/libs/ReportUtils.ts:9347), which sees an effectively-null report record and returns false, so the Task details screen renders FullPageNotFoundView ("Not here") while navigateToMostRecentReport (called at line 5001 without first dismissing the modal) is still in flight.
The isWorkspaceMemberLeavingWorkspaceRoom && !isChatThread branch at line 4996 does call Navigation.dismissModal() before navigating away, but task reports never reach it because isWorkspaceMemberLeavingWorkspaceRoom is false. So the RHP stays mounted, re-renders against the now-null report record, and shows the "Not here" page.
What changes do you think we should make in order to solve the problem?
The minimal correct fix is to treat task reports the same as chat threads in leaveRoom — use MERGE (not null-write) for the optimistic update, and dismiss the RHP before navigating away.
Change 1 — src/libs/actions/Report/index.ts
Extend the isChatThread guard to also cover isTaskReport, so the optimistic Onyx write does not null out reportID:
// around line 4893import{isChatThreadasisChatThreadReportUtils,isTaskReport}from'@libs/ReportUtils';// ...constisChatThread=isChatThreadReportUtils(report);constisTask=isTaskReport(report);// add this// line ~4906: change the condition from (isWorkspaceMemberLeavingWorkspaceRoom || isChatThread) to:isWorkspaceMemberLeavingWorkspaceRoom||isChatThread||isTask
? {participants: {[currentUserAccountID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,},},}
: {/* existing null-write branch for plain rooms */}
Apply the same guard update to the successData push and the if (isWorkspaceMemberLeavingWorkspaceRoom || isChatThread) block that follows (around line 4931), so all three data arrays are consistent.
Add a Navigation.dismissModal() call for task reports before navigateToMostRecentReport, so the RHP unmounts before withReportOrNotFound can re-evaluate against the post-leave Onyx state:
if(isWorkspaceMemberLeavingWorkspaceRoom&&!isChatThread){Navigation.dismissModal();return;}// Add:if(isTask){Navigation.dismissModal();// fall through to navigateToMostRecentReport so User A lands on a valid screen}navigateToMostRecentReport(report,conciergeReportID,currentUserAccountID,introSelected,betas);
Why this is the right scope: The root cause is the reportID: null optimistic write that fires before the modal is dismissed. Both changes together — (1) switching the Onyx optimistic update from the null-write branch to the MERGE/HIDDEN branch for task reports, and (2) dismissing the modal before navigation — close the race window that lets withReportOrNotFound render "Not here".
Change 3 (optional hardening) — src/pages/DynamicReportDetailsPage.tsx (around line 372–380)
In the leaveChat handler, call Navigation.dismissModal() explicitly after invoking leaveRoom/leaveGroupChat for task reports, matching the pattern used in the delete-request flow at DynamicReportDetailsPage.tsx:1114-1116 (which wraps the destructive action in TransitionTracker.runAfterTransitions to avoid the "Not Found" flash on slower devices):
// After leaveRoom is called for a task report:Navigation.dismissModal();
This provides defense-in-depth at the callsite level in addition to the action-level fix in Change 2.
What alternative solutions did you explore? (Optional)
An alternative is to guard canAccessReport (src/libs/ReportUtils.ts:9341) so that a report whose current user has just optimistically set notificationPreference: HIDDEN (leave in flight) does not return false for the still-mounted details page. This would suppress the "Not here" render without touching leaveRoom. However, this approach is fragile — canAccessReport is a broadly used utility and loosening its guard could mask genuine access errors on other report types. The action-level fix (Changes 1 and 2) is narrower and directly addresses the source.
A second alternative is to defer API.write(LEAVE_ROOM, ...) until after the navigation transition completes, using InteractionManager.runAfterInteractions or TransitionTracker.runAfterTransitions. This matches the pattern at DynamicReportDetailsPage.tsx:1114-1116 for delete requests. The downside is that it defers the server call and may cause a brief UI state where the user appears to still be a participant. The dismiss-first approach in Changes 1 and 2 is simpler and keeps the API call timing unchanged.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:12:31 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the assignee opens a task from Reports > Tasks and taps Leave on the task's details page, the RHP flips to the "Hmm... it's not here" (Not found) page instead of quietly leaving the task and returning to a valid screen.
What is the root cause of that problem?
A task report is a thread (it has a parentReportID/parentReportActionID), but it is not a chat thread — isChatThread only returns true when type === CONST.REPORT.TYPE.CHAT, and a task's type is TASK.
When Leave is pressed, DynamicReportDetailsPage calls leaveRoom. Its optimistic update branches on isWorkspaceMemberLeavingWorkspaceRoom || isChatThread. Because a task is neither, it falls into the else branch that nulls out the report (reportID: null, statusNum: CLOSED):
So the moment leaveRoom merges reportID: null, isReportLoaded becomes false, shouldShowNotFoundPage becomes true, and — since the details RHP is still focused (nothing dismissed it yet: getSearchThreadLeaveRoute also early-returns for a task because it too gates on isChatThreadReportUtils) — the escape hatch at L120 (... && !isFocused) doesn't apply, and NotFoundPage renders in place. This is exactly what the video shows: the URL stays on /search/view/<taskID>/details while the RHP swaps to "it's not here".
Note the main report screen already protects against this same optimistic-null race via a leaving flag, but the details wrapper has no equivalent:
The nulling is also wrong on its own: leaving a task doesn't delete it (it still appears in Reports > Tasks afterward), so it should be hidden, exactly like a chat thread — not treated as a deleted room.
What changes do you think we should make in order to solve the problem?
Treat task reports the same as chat threads in leaveRoom, so leaving hides the report (sets the assignee's notificationPreference to HIDDEN) instead of nulling it. In src/libs/actions/Report/index.ts, import isTaskReport from ReportUtils and widen the condition:
Apply the same || isTaskReport to the matching successData branch a few lines below (the if (isWorkspaceMemberLeavingWorkspaceRoom || isChatThread) check) so the success update also keeps the report and only sets the notification preference.
With this, report.reportID is preserved on leave, isReportLoaded stays true, and the details page never flips to Not found — while navigateToMostRecentReport still moves the user off the task. The task stays consistent with the server state that already keeps it listed in Reports > Tasks.
What specific scenarios should we cover in automated tests to prevent this regression from occurring in the future?
Unit test for leaveRoom with a task report: assert the optimistic REPORT update sets participants[accountID].notificationPreference = HIDDEN and does not set reportID: null / statusNum: CLOSED (mirroring the existing chat-thread expectation).
Regression test: after leaveRoom on a task report, withReportOrNotFound's isReportLoaded predicate (!!report?.reportID) stays truthy, i.e. the Not found page is not shown.
What alternative solutions did you explore? (Optional)
Give withReportOrNotFound the same leaving-state escape hatch that ReportNotFoundGuard already has — subscribe to ${ONYXKEYS.COLLECTION.REPORT_USER_IS_LEAVING_ROOM}${reportID} and treat the report as still-present while userLeavingStatus is true. This fixes the flash generically for any report type left with a details page open, but it's a presentation-layer patch that leaves the underlying "a left task gets nulled" inconsistency in place, so I'd prefer the leaveRoom fix as the primary and keep this as a defensive follow-up. A third option — extending getSearchThreadLeaveRoute to dismiss the RHP for task threads — only hides the symptom via navigation timing and still routes to the parent group chat rather than back to the Tasks list.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:13:56 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The assignee opens the task from Reports > Task, navigates from it to the parent group chat, and taps Leave on the details page. Instead of landing on a valid screen, a full-page "Hmm... it's not here" appears once the leave completes.
What is the root cause of that problem?
The structural cause: the Search branch of leaveGroupChat reveals the screen of the very report that leaving deletes from Onyx. It "preserves" a page that cannot survive the action.
The Leave in this repro belongs to the parent group chat, not the task. canLeaveChat has no branch for type: 'task' — every branch requires chat-thread/room/expense-chat/IOU shapes — so a task's details page never renders a Leave item. The expected/actual results in the bug body confirm it: "Not here error page appears when assignee leave the group".
Because the user arrived via Reports > Task, Search is the topmost fullscreen route, so leaveGroupChat takes its Search branch and calls revealRouteBeforeDismissingModal(getReportRouteForCurrentContext({reportID})) — with the reportID of the group chat being left:
Optimistically the page survives: the merge removes reportID but sets statusNum: CLOSED, and ReportNotFoundGuard counts a CLOSED report as an optimistic delete (reportExists stays true):
When LeaveGroupChat succeeds, successData merges null, wiping the whole report by design ("any remaining data is removed upon successful completion"). Now reportExists is false and the guard renders the full-page "Not here":
The auto-redirect that normally rescues a wiped report — ReportNavigateAwayHandler, whose removal list already includes isGroupChat(prevReport) — deliberately early-returns for reports inside the right modal navigator (isInNarrowPaneModal), which is exactly where every Search-opened report lives. So no navigation fires and the user is stranded:
// Early return if the report we're passing isn't in a focused state. We only want to navigate to Concierge if the user leaves the room from another device or gets removed from the room while the report is in a focused state.
Affected paths: leaveGroupChat has a single call site (DynamicReportDetailsPage.tsx#L372-L380), and this reveal is the only place a to-be-deleted report is re-targeted (getReportRouteForCurrentContext's other consumers navigate to live reports). Wide and narrow layouts both reproduce (SEARCH_REPORT sits in the RightModalNavigator in both); offline, the CLOSED page shows until reconnect, then flips to "Not here" on sync. The task and User B leaving are just how QA reached the Search context — leaving any group chat from Reports > Chats reproduces it.
What changes do you think we should make in order to solve the problem?
In leaveGroupChat's Search branch, stop revealing the left report and dismiss the modal stack instead (src/libs/actions/Report/index.ts#L4874-L4878):
The details RHP and the SEARCH_REPORT screen live in the same RightModalNavigator, so one dismissModal() closes both and lands the user on the Search table they came from (Reports > Task here; Spend > Chats in #85560), filters intact. This preserves PR #93525's intent — stay in Search context, never bounce to Inbox — while removing the dependency on a report that is about to cease to exist, online and offline. Regression safety in one sentence: the non-Search path (navigateToMostRecentReport) and leaveRoom/thread flows are untouched, and no other caller uses this reveal.
Why the obvious spot fix fails: adding the task type to ReportNavigateAwayHandler's isRemovalExpectedForReportType (or leaning on that handler at all) cannot work — group chats are already in that list (L167) and the page still strands, because the handler's isInNarrowPaneModal early-return (L121-126) suppresses navigation for every Search-RHP report; and any "leaving the task" diagnosis targets the wrong report, since canLeaveChat never shows Leave for type: 'task'.
What alternative solutions did you explore? (Optional)
Set REPORT_USER_IS_LEAVING_ROOM in leaveGroupChat (mirroring leaveRoom's broadcast) so the guard keeps passing — masks the wipe and parks the user indefinitely on a dead report page behind a flag nothing clears in this flow.
Keep statusNum: CLOSED in successData so isOptimisticDelete stays true — contradicts the explicit comment that all remaining data must be removed on success (server removal update must not linger) and leaves a ghost chat in Onyx.
Revert the branch to navigateToMostRecentReport — fixes the "Not here" but reintroduces #85560 (user yanked out of Search into Inbox), breaking intentional behavior.
changed the title [-]Not here page appears when assignee leave the task report[/-][+][$250] Not here page appears when assignee leave the task report[/+]on Jul 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:09:01 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a task is created inside a group chat and the assignee later opens that task from Reports (filtered by type Task) and taps Leave on its details page, a full-page "Hmm... it's not here" error appears. On top of the visible error, the leave goes through the group-chat leave flow, so the task report gets permanently wiped from the assignee's Onyx data even though they are still the task's assignee.
What is the root cause of that problem?
The task report the assignee receives from the backend carries chatType: 'group' inherited from the parent group chat. This is visible in the issue's attached video: one second after the task opens (when OpenReport data lands), the header avatar flips from the assignee's letter avatar to a group avatar, and the details page renders the group-chat variant (group avatar, Pin/Share, "Members — 4", Settings, Leave) instead of the task variant (Title/Description/Assignee). The client only expects this inheritance for #admins tasks — buildOptimisticTaskReport deliberately inherits chatType just for POLICY_ADMINS parents (see PR #84263, "Align optimistic task chatType inheritance with backend behavior") — but nothing sanitizes other inherited chat types on read, so every chatType-based classifier misfires for this task. In particular isRootGroupChat returns true, because its thread exclusion uses isChatThread, which requires type === CHAT while a task's type is TASK, so a task thread slips past the "root" check:
With the task misclassified as a root group chat, canLeaveChat returns true (its very first clause is isRootGroupChat), which is why a Leave row appears on a task details page at all, and leaveChat in DynamicReportDetailsPage takes the isRootGroupChat branch and calls leaveGroupChat(report, ...) — not leaveRoom — sending the LeaveGroupChat API command for a task report. leaveGroupChat immediately applies an optimistic merge that nulls the report's identity:
Because the task was opened from the Search context, isSearchTopmostFullScreenRoute() is true and leaveGroupChat schedules the RHP dismissal through Navigation.revealRouteBeforeDismissingModal, which defers it by two animation frames, while API.write applies the optimistic wipe right away. The details RHP is still mounted and focused at that moment, and it is wrapped in withReportOrNotFound, whose gate is const isReportLoaded = !isEmptyObject(report) && !!report?.reportID feeding shouldShowNotFoundPage = !isReportLoaded || ...; its "navigating away" escape hatch only returns null when !isFocused, which hasn't happened yet. So the moment reportID is nulled, the focused details page renders the full-page NotFoundPage — the video shows the "Hmm... it's not here" frame while the URL is still /search/view/<taskReportID>/details, before the deferred dismissal lands the user back on the Tasks list. The successData then merges null over the report, so the task report stays wiped for the assignee.
What changes do you think we should make in order to solve the problem?
Fix the misclassification at its single choke point, getChatType, so a task report is never treated as a group chat (or any other room type) just because the backend copied the parent's chatType onto it, while keeping the one inheritance the client intentionally supports (POLICY_ADMINS, used for Concierge/#admins task routing):
functiongetChatType(report: OnyxInputOrEntry<Report>|Participant): ValueOf<typeofCONST.REPORT.CHAT_TYPE>|undefined{// Tasks only support the #admins chatType inheritance (see buildOptimisticTaskReport). The backend can also// inherit other parent chat types (e.g. `group`), which would misclassify the task as that chat type.if(report&&'type'inreport&&report.type===CONST.REPORT.TYPE.TASK&&report.chatType!==CONST.REPORT.CHAT_TYPE.POLICY_ADMINS){returnundefined;}returnreport?.chatType;}
All the misbehaving classifiers (isGroupChat, isRootGroupChat, isUserCreatedPolicyRoom, isPolicyExpenseChat, isChatRoom) read through getChatType, so with this change isRootGroupChat(task) is false, canLeaveChat(task) is false, the bogus Leave row disappears, leaveGroupChat becomes unreachable for tasks, and the details page renders the proper task layout (Title/Description/Assignee) with the correct task icons. This also restores parity between server-loaded and optimistically-created tasks: the creator's optimistic task (built without chatType by buildOptimisticTaskReport) and the same task after server sync now classify and render identically, which is exactly the model PR #84263 established. The change is safe for other callers: real group chats have type: CHAT so they are untouched, #admins tasks keep POLICY_ADMINS, canJoinChat still returns false for tasks (its final clause requires a chat thread or room type), and Participant/option objects without a type field pass through unchanged. A unit test can be added alongside the existing chatType-inheritance tests in tests/actions/TaskTest.ts asserting that getChatType returns undefined for a task carrying chatType: 'group'.
What alternative solutions did you explore? (Optional)
A narrower fix is changing isRootGroupChat's exclusion from !isChatThread(report) to !isThread(report), which hides the Leave row and blocks the leaveGroupChat call for this exact repro; we rejected it because the task would still be classified as a group chat everywhere else (group avatar and group name section on the details page, wrong icons in LHN/Search), and the same destructive-leave family stays reachable if the backend inherits a different chat type (for example a task in a #room classifying as a user-created policy room makes canLeaveChat true and routes into leaveRoom's report-wiping branch). We also ruled out patching leaveRoom's isChatThread gate or ReportNavigateAwayHandler: neither is involved in this flow, since the misclassification routes the leave through leaveGroupChat, and the visible "not here" is produced by withReportOrNotFound on the still-focused details RHP before the deferred dismissal runs.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.48-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-08-10. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
[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: N/A
Link to the comment on the Issue: N/A
Not a regression, at least on the FE side. isRootGroupChat logic has been like that since it's implemented.
[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.
Activity
applause-bot commentedon Jul 17, 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/c54ab6f35cb76ed57863875ec3a0fcb17a7b87a579ddad2a209808a6e2ef9ee6
MelvinBot commentedon Jul 17, 2026
Proposal
What is the root cause of that problem?
Leaving a task report wipes the report object from Onyx, and the report screen then renders the "Not here" (
notFound.noAccess) page.The "Leave" button calls
leaveChat()→leaveRoom()(DynamicReportDetailsPage.tsx:372-380). InsideleaveRoom, the "safe" behavior (only settingnotificationPreference: hiddenand keeping the report) is gated onisWorkspaceMemberLeavingWorkspaceRoom || isChatThread(Report/index.ts:4907-4949).A task report is a thread, but
isChatThread()requirestype === CHAT, and a task's type isTASK, soisChatThread(taskReport)is false (ReportUtils.ts:1844-1846). The task therefore takes the destructiveelsebranch:{reportID: null, statusNum: CLOSED, ...}Onyx.SETthe report to just{reportName}, droppingreportIDandstatusNumentirely.The guard then evaluates
reportExists = !!reportID || isOptimisticDelete || userLeavingStatus(ReportNotFoundGuard.tsx:53-73). On API success the report has noreportIDand nostatusNum(soisOptimisticDeleteis false), anduserLeavingStatushas cleared → all three terms are false →shouldShowNotFoundPagebecomes true → "Not here".(Leaving the group chat as User B is incidental — the same happens whenever a task assignee leaves the task; it just wipes the assignee's own report object.)
What changes do you think we should make in order to solve the problem?
Treat a task report the same way as a chat thread in
leaveRoomso that leaving only hides it (setsnotificationPreference: hidden) instead of nullingreportID/statusNum.Concretely, extend the branch condition in
Report/index.ts:4908(and the matchingsuccessData/failureDataconditions at:4930) to also cover task reports — e.g. computeconst isTaskReport = isTaskReportReportUtils(report);and useisWorkspaceMemberLeavingWorkspaceRoom || isChatThread || isTaskReport. This keeps the report object intact after leaving, so the guard'sreportExistscheck stays true and the user is navigated away cleanly rather than landing on "Not here".What alternative solutions did you explore? (Optional)
Alternatively,
ReportNotFoundGuardcould treat a report emptied by a successful leave as "left, not missing", but fixing the destructive branch inleaveRoomis the more targeted change and keeps the leave semantics consistent with chat threads and workspace rooms.Confidence & evidence
Confidence: High — the code path was traced end to end and each link verified by reading the files at SHA
5ed347bd61d2e69d2fd6405d38c8a88464e4e76b.Data flow:
leaveChat()→leaveRoom()(task is not a root group chat).isChatThread(task)isfalse(type === TASK, notCHAT) and it isn't a workspace room → destructiveelsebranch runs.reportID: null,statusNum: CLOSED. On success:Onyx.SET→{reportName}only.ReportNotFoundGuard:reportExists = !!reportID || (statusNum===CLOSED) || userLeavingStatus→ all false after success →shouldShowNotFoundPagetrue → "Not here" (notFound.noAccess).If runtime confirmation is desired, look for the
[ReportScreen] Displaying NotFound Pagelog (ReportNotFoundGuard.tsx:79) around the leave time — it logsreportID,isOptimisticDelete, anduserLeavingStatus.Possibly related (different flow, same "Not here" symptom): #96295.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/96421)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
aswin-s commentedon Jul 17, 2026
Please re-state the problem that we are trying to solve in this issue.
When the assignee of a task (User A) opens the task from Reports and taps Leave on the details page, the app briefly shows the "Not here" (FullPageNotFoundView) error page instead of navigating cleanly to a valid chat. This happens on Web (Windows/Chrome) when the task creator (User B) has already left the parent group chat before User A leaves the task thread. The expected result is that leaving the task should dismiss the details modal and land User A on a valid report without the "Not here" screen flashing.
What is the root cause of that problem?
leaveRoominsrc/libs/actions/Report/index.ts(lines 4883–5002) is called when User A leaves the task report. The key branch condition inside that function is:isChatThread(defined at src/libs/ReportUtils.ts:1844) returnstrueonly whenisThread(report) && report?.type === CONST.REPORT.TYPE.CHAT. A task report hastype === CONST.REPORT.TYPE.TASK, notCHAT, soisChatThreadisfalsefor task reports.Because
isChatThreadisfalseandisWorkspaceMemberLeavingWorkspaceRoomis alsofalse,leaveRoomtakes the plain "room deleted" branch for the optimistic update (lines 4906–4915):Writing
reportID: nulloptimistically to Onyx before navigation completes causeswithReportOrNotFound(src/pages/inbox/report/withReportOrNotFound.tsx:116) to immediately re-evaluate its guard. The guard callscanAccessReport(src/libs/ReportUtils.ts:9347), which sees an effectively-null report record and returnsfalse, so the Task details screen rendersFullPageNotFoundView("Not here") whilenavigateToMostRecentReport(called at line 5001 without first dismissing the modal) is still in flight.The
isWorkspaceMemberLeavingWorkspaceRoom && !isChatThreadbranch at line 4996 does callNavigation.dismissModal()before navigating away, but task reports never reach it becauseisWorkspaceMemberLeavingWorkspaceRoomisfalse. So the RHP stays mounted, re-renders against the now-null report record, and shows the "Not here" page.What changes do you think we should make in order to solve the problem?
The minimal correct fix is to treat task reports the same as chat threads in
leaveRoom— useMERGE(not null-write) for the optimistic update, and dismiss the RHP before navigating away.Change 1 —
src/libs/actions/Report/index.tsExtend the
isChatThreadguard to also coverisTaskReport, so the optimistic Onyx write does not null outreportID:Apply the same guard update to the
successDatapush and theif (isWorkspaceMemberLeavingWorkspaceRoom || isChatThread)block that follows (around line 4931), so all three data arrays are consistent.Change 2 —
src/libs/actions/Report/index.ts(line 4996–5001)Add a
Navigation.dismissModal()call for task reports beforenavigateToMostRecentReport, so the RHP unmounts beforewithReportOrNotFoundcan re-evaluate against the post-leave Onyx state:Why this is the right scope: The root cause is the
reportID: nulloptimistic write that fires before the modal is dismissed. Both changes together — (1) switching the Onyx optimistic update from the null-write branch to the MERGE/HIDDEN branch for task reports, and (2) dismissing the modal before navigation — close the race window that letswithReportOrNotFoundrender "Not here".Change 3 (optional hardening) —
src/pages/DynamicReportDetailsPage.tsx(around line 372–380)In the
leaveChathandler, callNavigation.dismissModal()explicitly after invokingleaveRoom/leaveGroupChatfor task reports, matching the pattern used in the delete-request flow atDynamicReportDetailsPage.tsx:1114-1116(which wraps the destructive action inTransitionTracker.runAfterTransitionsto avoid the "Not Found" flash on slower devices):This provides defense-in-depth at the callsite level in addition to the action-level fix in Change 2.
What alternative solutions did you explore? (Optional)
An alternative is to guard
canAccessReport(src/libs/ReportUtils.ts:9341) so that a report whose current user has just optimistically setnotificationPreference: HIDDEN(leave in flight) does not returnfalsefor the still-mounted details page. This would suppress the "Not here" render without touchingleaveRoom. However, this approach is fragile —canAccessReportis a broadly used utility and loosening its guard could mask genuine access errors on other report types. The action-level fix (Changes 1 and 2) is narrower and directly addresses the source.A second alternative is to defer
API.write(LEAVE_ROOM, ...)until after the navigation transition completes, usingInteractionManager.runAfterInteractionsorTransitionTracker.runAfterTransitions. This matches the pattern atDynamicReportDetailsPage.tsx:1114-1116for delete requests. The downside is that it defers the server call and may cause a brief UI state where the user appears to still be a participant. The dismiss-first approach in Changes 1 and 2 is simpler and keeps the API call timing unchanged.David-2002065 commentedon Jul 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:12:31 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the assignee opens a task from Reports > Tasks and taps Leave on the task's details page, the RHP flips to the "Hmm... it's not here" (Not found) page instead of quietly leaving the task and returning to a valid screen.
What is the root cause of that problem?
A task report is a thread (it has a
parentReportID/parentReportActionID), but it is not a chat thread —isChatThreadonly returnstruewhentype === CONST.REPORT.TYPE.CHAT, and a task's type isTASK.When Leave is pressed,
DynamicReportDetailsPagecallsleaveRoom. Its optimistic update branches onisWorkspaceMemberLeavingWorkspaceRoom || isChatThread. Because a task is neither, it falls into the else branch that nulls out the report (reportID: null,statusNum: CLOSED):App/src/libs/actions/Report/index.ts
Lines 4873 to 4896 in c88326a
The task's details page (
DynamicReportDetailsPage) is wrapped inwithReportOrNotFound, which decides the report exists purely from!!report?.reportID:App/src/pages/inbox/report/withReportOrNotFound.tsx
Lines 97 to 116 in c88326a
So the moment
leaveRoommergesreportID: null,isReportLoadedbecomesfalse,shouldShowNotFoundPagebecomestrue, and — since the details RHP is still focused (nothing dismissed it yet:getSearchThreadLeaveRoutealso early-returns for a task because it too gates onisChatThreadReportUtils) — the escape hatch at L120 (... && !isFocused) doesn't apply, andNotFoundPagerenders in place. This is exactly what the video shows: the URL stays on/search/view/<taskID>/detailswhile the RHP swaps to "it's not here".Note the main report screen already protects against this same optimistic-null race via a leaving flag, but the details wrapper has no equivalent:
App/src/pages/inbox/ReportNotFoundGuard.tsx
Line 56 in c88326a
The nulling is also wrong on its own: leaving a task doesn't delete it (it still appears in Reports > Tasks afterward), so it should be hidden, exactly like a chat thread — not treated as a deleted room.
What changes do you think we should make in order to solve the problem?
Treat task reports the same as chat threads in
leaveRoom, so leaving hides the report (sets the assignee'snotificationPreferencetoHIDDEN) instead of nulling it. Insrc/libs/actions/Report/index.ts, importisTaskReportfromReportUtilsand widen the condition:Apply the same
|| isTaskReportto the matchingsuccessDatabranch a few lines below (theif (isWorkspaceMemberLeavingWorkspaceRoom || isChatThread)check) so the success update also keeps the report and only sets the notification preference.With this,
report.reportIDis preserved on leave,isReportLoadedstaystrue, and the details page never flips to Not found — whilenavigateToMostRecentReportstill moves the user off the task. The task stays consistent with the server state that already keeps it listed in Reports > Tasks.What specific scenarios should we cover in automated tests to prevent this regression from occurring in the future?
leaveRoomwith a task report: assert the optimisticREPORTupdate setsparticipants[accountID].notificationPreference = HIDDENand does not setreportID: null/statusNum: CLOSED(mirroring the existing chat-thread expectation).leaveRoomon a task report,withReportOrNotFound'sisReportLoadedpredicate (!!report?.reportID) stays truthy, i.e. the Not found page is not shown.What alternative solutions did you explore? (Optional)
Give
withReportOrNotFoundthe same leaving-state escape hatch thatReportNotFoundGuardalready has — subscribe to${ONYXKEYS.COLLECTION.REPORT_USER_IS_LEAVING_ROOM}${reportID}and treat the report as still-present whileuserLeavingStatusistrue. This fixes the flash generically for any report type left with a details page open, but it's a presentation-layer patch that leaves the underlying "a left task gets nulled" inconsistency in place, so I'd prefer theleaveRoomfix as the primary and keep this as a defensive follow-up. A third option — extendinggetSearchThreadLeaveRouteto dismiss the RHP for task threads — only hides the symptom via navigation timing and still routes to the parent group chat rather than back to the Tasks list.ahmdshrif commentedon Jul 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:13:56 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The assignee opens the task from Reports > Task, navigates from it to the parent group chat, and taps Leave on the details page. Instead of landing on a valid screen, a full-page "Hmm... it's not here" appears once the leave completes.
What is the root cause of that problem?
The structural cause: the Search branch of
leaveGroupChatreveals the screen of the very report that leaving deletes from Onyx. It "preserves" a page that cannot survive the action.The Leave in this repro belongs to the parent group chat, not the task.
canLeaveChathas no branch fortype: 'task'— every branch requires chat-thread/room/expense-chat/IOU shapes — so a task's details page never renders a Leave item. The expected/actual results in the bug body confirm it: "Not here error page appears when assignee leave the group".App/src/libs/ReportUtils.ts
Lines 11575 to 11612 in 5ed347b
Because the user arrived via Reports > Task, Search is the topmost fullscreen route, so
leaveGroupChattakes its Search branch and callsrevealRouteBeforeDismissingModal(getReportRouteForCurrentContext({reportID}))— with thereportIDof the group chat being left:App/src/libs/actions/Report/index.ts
Lines 4874 to 4878 in 5ed347b
This branch was added in commit
f419320e13b(PR#93525, fixing#85560) to keep the user in the Search context instead of redirecting them to Inbox.The reveal inserts
SEARCH_REPORT(<left chat>)under the RHP and dismisses the RHP, parking the user on the doomed report's screen:App/src/libs/Navigation/Navigation.ts
Lines 1032 to 1052 in 5ed347b
Optimistically the page survives: the merge removes
reportIDbut setsstatusNum: CLOSED, andReportNotFoundGuardcounts a CLOSED report as an optimistic delete (reportExistsstays true):App/src/pages/inbox/ReportNotFoundGuard.tsx
Lines 52 to 56 in 5ed347b
When
LeaveGroupChatsucceeds,successDatamergesnull, wiping the whole report by design ("any remaining data is removed upon successful completion"). NowreportExistsis false and the guard renders the full-page "Not here":App/src/libs/actions/Report/index.ts
Lines 4856 to 4864 in 5ed347b
App/src/pages/inbox/ReportNotFoundGuard.tsx
Line 73 in 5ed347b
The auto-redirect that normally rescues a wiped report —
ReportNavigateAwayHandler, whose removal list already includesisGroupChat(prevReport)— deliberately early-returns for reports inside the right modal navigator (isInNarrowPaneModal), which is exactly where every Search-opened report lives. So no navigation fires and the user is stranded:App/src/pages/inbox/ReportNavigateAwayHandler.tsx
Lines 121 to 126 in 5ed347b
App/src/pages/inbox/ReportNavigateAwayHandler.tsx
Lines 159 to 169 in 5ed347b
Affected paths:
leaveGroupChathas a single call site (DynamicReportDetailsPage.tsx#L372-L380), and this reveal is the only place a to-be-deleted report is re-targeted (getReportRouteForCurrentContext's other consumers navigate to live reports). Wide and narrow layouts both reproduce (SEARCH_REPORT sits in the RightModalNavigator in both); offline, the CLOSED page shows until reconnect, then flips to "Not here" on sync. The task and User B leaving are just how QA reached the Search context — leaving any group chat from Reports > Chats reproduces it.What changes do you think we should make in order to solve the problem?
In
leaveGroupChat's Search branch, stop revealing the left report and dismiss the modal stack instead (src/libs/actions/Report/index.ts#L4874-L4878):The details RHP and the
SEARCH_REPORTscreen live in the same RightModalNavigator, so onedismissModal()closes both and lands the user on the Search table they came from (Reports > Task here; Spend > Chats in#85560), filters intact. This preserves PR#93525's intent — stay in Search context, never bounce to Inbox — while removing the dependency on a report that is about to cease to exist, online and offline. Regression safety in one sentence: the non-Search path (navigateToMostRecentReport) andleaveRoom/thread flows are untouched, and no other caller uses this reveal.Why the obvious spot fix fails: adding the task type to
ReportNavigateAwayHandler'sisRemovalExpectedForReportType(or leaning on that handler at all) cannot work — group chats are already in that list (L167) and the page still strands, because the handler'sisInNarrowPaneModalearly-return (L121-126) suppresses navigation for every Search-RHP report; and any "leaving the task" diagnosis targets the wrong report, sincecanLeaveChatnever shows Leave fortype: 'task'.What alternative solutions did you explore? (Optional)
REPORT_USER_IS_LEAVING_ROOMinleaveGroupChat(mirroringleaveRoom's broadcast) so the guard keeps passing — masks the wipe and parks the user indefinitely on a dead report page behind a flag nothing clears in this flow.statusNum: CLOSEDinsuccessDatasoisOptimisticDeletestays true — contradicts the explicit comment that all remaining data must be removed on success (server removal update must not linger) and leaves a ghost chat in Onyx.navigateToMostRecentReport— fixes the "Not here" but reintroduces#85560(user yanked out of Search into Inbox), breaking intentional behavior.melvin-bot commentedon Jul 17, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @bernhardoj (
External)[-]Not here page appears when assignee leave the task report[/-][+][$250] Not here page appears when assignee leave the task report[/+]melvin-bot commentedon Jul 17, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022078194371865323285
MobileMage commentedon Jul 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 19:09:01 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a task is created inside a group chat and the assignee later opens that task from Reports (filtered by type Task) and taps Leave on its details page, a full-page "Hmm... it's not here" error appears. On top of the visible error, the leave goes through the group-chat leave flow, so the task report gets permanently wiped from the assignee's Onyx data even though they are still the task's assignee.
What is the root cause of that problem?
The task report the assignee receives from the backend carries
chatType: 'group'inherited from the parent group chat. This is visible in the issue's attached video: one second after the task opens (when OpenReport data lands), the header avatar flips from the assignee's letter avatar to a group avatar, and the details page renders the group-chat variant (group avatar, Pin/Share, "Members — 4", Settings, Leave) instead of the task variant (Title/Description/Assignee). The client only expects this inheritance for #admins tasks —buildOptimisticTaskReportdeliberately inheritschatTypejust forPOLICY_ADMINSparents (see PR #84263, "Align optimistic task chatType inheritance with backend behavior") — but nothing sanitizes other inherited chat types on read, so every chatType-based classifier misfires for this task. In particularisRootGroupChatreturns true, because its thread exclusion usesisChatThread, which requirestype === CHATwhile a task's type isTASK, so a task thread slips past the "root" check:App/src/libs/ReportUtils.ts
Lines 11013 to 11015 in 5ed347b
With the task misclassified as a root group chat,
canLeaveChatreturns true (its very first clause isisRootGroupChat), which is why a Leave row appears on a task details page at all, andleaveChatinDynamicReportDetailsPagetakes theisRootGroupChatbranch and callsleaveGroupChat(report, ...)— notleaveRoom— sending the LeaveGroupChat API command for a task report.leaveGroupChatimmediately applies an optimistic merge that nulls the report's identity:App/src/libs/actions/Report/index.ts
Lines 4833 to 4837 in 5ed347b
Because the task was opened from the Search context,
isSearchTopmostFullScreenRoute()is true andleaveGroupChatschedules the RHP dismissal throughNavigation.revealRouteBeforeDismissingModal, which defers it by two animation frames, whileAPI.writeapplies the optimistic wipe right away. The details RHP is still mounted and focused at that moment, and it is wrapped inwithReportOrNotFound, whose gate isconst isReportLoaded = !isEmptyObject(report) && !!report?.reportIDfeedingshouldShowNotFoundPage = !isReportLoaded || ...; its "navigating away" escape hatch only returns null when!isFocused, which hasn't happened yet. So the momentreportIDis nulled, the focused details page renders the full-page NotFoundPage — the video shows the "Hmm... it's not here" frame while the URL is still/search/view/<taskReportID>/details, before the deferred dismissal lands the user back on the Tasks list. The successData then mergesnullover the report, so the task report stays wiped for the assignee.What changes do you think we should make in order to solve the problem?
Fix the misclassification at its single choke point,
getChatType, so a task report is never treated as a group chat (or any other room type) just because the backend copied the parent'schatTypeonto it, while keeping the one inheritance the client intentionally supports (POLICY_ADMINS, used for Concierge/#admins task routing):App/src/libs/ReportUtils.ts
Lines 1246 to 1248 in 5ed347b
All the misbehaving classifiers (
isGroupChat,isRootGroupChat,isUserCreatedPolicyRoom,isPolicyExpenseChat,isChatRoom) read throughgetChatType, so with this changeisRootGroupChat(task)is false,canLeaveChat(task)is false, the bogus Leave row disappears,leaveGroupChatbecomes unreachable for tasks, and the details page renders the proper task layout (Title/Description/Assignee) with the correct task icons. This also restores parity between server-loaded and optimistically-created tasks: the creator's optimistic task (built withoutchatTypebybuildOptimisticTaskReport) and the same task after server sync now classify and render identically, which is exactly the model PR #84263 established. The change is safe for other callers: real group chats havetype: CHATso they are untouched, #admins tasks keepPOLICY_ADMINS,canJoinChatstill returns false for tasks (its final clause requires a chat thread or room type), andParticipant/option objects without atypefield pass through unchanged. A unit test can be added alongside the existing chatType-inheritance tests intests/actions/TaskTest.tsasserting thatgetChatTypereturns undefined for a task carryingchatType: 'group'.What alternative solutions did you explore? (Optional)
A narrower fix is changing
isRootGroupChat's exclusion from!isChatThread(report)to!isThread(report), which hides the Leave row and blocks theleaveGroupChatcall for this exact repro; we rejected it because the task would still be classified as a group chat everywhere else (group avatar and group name section on the details page, wrong icons in LHN/Search), and the same destructive-leave family stays reachable if the backend inherits a different chat type (for example a task in a #room classifying as a user-created policy room makescanLeaveChattrue and routes intoleaveRoom's report-wiping branch). We also ruled out patchingleaveRoom'sisChatThreadgate orReportNavigateAwayHandler: neither is involved in this flow, since the misclassification routes the leave throughleaveGroupChat, and the visible "not here" is produced bywithReportOrNotFoundon the still-focused details RHP before the deferred dismissal runs.49 remaining items
melvin-bot commentedon Aug 3, 2026
@bernhardoj
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.48-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-08-10. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
bernhardoj commentedon Aug 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: N/A
Link to the comment on the Issue: N/A
Not a regression, at least on the FE side.
isRootGroupChatlogic has been like that since it's implemented.[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/671215
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-e0d8-a2d5-1353-37d6e42c7a74bernhardoj commentedon Aug 10, 2026
@Valforte can we reopen this?
melvin-bot commentedon Aug 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 12, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 13, 2026
Payment Summary
Contributor: @MobileMage paid $250 via Upwork
Contributor+: @bernhardoj due $250 via NewDot
^ Test case created. Thx
flaviadefaria commentedon Aug 21, 2026
Approved: @bernhardoj due $250 via NewDot