App icon indicating copy to clipboard operation
App copied to clipboard

[$250] 93267 - Android - Onboarding - User is not directed to workspace admin report

Open applause-bot[bot] opened this issue 5 months ago • 27 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.4.25-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://github.com/Expensify/App/pull/93267 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Android 16 / Samsung Galaxy A06 App Component: Workspace Settings

Action Performed:

  1. Open Expensify App
  2. Login with new account
  3. In onboarding steps, choose "Manage my team's expenses" > "1-4 employees" > "QuickBooks Online" > Click "Continue"

Expected Result:

The workspace is created and you are redirected to workspace admin report

Actual Result:

User is not redirected to workspace admin report

Workaround:

Unknown

Platforms:

  • [x] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/cd7b3e58-bb57-407d-b234-f484d4432eab

View all open jobs on GitHub

Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7195500

Upwork Automation - Do Not Edit

applause-bot[bot] avatar Jun 30 '26 15:06 applause-bot[bot]

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

applause-bot[bot] avatar Jun 30 '26 15:06 applause-bot[bot]

Proposal

What is the root cause of that problem?

On a small screen (Android), the post-onboarding redirect can never land the user on the brand-new workspace's #admins room.

After onboarding completes, navigateAfterOnboarding calls getReportIDAfterOnboarding. The two screen sizes behave very differently:

  • Large screen returns onboardingAdminsChatReportID directly → works (navigateAfterOnboarding.ts:41-46).
  • Small screen ignores onboardingAdminsChatReportID and instead derives the target from findLastAccessedReport, which cannot resolve to the new #admins room (navigateAfterOnboarding.ts:48-57):
    1. The filter lastAccessedReport.policyID !== onboardingPolicyID explicitly excludes the new workspace's #admins room, because that room's policyID is onboardingPolicyID.
    2. The intended fallback — navigate to ROUTES.HOME "to trigger guard evaluation" (L96-101) — passes the bare route 'home' with no ?openOnAdminRoom=true. The HOME-side guard (ReportsSplitNavigator → shouldOpenOnAdminRoom) only opens the #admins room when that URL param is present, and nothing in the in-app onboarding flow ever sets it.

So getReportIDAfterOnboarding returns undefined → the user is sent to Home / last-accessed report instead of the new #admins room.

Why this is not caused by PR #93267 (the "93267 -" title prefix)

The title prefix reflects that QA found this while testing PR #93267, not that the PR caused it:

  • PR #93267's changes are confined to prepareOnboardingOnyxData (optimistic onboarding task data) and do not touch the redirect path. The redirect uses the raw adminsChatReportID/policyID returned synchronously from createWorkspace (BaseOnboardingInterestedFeatures.tsx:255-266), not the useOnyx-derived report objects the PR added.
  • For MANAGE_TEAM, targetChatReport falls back to a stub so completeOnboarding does not early-return or throw — navigation always runs.
  • The issue reproduces in production, consistent with a pre-existing small-screen logic gap rather than a fresh regression.

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

In getReportIDAfterOnboarding (navigateAfterOnboarding.ts:29-58), make the small-screen branch return the onboarding workspace's #admins room when one was created during onboarding — i.e. return onboardingAdminsChatReportID (respecting shouldPreventOpenAdminRoom) before falling through to the findLastAccessedReport logic, mirroring what the large-screen branch already does. This is the most direct fix and keeps both screen sizes consistent.

What alternative solutions did you explore? (Optional)

  • Navigate to ROUTES.HOME with ?openOnAdminRoom=true appended so the existing ReportsSplitNavigator guard fires and selects the #admins room.
  • Adjust the policyID !== onboardingPolicyID filter so it stops excluding the just-created workspace's #admins room (riskier — that filter also guards against self-DM/Concierge, so it needs care).
Possibly related issues (from a quick scan — may be the same redirect area)
  • Expensify/App#91144 — not redirected to #admin room after "Take a test drive"
  • Expensify/App#94549 — member redirects to Home instead of Workspace chat
  • Expensify/App#85242 — home page appears instead of the room after signing in

These are not confirmed duplicates; they touch the same "redirect to the right report after onboarding/sign-in" area.

One caveat to verify: Android is a HybridApp build, so the OldDot↔NewDot native handoff (in the Mobile-Expensify submodule, not in this repo) could be involved in setting up the URL/route. The pure-App logic above does not set openOnAdminRoom=true, but it's worth confirming the native layer doesn't also play a role on Android specifically.


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

MelvinBot avatar Jun 30 '26 15:06 MelvinBot

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 16:03:54 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

When someone signs up on Android and goes through the "Manage my team's expenses" flow, a workspace gets created but they're dropped on Home instead of the new workspace's #admins room. On web this works fine, so it only shows up on phones and other small screens.

What is the root cause of that problem?

The redirect is decided by getReportIDAfterOnboarding in src/libs/navigateAfterOnboarding.ts, and its two branches don't behave the same way. The large-screen branch returns onboardingAdminsChatReportID directly, so web lands on the #admins room (navigateAfterOnboarding.ts:41-46). The small-screen branch ignores that report ID entirely and instead asks findLastAccessedReport, then filters the result with lastAccessedReport.policyID !== onboardingPolicyID (navigateAfterOnboarding.ts:48-55).

That filter is what kills it. The #admins room we just created belongs to the onboarding policy, so its policyID is exactly onboardingPolicyID, and the guard rejects it. The comment right above the check even says the user should be taken to the #admins room, but the code filters that room out. For a brand-new account the only other candidate is Concierge or the self-DM, both of which are also rejected. So every candidate is filtered, the function returns undefined, and navigateAfterOnboarding falls into the else and pushes ROUTES.HOME (navigateAfterOnboarding.ts:96-101).

There's a second reason the small-screen path can never recover on native. The only way findLastAccessedReport would consider an admins room is if shouldOpenOnAdminRoom() returns true, but that helper reads the openOnAdminRoom query param from getCurrentUrl(), and the native implementation of getCurrentUrl is hard-coded to return '' (src/libs/Navigation/currentUrl/index.native.ts:3). So on native it's always false and that escape hatch is dead too.

This isn't from the PR in the title (#93267). That PR's changes sit in the onboarding Onyx/task data and don't touch this redirect, which is why the bug reproduces in production. The asymmetric small-screen branch has been here since the report-selection logic was reworked (regression around 237769e02b6). The QuickBooks choice in the repro steps is incidental, the team flow always creates a workspace regardless of the accounting integration picked.

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

Make getReportIDAfterOnboarding prefer the onboarding #admins room on both screen sizes before it falls back to findLastAccessedReport. We already pass onboardingAdminsChatReportID into the function and the large-screen branch already returns it, so the fix is to hoist that check above the isSmallScreenWidth split:

if (onboardingAdminsChatReportID && !shouldPreventOpenAdminRoom) {
    return onboardingAdminsChatReportID;
}

Then keep the existing findLastAccessedReport logic only for the case where there's no onboarding admins room or opening it is intentionally prevented (shouldPreventOpenAdminRoom, used by test accounts). This is the single point every onboarding-completion page routes through, so the one change covers all the entry points rather than patching each page.

This area has a test gap, tests/unit/navigateAfterOnboardingTest.ts doesn't cover the small-screen case where an admins report is provided and the last-accessed report belongs to onboardingPolicyID. I'd add a test that asserts navigation goes to ROUTES.REPORT_WITH_ID.getRoute(onboardingAdminsChatReportID) for that case, and keep the existing coverage that avoids Concierge/self-DM and honors shouldPreventOpenAdminRoom. Affects Android, iOS, mWeb, and narrow-desktop layouts.

What alternative solutions did you explore? (Optional)

One option is to loosen the small-screen filter so the policyID !== onboardingPolicyID check still allows the onboarding policy's #admins room while excluding the self-DM and Concierge. That works but leaves the two branches doing different things for no real reason, and it still depends on findLastAccessedReport resolving the right report. Another is to set ?openOnAdminRoom=true so the existing guard fires, but getCurrentUrl returns empty on native so that path can't work there anyway. Hoisting the admins-room check matches what the large screen already intends and keeps one navigation contract for every onboarding flow.

shivang-goliyan avatar Jun 30 '26 15:06 shivang-goliyan

Proposal

What is the root cause of that problem?

The "Manage my team's expenses" flow creates a workspace and finishes onboarding in BaseOnboardingInterestedFeatures, which then calls navigateAfterOnboardingWithMicrotaskQueue with the freshly-created adminsChatReportID:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L255-L266

That call routes into getReportIDAfterOnboarding, which decides the destination report. The function is asymmetric by design — its own JSDoc says it "navigates to the admins chat if available" only on large screens, while small screens fall back to findLastAccessedReport:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/navigateAfterOnboarding.ts#L24-L58

On large screens it returns onboardingAdminsChatReportID directly (so web works):

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/navigateAfterOnboarding.ts#L41-L46

On small screens (native) it instead asks findLastAccessedReport, gated by shouldOpenOnAdminRoom():

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/navigateAfterOnboarding.ts#L48-L55

Two things make this never resolve to the new workspace's #admins room on native:

  1. shouldOpenOnAdminRoom() reads the openOnAdminRoom query param from the current URL — but getCurrentUrl() is hard-coded to return '' on native, so it is always false. The admins-room branch inside findLastAccessedReport is therefore never taken on native.

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/Navigation/currentUrl/index.native.ts#L1-L5 https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/Navigation/helpers/shouldOpenOnAdminRoom.ts#L1-L7 https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/ReportUtils.ts#L2430-L2438

  1. With openOnAdminRoom false, findLastAccessedReport returns the most-recently-visited report (Concierge / self-DM for a brand-new account), and the guard explicitly rejects any report whose policyID === onboardingPolicyID, plus Concierge and self-DM. So the new workspace's #admins room is filtered out too.

Result: getReportIDAfterOnboarding returns undefined, and navigateAfterOnboarding falls into the else branch and pushes ROUTES.HOME instead of the workspace admin report:

https://github.com/Expensify/App/blob/0d736c70946f87c7218f6a332f37e068fa4f7dd0/src/libs/navigateAfterOnboarding.ts#L96-L101

So: native onboarding → small-screen branch → shouldOpenOnAdminRoom() is always false and the policyID === onboardingPolicyID guard filters out the new #admins room → undefined → HOME → user is not taken to the workspace admin report. This is platform-specific (native only) and not introduced by the auto-linked PR #93267 (a ReportUtils Onyx-connect refactor that does not touch this navigation) — it is the pre-existing native gap surfaced during its QA, which is why it reproduces in production too. The accounting choice (QuickBooks Online) is incidental; the team flow always creates a workspace.

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

We already pass the exact destination (onboardingAdminsChatReportID) into the function, and the large-screen branch already returns it. The fix is to apply that same, already-in-scope branch on every screen size before falling back to the small-screen findLastAccessedReport heuristic — hoist it above the isSmallScreenWidth check in getReportIDAfterOnboarding:

-    if (!isSmallScreenWidth) {
-        if (onboardingAdminsChatReportID && !shouldPreventOpenAdminRoom) {
-            return onboardingAdminsChatReportID;
-        }
-        return undefined;
-    }
+    if (onboardingAdminsChatReportID && !shouldPreventOpenAdminRoom) {
+        return onboardingAdminsChatReportID;
+    }
+
+    if (!isSmallScreenWidth) {
+        return undefined;
+    }

This is minimal and regression-safe:

  • Team flow (native): onboardingAdminsChatReportID is the just-created admins chat report ID → user is navigated straight to the workspace #admins room.
  • The shouldPreventOpenAdminRoom guard (set for + test accounts whose onboarding tasks live in Concierge) is preserved, so those still skip to the findLastAccessedReport fallback.
  • For the Personal/Track sibling flows, the 6th argument is mergedAccountConciergeReportID, which is undefined for normal new-account onboarding (here and here), so they keep falling through to findLastAccessedReport exactly as today; in the niche merged-account-validation case where it is set, native simply becomes consistent with the existing large-screen behavior.

Minor changes/improvements can be discussed in the PR phase.

What alternative solutions did you explore? (Optional)

Make findLastAccessedReport resolve the admins room on native by both forcing openOnAdminRoom true (independent of getCurrentUrl()) and relaxing the policyID !== onboardingPolicyID guard to allow the onboarding workspace's #admins room. This touches the shared findLastAccessedReport/guard logic used by many other call sites and carries real regression risk, whereas the main solution reuses the destination we already computed and pass in, with a far smaller blast radius.

yusufdeveloper2903 avatar Jun 30 '26 15:06 yusufdeveloper2903

🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

abbasifaizan70 avatar Jun 30 '26 15:06 abbasifaizan70

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 16:20:55 UTC.

Proposal

What is the root cause of that problem?

The manage-team onboarding flow stores the selected QuickBooks integration, then the interested-features step creates or reuses the workspace and has the new policy ID plus adminsChatReportID available for post-onboarding navigation.

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx#L176-L185

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L188-L242

After completing onboarding, this flow passes (session?.email ?? '').includes('+') as shouldPreventOpenAdminRoom. The reported Android QA account is a plus-address account, so the code explicitly suppresses opening the workspace #admins report even though this flow just created it and passes its report ID.

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L254-L265

On Android/small layouts, getReportIDAfterOnboarding also does not directly return onboardingAdminsChatReportID; it only does that on wide layouts. The small-layout fallback asks for the last accessed report, rejects reports from the onboarding policy, and returns undefined, so navigateAfterOnboarding falls back to Home instead of opening the new workspace admin report.

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L29-L57

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L87-L100

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

Update the manage-team interested-features navigation so it no longer uses the presence of + in the email address as the reason to prevent opening the workspace admin report. That path should pass false, or derive the prevention from an explicit Concierge target such as the trackExpensesWithConcierge variant, because the manage-team QuickBooks flow already has an adminsChatReportID and should land there.

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L254-L265

Also update getReportIDAfterOnboarding so small layouts prefer onboardingAdminsChatReportID when it is present and opening the admin room is not explicitly prevented. Keep the existing last-accessed-report fallback for cases without an onboarding admin room, and keep the existing Concierge variant handling before this helper.

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L29-L57

Test coverage:

  • Add a unit test for small-screen manage-team onboarding where onboardingAdminsChatReportID is present and the last accessed report belongs to onboardingPolicyID; assert navigation goes to ROUTES.REPORT_WITH_ID.getRoute(onboardingAdminsChatReportID).
  • Update the plus-address test-account coverage so the manage-team path no longer suppresses the admin report just because the email contains +.
  • Keep coverage for the explicit Concierge/track variant and for avoiding Concierge/self-DM fallback reports.
  • Manually verify on Android that choosing Manage my team's expenses > 1-4 employees > QuickBooks Online lands in the new workspace #admins report.

What alternative solutions did you explore? (Optional)

Only changing the small-screen helper would fix non-test accounts, but the reported plus-address account would still pass shouldPreventOpenAdminRoom=true. Only removing the plus-address guard would still leave the Android helper dependent on a last-accessed-report fallback that can return Home. Updating both keeps the flow aligned with the expected workspace admin report destination.

KJ21-ENG avatar Jun 30 '26 15:06 KJ21-ENG

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

melvin-bot[bot] avatar Jun 30 '26 15:06 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

After creating a workspace through the “Manage my team's expenses” onboarding flow on Android, the user is sent home instead of to the workspace’s #admins report.

What is the root cause of that problem?

In src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx, the useEffect that derives onboarding navigation metadata returns whenever onboardingPolicyID already exists. If the policy ID arrives before paidGroupPolicy.chatReportIDAdmins, the effect never calls setOnboardingAdminsChatReportID().

Consequently, getReportIDAfterOnboarding() in src/libs/navigateAfterOnboarding.ts receives no admins report ID. On small screens it can reject the last-accessed report because it belongs to the onboarding policy, then falls back to ROUTES.HOME.

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

Update the effect in BaseOnboardingAccounting to initialize the two values independently: only set onboardingPolicyID when it is missing, and set onboardingAdminsChatReportID whenever paidGroupPolicy.chatReportIDAdmins becomes available. Do not use an existing policy ID as a reason to skip initializing the admins report ID.

This allows navigateAfterOnboarding() to navigate directly to the newly created workspace’s admins report on Android.

What alternative solutions did you explore? (Optional)

We could make navigateAfterOnboarding() rediscover the admins report from the policy, but fixing the incomplete onboarding metadata at its source is smaller and preserves the navigation helper’s existing contract.

kitvasyl avatar Jun 30 '26 15:06 kitvasyl

Proposal

What is the root cause of that problem?

On Android the redirect target is computed in getReportIDAfterOnboarding, and its small-screen branch can never return the workspace's #admins room.

When MANAGE_TEAM onboarding finishes, BaseOnboardingInterestedFeatures.handleContinue calls navigateAfterOnboardingWithMicrotaskQueue(isSmallScreenWidth, …, policyID, adminsChatReportID, shouldPreventOpenAdminRoom, rhpVariant). On native isSidePanelReportSupported is false so rhpVariant is undefined (https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L243-L266).

Inside navigateAfterOnboarding, shouldOpenRHPVariant is the native no-op that always returns false (https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/components/SidePanel/RHPVariantTest/index.native.ts#L1-L13), so the RHP-variant path is skipped and we fall to getReportIDAfterOnboarding.

There the two screen sizes diverge. On a wide screen it returns onboardingAdminsChatReportID directly, so desktop web lands on the admin report. On a narrow screen (Android) it ignores onboardingAdminsChatReportID entirely and instead derives a report through findLastAccessedReport, then filters that result out whenever it belongs to the onboarding policy:

https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L41-L57

For a brand-new workspace, every recently-touched report (the #admins room, the expense chat) belongs to onboardingPolicyID, so lastAccessedReport.policyID !== onboardingPolicyID is false and the function returns undefined. navigateAfterOnboarding then falls back to Navigation.navigate(ROUTES.HOME) (https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L96-L101). Nothing afterwards re-opens the admin room on native, so the user is left on the LHN/Home instead of the workspace admin report. The bug is Android-only purely because Android is a small-screen layout while the QA web platforms hit the wide-screen onboardingAdminsChatReportID branch.

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

Fix the data/navigation layer in getReportIDAfterOnboarding. The small-screen branch should honor the onboardingAdminsChatReportID it is already handed, the same way the wide-screen branch does, before falling back to findLastAccessedReport.

Concretely, at the top of the small-screen path in getReportIDAfterOnboarding (https://github.com/Expensify/App/blob/cd30fa18d4a595d5352571dc6cbb613464b709bc/src/libs/navigateAfterOnboarding.ts#L48-L57): if onboardingAdminsChatReportID is present and !shouldPreventOpenAdminRoom, return it directly. Only when there is no admins chat (e.g. join-existing flows that pass it as undefined) should we drop into the existing findLastAccessedReport logic. That keeps the +-test-account behavior (shouldPreventOpenAdminRoom) intact and keeps the HOME-guard fallback for flows that genuinely have no workspace.

This touches the "workspace created during onboarding" case only; the empty/undefined admins-chat path and the offline path are unchanged.

What alternative solutions did you explore? (Optional)

  • Navigate to the admin room inside BaseOnboardingInterestedFeatures.handleContinue directly instead of going through getReportIDAfterOnboarding. Rejected because the same wide-vs-narrow asymmetry exists for the other callers of navigateAfterOnboardingWithMicrotaskQueue (BaseOnboardingPersonalDetails, BaseOnboardingPurpose), so the fix belongs in the shared helper, not one screen.

  • Relying on the Navigation.navigate(ROUTES.HOME) "trigger guard evaluation" fallback to open the admin room. Rejected: on native the RHP-variant handler is a no-op and onboardingPolicyID/onboardingAdminsChatReportID are cleared right after navigation (setOnboardingPolicyID()), so there is no surviving signal for a Home-side guard to reopen the correct admins room.

oqildev avatar Jun 30 '26 15:06 oqildev

Job added to Upwork: https://www.upwork.com/jobs/~022071986741983530195

melvin-bot[bot] avatar Jun 30 '26 15:06 melvin-bot[bot]

⚠️ @KJ21-ENG Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Jun 30 '26 15:06 github-actions[bot]

⚠️ @oqildev Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Jun 30 '26 15:06 github-actions[bot]

⚠️ @abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

github-actions[bot] avatar Jun 30 '26 15:06 github-actions[bot]

🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 16:31:49 UTC.

Proposal

What is the root cause of that problem?

After the "Manage my team's expenses" interested-features step completes, BaseOnboardingInterestedFeatures calls navigateAfterOnboardingWithMicrotaskQueue with shouldPreventOpenAdminRoom derived from whether the login email contains +:

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/pages/OnboardingInterestedFeatures/BaseOnboardingInterestedFeatures.tsx#L255-L265

That flag gates whether post-onboarding navigation may open the workspace #admins room:

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/libs/navigateAfterOnboarding.ts#L41-L48

However, where onboarding tasks are posted — and therefore where the user should land — is decided in completeOnboarding using two conditions that are not reflected in navigation:

https://github.com/Expensify/App/blob/a9769f747a5237ff9fd3002794b3a0de0a8e2c5d/src/libs/ReportUtils.ts#L11596-L11598

  • shouldPostTasksInAdminsRoom — isPostingTasksInAdminsRoom(engagementChoice) (manage-team intent, excluding most + test emails)
  • shouldDeferOptimisticTasks — engagementChoice === MANAGE_TEAM (server assigns inbox variant at response time)

The navigation call uses a simplified email.includes('+') heuristic instead of these shared conditions, so post-onboarding routing can disagree with where tasks were (or will be) placed.

On small screens (Android), getReportIDAfterOnboarding does not return onboardingAdminsChatReportID directly; it relies on findLastAccessedReport with shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom. When shouldPreventOpenAdminRoom is wrong, navigation fails to prefer the #admins room and the user falls through to Home — matching the issue repro.

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

1. Add shouldPreventOpenAdminRoomAfterOnboarding in ReportUtils

Create a shared util that accepts onboardingPurpose / engagementChoice and mirrors the completeOnboarding conditions at lines 11596–11598:

  • Compute shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice)
  • Compute shouldDeferOptimisticTasks = engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM
  • Return false when either is true (do not prevent opening the admin room)
  • Return true otherwise (prevent opening the admin room)

Export the helper for onboarding navigation call sites.

2. BaseOnboardingInterestedFeatures

Replace (session?.email ?? '').includes('+') with:

shouldPreventOpenAdminRoom: shouldPreventOpenAdminRoomAfterOnboarding(onboardingPurposeSelected)

This screen is always the manage-team path, so shouldDeferOptimisticTasks is true and the util returns false — admin-room navigation is allowed for all manage-team completions on this step.

3. Other navigateAfterOnboardingWithMicrotaskQueue call sites

Pass shouldPreventOpenAdminRoomAfterOnboarding(onboardingPurposeSelected) wherever a workspace is created before completing onboarding:

  • BaseOnboardingWorkspaces — when creating (not joining) a workspace
  • useAutoCreateTrackWorkspace — track flows (neither condition true → returns true)
  • BaseOnboardingPersonalDetails — only when a workspace was created in that step

Keep shouldPreventOpenAdminRoomAfterOnboarding(...) or true when no workspace is created and admin-room navigation does not apply.

What alternative solutions did you explore? (Optional)

nkdengineer avatar Jun 30 '26 16:06 nkdengineer

Updated my proposal.

What changed: Updated the proposal to cover the Android plus-address admin-room prevention and the small-screen report selection fallback.

Why: The reported account disables admin-room navigation before the helper can open the newly created workspace admin report.

KJ21-ENG avatar Jun 30 '26 16:06 KJ21-ENG

Updated proposal

nkdengineer avatar Jun 30 '26 16:06 nkdengineer

Proposal

Please re-state the problem that we are trying to solve in this issue.

After completing the "Manage my team's expenses" onboarding flow on Android, the workspace is created successfully, but the user is stranded on the Home screen instead of being redirected to the new workspace's #admins report.

What is the root cause of this problem?

The bug originates in getReportIDAfterOnboarding in src/libs/navigateAfterOnboarding.ts. Two separate logical gaps in this function combine to break navigation on mobile:

1. Screen-size asymmetry (affects real users on small screens)

On large screens, the function returns onboardingAdminsChatReportID immediately after a workspace is created. On small screens, this early return is skipped entirely, and the function instead falls through to searching for lastAccessedReport. That fallback then explicitly rejects the newly created workspace via the check lastAccessedReport.policyID !== onboardingPolicyID, so it returns undefined, which sends the user to ROUTES.HOME.

2. Missing Concierge handling for test accounts (affects QA with + emails)

QA testers use +-suffixed test accounts, which are intentionally routed to receive onboarding tasks in the Concierge chat rather than the admin room. BaseOnboardingInterestedFeatures correctly detects this and passes shouldPreventOpenAdminRoom = true. However, getReportIDAfterOnboarding never actually uses this flag to return conciergeReportID. Instead, execution falls through to the same fallback logic, which blocks Concierge via !isConciergeChatReport(lastAccessedReport, conciergeReportID) and returns undefined — landing the tester on ROUTES.HOME as well.

Both flaws share the same underlying issue: the function's early-return logic for a freshly created workspace only exists for the large-screen path, and it doesn't account for the shouldPreventOpenAdminRoom override at all.

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

Make the "workspace just created" handling explicit and screen-size independent, and honor shouldPreventOpenAdminRoom before any fallback logic runs. Concretely, update getReportIDAfterOnboarding in src/libs/navigateAfterOnboarding.ts:

function getReportIDAfterOnboarding(
    isSmallScreenWidth: boolean,
    canUseDefaultRooms: boolean | undefined,
    conciergeReportID: string,
    reportNameValuePairs: OnyxCollection<ReportNameValuePairs>,
    onboardingPolicyID?: string,
    onboardingAdminsChatReportID?: string,
    shouldPreventOpenAdminRoom = false,
): string | undefined {
    // 1. Workspace was just created for a real user: always go to the admin room,
    //    regardless of screen size.
    if (onboardingAdminsChatReportID && !shouldPreventOpenAdminRoom) {
        return onboardingAdminsChatReportID;
    }

    // 2. Workspace was just created for a test (+) account: route to Concierge
    //    instead of falling through to HOME.
    if (onboardingAdminsChatReportID && shouldPreventOpenAdminRoom) {
        return conciergeReportID;
    }

    // 3. No workspace was created in this flow — preserve existing large-screen behavior.
    if (!isSmallScreenWidth) {
        return undefined;
    }

    // Existing fallback logic for small screens is unchanged from here.
    const lastAccessedReport = findLastAccessedReport(
        !canUseDefaultRooms,
        shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom,
        undefined,
        reportNameValuePairs,
    );
    // ...rest of existing function body remains as-is
}

This keeps the two branches symmetric: whenever onboardingAdminsChatReportID is present — meaning a workspace was just created in this session — the function resolves immediately to the correct destination (admin room or Concierge) instead of deferring to the small-screen fallback search, which was never designed to recognize a report created moments earlier. The existing fallback path for cases where no workspace was created (e.g., returning users, non-onboarding navigation) is left untouched.

Result: Real users on Android are routed to the new workspace's #admins room immediately after onboarding, and + test accounts are correctly routed to Concierge, matching intended behavior on both screen sizes.

What alternative solutions did you explore? (Optional)

An alternative would be to fix only the small-screen fallback's policyID check to allow the newly created workspace through. That addresses flaw 1 but not flaw 2, since shouldPreventOpenAdminRoom is still never consulted for the Concierge redirect. Handling both cases with a single early-return block, as proposed above, avoids relying on the fallback search for a scenario (freshly created report) it wasn't designed to handle, and keeps the fix contained to one function.

Issue: https://github.com/Expensify/App/issues/94994

Pintu-Jha avatar Jul 02 '26 10:07 Pintu-Jha

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

melvin-bot[bot] avatar Jul 03 '26 23:07 melvin-bot[bot]

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

melvin-bot[bot] avatar Jul 04 '26 01:07 melvin-bot[bot]

Hi @Pujan92, just following up. @MelvinBot has flagged this as overdue. Happy to clarify anything about my proposal. Thanks!

Pintu-Jha avatar Jul 07 '26 02:07 Pintu-Jha