App icon indicating copy to clipboard operation
App copied to clipboard

[$175] [Auto] - Android - Public Room - Error appears when opening public room as anon user

Open applause-bot[bot] opened this issue 1 month ago • 46 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.6-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/77804213/folder/13176964/41237765/1840872376?sort=%2Bidentifier Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Windows 10/Chrome App Component: Chat Report View

Action Performed:

Preconditions: New fresh install only; never visit the public room before on Android app

  1. Open the Public room https://staging.new.expensify.com/r/1540486774487195 via link as anon-user

Expected Result:

Can open the Public room normally

Actual Result:

Error appears "Auth OpenReport returned an error" and app navigate to Concierge

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/85815ee2-8864-4801-89f5-4f789c6b001a

View all open jobs on GitHub

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

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

applause-bot[bot] avatar Oct 09 '26 12:10 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/c91e16e8d2b98763d71f09c04abe38ecf6251f30e9c0f758c0514d09fccb6e79

applause-bot[bot] avatar Oct 09 '26 12:10 applause-bot[bot]

⚠️ Preliminary analysis (low confidence): treat this as a starting point, not a conclusion.

I think the backend rejects one of the OpenReport calls that App sends on a cold-start deep link. App then follows its "deep-linked report not found" fallback, which sends the anonymous user to Concierge.

What the App code shows:

Why I couldn't verify this:

  • I couldn't query production logs in this run, so I don't know which OpenReport call failed or what error code it returned.
  • I didn't find an App PR in 9.5.6-0 that clearly changed this flow. That points to a native-only timing difference or a backend change.
  • The issue is Android-only, and this run could only test on web.

To confirm:

  1. Reproduce on a fresh Android install.
  2. Find each OpenReport request for room 1540486774487195 and its error code.
  3. Check whether the failing call is the unauthenticated deep-link call or a later call made with the new anonymous session.
  4. Check whether the device created two anonymous accounts. That would mean the URL was handled twice, once from getInitialURL and once from the native url event in src/DeepLinkHandler.tsx:100-196.

If the backend rejects a valid request, the fix is outside the App repo. An internal engineer would need to handle it.


Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.


view run

MelvinBot avatar Oct 09 '26 12:10 MelvinBot

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

melvin-bot[bot] avatar Oct 09 '26 12:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 09 '26 12:10 melvin-bot[bot]

Proposal

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

On a fresh Android install, opening a public-room deep link as an anonymous user can show “Auth OpenReport returned an error” and redirect to Concierge instead of displaying the room.

What is the root cause of that problem?

The exact cause is not yet confirmed. The cold-start flow can request the same room from multiple places: the unauthenticated deep-link handler in Link.ts, AuthScreensInitHandler, and the retry in DeepLinkHandler. An unsuccessful OpenReport response can then be treated as “not found,” triggering the fallback to Concierge. We need to establish whether the failure is due to duplicated/racing calls, anonymous-session initialization, or a legitimate backend rejection before changing the behavior.

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

I'll reproduce the fresh-install deep-link path and trace the OpenReport requests, their authentication/session state, response codes, and the Onyx notFound transition. If the issue is client-side, I'll ensure the public-room deep link is processed once with a consistent anonymous session and avoid redirecting while a valid room load is still pending. I won't suppress genuine access errors or assume a client fix if logs show a backend problem.

I'll add regression coverage for the cold-start anonymous room link, repeated link events, and a truly unavailable room, and check that existing authenticated navigation still works.

krsnak avatar Oct 09 '26 13:10 krsnak

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa

Proposal

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

Android - On a fresh install, opening a public room deep link as an unauthenticated/anonymous user fails with "Auth OpenReport returned an error" and redirects to Concierge instead of opening the public room.

What is the root cause of that problem?

On Android cold launch from an external intent/deep link, React Native triggers both Linking.getInitialURL() (lines 100–127 in src/DeepLinkHandler.tsx) and fires the native 'url' listener (Linking.addEventListener('url', ...) at lines 167–196) with the exact same initial URL.

While initialUrlProcessed.current guards against re-running getInitialURL() on unauthenticated re-renders, the Linking.addEventListener('url') handler lacks a de-duplication check against the already-processed initial URL. Consequently, during cold start on Android, openReportFromDeepLink is invoked twice in rapid succession in an unauthenticated state:

  1. The first call begins unauthenticated openReport and anonymous session creation.
  2. The concurrent duplicate call races with the pending session, sending a conflicting unauthenticated OpenReport or triggering duplicate anonymous account creation.
  3. When the conflicting request fails, report.errorFields.notFound is set in Onyx, activating the fallback in src/libs/actions/Link.ts (lines 606–616) which calls navigateToConciergeChat().

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

  1. In src/DeepLinkHandler.tsx, maintain a ref to track the last processed URL (lastProcessedUrl = useRef<string | null>(null)).
  2. Set lastProcessedUrl.current = url when Linking.getInitialURL() successfully processes the initial URL.
  3. In Linking.addEventListener('url', (state) => { ... }), check if state.url === lastProcessedUrl.current. If the URL matches the one already processed on cold start, ignore the duplicate event. Clear or update lastProcessedUrl.current only when a genuinely distinct deep link arrives or when navigating away.
  4. Additionally in src/libs/actions/Link.ts, ensure openReportFromDeepLink de-duplicates concurrent in-flight requests for the same reportID when unauthenticated to prevent racing requests from clobbering Onyx state during cold boot.

What alternative solutions did you explore? (Optional)

Handling de-duplication solely at the network request queue layer (resolveOpenReportDuplicationConflictAction). However, intercepting and preventing the duplicate deep-link event at DeepLinkHandler.tsx prevents redundant authentication, Onyx connections, and navigation side-effects entirely.

jloa-dev avatar Oct 09 '26 14:10 jloa-dev

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

melvin-bot[bot] avatar Oct 09 '26 14:10 melvin-bot[bot]

Proposal

Root cause: On a fresh install, the anon session isn't established before OpenReport is called for the public-room deep link, so the API returns an auth error and the error handler bounces the user to Concierge. Fix approach: Ensure the anon session is initialised (or route through the unauthenticated public-room flow) before calling OpenReport from the deep link, and handle this specific error without navigating away. Verification: Fresh install, open the public room link as an anon user, and confirm the room opens without the auth error.

khizzcr7 avatar Oct 09 '26 20:10 khizzcr7

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

melvin-bot[bot] avatar Oct 12 '26 22:10 melvin-bot[bot]

Proposal

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

Android - On a fresh install, opening a public room deep link as an unauthenticated/anonymous user fails with "Auth OpenReport returned an error" and redirects to Concierge instead of opening the public room.

What is the root cause of that problem?

On Android cold launch from an external intent/deep link, React Native triggers both Linking.getInitialURL() (lines 100–127 in src/DeepLinkHandler.tsx) and fires the native 'url' listener (Linking.addEventListener('url', ...) at lines 167–196) with the exact same initial URL.

While initialUrlProcessed.current guards against re-running getInitialURL() on unauthenticated re-renders, the Linking.addEventListener('url') handler lacks a de-duplication check against the already-processed initial URL. Consequently, during cold start on Android, openReportFromDeepLink is invoked twice in rapid succession in an unauthenticated state:

  1. The first call begins unauthenticated openReport and anonymous session creation.
  2. The concurrent duplicate call races with the pending session, sending a conflicting unauthenticated OpenReport before the first completes.
  3. When the conflicting request fails, report.errorFields.notFound is set in Onyx, activating the fallback in src/libs/actions/Link.ts (lines 606–616) which calls navigateToConciergeChat().

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

In src/DeepLinkHandler.tsx:

  1. Maintain a ref to track the last processed URL:
const lastProcessedUrl = useRef<string | null>(null);
  1. Store url into lastProcessedUrl.current when Linking.getInitialURL() successfully resolves:
initialUrlProcessed.current = true;
lastProcessedUrl.current = url;
onInitialUrl(url as Route);
  1. In Linking.addEventListener('url', (state) => { ... }), check if state.url matches lastProcessedUrl.current. If it matches, ignore the duplicate event:
linkingChangeListener.current = Linking.addEventListener('url', (state) => {
    if (state.url && state.url === lastProcessedUrl.current) {
        return;
    }
    lastProcessedUrl.current = state.url;

What alternative solutions did you explore? (Optional)

  • Handling de-duplication solely at the network request queue layer (resolveOpenReportDuplicationConflictAction). However, intercepting and preventing the duplicate deep-link event at DeepLinkHandler.tsx prevents redundant authentication, Onyx connections, and navigation side-effects entirely.

What specific scenarios should we cover in automated tests?

In tests/unit/DeepLinkHandlerTest.tsx:

  1. Verify that when Linking.getInitialURL() resolves with a public room URL and Linking.addEventListener('url') subsequently fires with the same URL, openReportFromDeepLink is invoked exactly once.
  2. Verify that when Linking.addEventListener('url') fires with a genuinely new deep link URL during a warm session, openReportFromDeepLink correctly processes the new URL.

Contributor details Your Expensify account email: [email protected] Upwork Profile link: https://www.upwork.com/freelancers/~0170d6b02e9440e604

camesenin avatar Oct 13 '26 12:10 camesenin

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

melvin-bot[bot] avatar Oct 13 '26 12:10 melvin-bot[bot]

@thesahindia Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Oct 14 '26 21:10 melvin-bot[bot]

@situchan Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 22 '26 21:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 23 '26 21:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 28 '26 21:10 melvin-bot[bot]

@situchan Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Oct 30 '26 21:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 03 '26 23:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 04 '26 02:11 melvin-bot[bot]

@situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

melvin-bot[bot] avatar Nov 04 '26 03:11 melvin-bot[bot]