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-30] [$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js #96176
On Android HybridApp, NewDot completes authentication and then hands control to OldDot. That handoff is driven from HybridApp.ts in signInToOldDotAndChooseExperience, which signs the user into OldDot and asks it to pick which experience to render:
Once OldDot takes over, its own _oldResponseHandler in expensify.js fetches the account/policy payload. The Sentry stack shows OldDot receiving a successful HTTP 200 but with no usable policy in the response, so OldDot throws Crashing. Didn't get a policy and the JS exception bubbles up through yapl.android.Yapl.handleJSException.
The trigger from the NewDot side is timing: after NewDot marks the auth screens ready via setReadyToShowAuthScreens in HybridApp/index.ts, the sign-in transition can be started before the HybridApp session state is fully hydrated:
// This value is only relevant for HybridApp, so we can skip it in other environments.
When the OldDot sign-in is initiated while the HybridApp Onyx state (useNewDotSignInPage and related fields) is still transitional, OldDot proceeds to request policy for an account whose policy list has not yet propagated, receives an empty-but-successful response, and crashes.
/** Stores the information if HybridApp uses NewDot's sign-in flow */
useNewDotSignInPage?: boolean;
What changes do you think we should make in order to solve the problem?
In HybridApp.ts, guard signInToOldDotAndChooseExperience so the OldDot sign-in transition is only fired after the HybridApp session state is confirmed hydrated, avoiding the race where OldDot fetches policy against a not-yet-propagated account.
In HybridApp/index.ts, only call the OldDot handoff once setReadyToShowAuthScreens(true) has been committed, so the readiness flag and the sign-in transition cannot interleave.
// This value is only relevant for HybridApp, so we can skip it in other environments.
This keeps NewDot from pushing OldDot into its policy fetch before the account is ready, which is the condition that produces the empty policy 200 and the crash.
Because the throw itself lives in OldDot expensify.js, file a paired OldDot change so the policy response handler treats a 200 with no policy as a recoverable retry instead of a hard Crashing. Didn't get a policy exception, mirroring the iOS variant tracked in App#92414. This is the durable fix for the remaining events that are not caused by the handoff race.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-][Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/-][+][$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/+]on Jul 20, 2026
Android HybridApp users are hitting a hard OldDot crash "Crashing. Didn't get a policy" during the NewDot→OldDot handoff, with 123 users / ~1.5k events since Dec 2025. It happens after a successful 200 response, meaning OldDot's _oldResponseHandler in expensify.js gets a policy request response back but can't find a policy in it.
Root cause
signInToOldDotAndChooseExperience in src/libs/HybridApp.ts is what kicks off the OldDot sign-in and tells OldDot which policy to select:
activePolicyID comes from ONYXKEYS.NVP_ACTIVE_POLICY_ID (src/libs/HybridApp.ts:66-72) and is populated separately/async from the sign-in gating checks at src/libs/HybridApp.ts:85-105. Those gating checks verify session, credentials, and 2FA state, but never check that activePolicyID has actually loaded. Note the eslint-disable-next-line rulesdir/no-default-id-values right above the fallback — someone already had to explicitly bypass our own lint rule against faking an ID with an empty string default, which is a strong signal this was a known shortcut, not a safe default.
So on a fresh sign-in where the NVP hasn't propagated to Onyx yet (or the user genuinely has no active policy set), we call signInToOldDot with policyID: ''. OldDot takes that empty string, gets back a 200 on its account/policy fetch, but has nothing to select against it, and throws Crashing. Didn't get a policy in expensify.js's response handler instead of treating "no policy id" as "let me pick one myself."
Changes to make
This is a bug, so the fix should be the smallest thing that stops sending a bogus policy id, not a rearchitecture of the handoff:
In src/libs/HybridApp.ts:108-116, don't send policyID: '' as a stand-in for "no policy yet." Either:
omit policyID from the payload entirely when activePolicyID is undefined (if the native module/OldDot treats a missing key as "let OldDot pick"), or
gate the signInToOldDot call so it waits for activePolicyID to resolve (even to explicitly-empty/none) before firing, same way the function already waits on credentials and 2FA fields at src/libs/HybridApp.ts:98.
Since the actual throw lives in OldDot's expensify.js response handler (Mobile-Expensify submodule, not in this repo), pair this with a defensive fix there so a missing/empty policy on a 200 response falls back to a normal "select first policy" flow instead of a hard crash. That's the durable fix for any other path that can produce the same empty policyID case, and mirrors how the iOS twin (APP-75M / App#92414) is being tracked.
Alternatives
There's a human proposal already open on this issue that frames it as a hydration timing race and proposes gating on hybridApp?.readyToShowAuthScreens before firing the OldDot handoff. I don't think that's the actual trigger, readyToShowAuthScreens is set after this call by design (src/libs/actions/HybridApp/index.ts:129-135), so gating on it would create a chicken-and-egg deadlock rather than fix the crash. The eslint-disable comment right next to the activePolicyID ?? '' fallback is the more concrete smoking gun here, that's a self-flagged shortcut, not a race condition. I'd rather fix what's actually being sent over the bridge than add a readiness gate that doesn't touch the value causing the crash.
The crash has two layers — a bad input produced in this repo, and a hard throw in OldDot.
NewDot (this repo).signInToOldDotAndChooseExperience in src/libs/HybridApp.ts is retriggered by five Onyx connections (hybridApp, tryNewDot, credentials, session, account), and its readiness guards check all five — but never the active policy. activePolicyID comes from a sixth connection that only caches the value and does not retrigger the function:
On a fresh sign-in, session/credentials/account arrive straight from the sign-in responses, while nvp_expensify_activePolicyID only arrives later with OpenApp data. So the handoff routinely fires while the NVP is still undefined and sends policyID: '' — a fallback the code itself flags by suppressing the rulesdir/no-default-id-values lint rule:
OldDot (Mobile-Expensify submodule). OldDot signs in, then its policy bootstrap (_oldResponseHandler → the policy response handler in expensify.js, per the Sentry stack) gets an HTTP 200 whose payload contains no policy it can resolve against the empty ID, and throws Crashing. Didn't get a policy, which Android surfaces as a fatal crash through Yapl.handleJSException.
What changes do you think we should make in order to solve the problem?
In src/libs/HybridApp.ts, make the NVP_ACTIVE_POLICY_ID connection retrigger signInToOldDotAndChooseExperience, the same way the other five connections do. Without this, any "wait for the policy" gate would wait forever — nothing currently re-runs the function when the NVP arrives.
Add a guard so the handoff only fires once the active-policy state is known: either activePolicyID is set, or the initial app data load has completed (ONYXKEYS.HAS_LOADED_APP), which means the user genuinely has no active policy — in that case we hand off without inventing one and let OldDot use its own default policy selection. Distinguishing "not loaded yet" from "legitimately none" is what keeps policy-less users (e.g. fresh accounts) from being deadlocked out of OldDot.
Pair this with a small Mobile-Expensify (submodule) change: in the expensify.js policy response handler, treat a 200 with no resolvable policy as recoverable — fall back to OldDot's default policy selection instead of the hard Crashing. Didn't get a policy throw. This covers any residual server-side path that returns an empty policy set.
Result: NewDot stops sending a fabricated empty policyID during the race window, and OldDot no longer hard-crashes on the remaining empty-policy cases.
What alternative solutions did you explore? (Optional)
Gating the handoff on readyToShowAuthScreens: circular — that flag is set by this same function after signInToOldDot fires, so the gate would deadlock the sign-in.
Gating only on activePolicyID being truthy: deadlocks users who genuinely have no active policy NVP, and does nothing unless the NVP connection also retriggers the function (today it doesn't).
OldDot-only defensive fix: stops the crash but during the race users would still land in OldDot without their active workspace preselected; the NewDot timing fix is what removes the bad input at the source.
📣 @Hi-im-Connect! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
changed the title [-][$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/-][+][Due for payment 2026-08-30] [$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/+]on Aug 30, 2026
[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: Not Required. The existing checklist is good enough to capture such issues.
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
The PR link is missing because the fix for this issue landed in a different repo. The Resolving PRs: line is built by matching Expensify/App PRs that name the issue in their ### Fixed Issues section. This one was fixed by https://github.com/Expensify/Mobile-Expensify/pull/14059, so the lookup found nothing and the whole block was dropped silently.
This issue has no PR cross-reference at all in its timeline — there is no App PR to find. fedirjh posted the Mobile-Expensify PR link in a comment on 2026-08-16.
Across the 100 most recent Awaiting Payment App issues, every PR URL that appears in a Resolving PRs block is an Expensify/App PR — 57 of 57. No PR from another repo has ever shown up there.
The issues systematically missing the block are the HybridApp / OldDot ones, which is exactly the set whose fixes land outside the App repo.
The suggested fix on that issue: when the lookup comes back empty, fall back to scanning the issue's comments for any github.com/Expensify/*/pull/<n> URL and list those. That would have surfaced PR 14059 here.
One thing I couldn't check: I don't have read access to Mobile-Expensify, so I can't confirm whether PR 14059 links back to this issue in its ### Fixed Issues section. That detail changes which of two fixes is the right one, and I noted it on the tracking issue for someone with access to check.
Activity
melvin-bot commentedon Jul 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (
External)samranahm commentedon Jul 20, 2026
Proposal
What is the root cause of that problem?
On Android HybridApp, NewDot completes authentication and then hands control to OldDot. That handoff is driven from
HybridApp.tsinsignInToOldDotAndChooseExperience, which signs the user into OldDot and asks it to pick which experience to render:App/src/libs/HybridApp.ts
Line 78 in d24f5d7
Once OldDot takes over, its own
_oldResponseHandlerinexpensify.jsfetches the account/policy payload. The Sentry stack shows OldDot receiving a successful HTTP 200 but with no usable policy in the response, so OldDot throwsCrashing. Didn't get a policyand the JS exception bubbles up throughyapl.android.Yapl.handleJSException.The trigger from the NewDot side is timing: after NewDot marks the auth screens ready via
setReadyToShowAuthScreensinHybridApp/index.ts, the sign-in transition can be started before the HybridApp session state is fully hydrated:App/src/libs/actions/HybridApp/index.ts
Lines 129 to 130 in d24f5d7
When the OldDot sign-in is initiated while the HybridApp Onyx state (
useNewDotSignInPageand related fields) is still transitional, OldDot proceeds to request policy for an account whose policy list has not yet propagated, receives an empty-but-successful response, and crashes.App/src/types/onyx/HybridApp.ts
Lines 25 to 28 in d24f5d7
What changes do you think we should make in order to solve the problem?
HybridApp.ts, guardsignInToOldDotAndChooseExperienceso the OldDot sign-in transition is only fired after the HybridApp session state is confirmed hydrated, avoiding the race where OldDot fetches policy against a not-yet-propagated account.App/src/libs/HybridApp.ts
Line 78 in d24f5d7
HybridApp/index.ts, only call the OldDot handoff oncesetReadyToShowAuthScreens(true)has been committed, so the readiness flag and the sign-in transition cannot interleave.App/src/libs/actions/HybridApp/index.ts
Lines 129 to 130 in d24f5d7
This keeps NewDot from pushing OldDot into its policy fetch before the account is ready, which is the condition that produces the empty policy 200 and the crash.
expensify.js, file a paired OldDot change so the policy response handler treats a 200 with no policy as a recoverable retry instead of a hardCrashing. Didn't get a policyexception, mirroring the iOS variant tracked in App#92414. This is the durable fix for the remaining events that are not caused by the handoff race.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[-][Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/-][+][$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/+]melvin-bot commentedon Jul 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022079255433895395972
yuvrajangadsingh commentedon Jul 20, 2026
Proposal
Re-state problem
Android HybridApp users are hitting a hard OldDot crash "Crashing. Didn't get a policy" during the NewDot→OldDot handoff, with 123 users / ~1.5k events since Dec 2025. It happens after a successful 200 response, meaning OldDot's
_oldResponseHandlerinexpensify.jsgets a policy request response back but can't find a policy in it.Root cause
signInToOldDotAndChooseExperienceinsrc/libs/HybridApp.tsis what kicks off the OldDot sign-in and tells OldDot which policy to select:src/libs/HybridApp.ts:108-116activePolicyIDcomes fromONYXKEYS.NVP_ACTIVE_POLICY_ID(src/libs/HybridApp.ts:66-72) and is populated separately/async from the sign-in gating checks atsrc/libs/HybridApp.ts:85-105. Those gating checks verify session, credentials, and 2FA state, but never check thatactivePolicyIDhas actually loaded. Note theeslint-disable-next-line rulesdir/no-default-id-valuesright above the fallback — someone already had to explicitly bypass our own lint rule against faking an ID with an empty string default, which is a strong signal this was a known shortcut, not a safe default.So on a fresh sign-in where the NVP hasn't propagated to Onyx yet (or the user genuinely has no active policy set), we call
signInToOldDotwithpolicyID: ''. OldDot takes that empty string, gets back a 200 on its account/policy fetch, but has nothing to select against it, and throwsCrashing. Didn't get a policyinexpensify.js's response handler instead of treating "no policy id" as "let me pick one myself."Changes to make
This is a bug, so the fix should be the smallest thing that stops sending a bogus policy id, not a rearchitecture of the handoff:
src/libs/HybridApp.ts:108-116, don't sendpolicyID: ''as a stand-in for "no policy yet." Either:policyIDfrom the payload entirely whenactivePolicyIDis undefined (if the native module/OldDot treats a missing key as "let OldDot pick"), orsignInToOldDotcall so it waits foractivePolicyIDto resolve (even to explicitly-empty/none) before firing, same way the function already waits on credentials and 2FA fields atsrc/libs/HybridApp.ts:98.expensify.jsresponse handler (Mobile-Expensify submodule, not in this repo), pair this with a defensive fix there so a missing/empty policy on a 200 response falls back to a normal "select first policy" flow instead of a hard crash. That's the durable fix for any other path that can produce the same empty policyID case, and mirrors how the iOS twin (APP-75M / App#92414) is being tracked.Alternatives
There's a human proposal already open on this issue that frames it as a hydration timing race and proposes gating on
hybridApp?.readyToShowAuthScreensbefore firing the OldDot handoff. I don't think that's the actual trigger,readyToShowAuthScreensis set after this call by design (src/libs/actions/HybridApp/index.ts:129-135), so gating on it would create a chicken-and-egg deadlock rather than fix the crash. Theeslint-disablecomment right next to theactivePolicyID ?? ''fallback is the more concrete smoking gun here, that's a self-flagged shortcut, not a race condition. I'd rather fix what's actually being sent over the bridge than add a readiness gate that doesn't touch the value causing the crash.working branch with the fix applied: diff
Hi-im-Connect commentedon Jul 20, 2026
Proposal
What is the root cause of that problem?
The crash has two layers — a bad input produced in this repo, and a hard throw in OldDot.
NewDot (this repo).
signInToOldDotAndChooseExperienceinsrc/libs/HybridApp.tsis retriggered by five Onyx connections (hybridApp, tryNewDot, credentials, session, account), and its readiness guards check all five — but never the active policy.activePolicyIDcomes from a sixth connection that only caches the value and does not retrigger the function:App/src/libs/HybridApp.ts
Lines 66 to 72 in 6a1f1a3
On a fresh sign-in, session/credentials/account arrive straight from the sign-in responses, while
nvp_expensify_activePolicyIDonly arrives later with OpenApp data. So the handoff routinely fires while the NVP is stillundefinedand sendspolicyID: ''— a fallback the code itself flags by suppressing therulesdir/no-default-id-valueslint rule:App/src/libs/HybridApp.ts
Lines 108 to 116 in 6a1f1a3
OldDot (Mobile-Expensify submodule). OldDot signs in, then its policy bootstrap (
_oldResponseHandler→ the policy response handler inexpensify.js, per the Sentry stack) gets an HTTP 200 whose payload contains no policy it can resolve against the empty ID, and throwsCrashing. Didn't get a policy, which Android surfaces as a fatal crash throughYapl.handleJSException.What changes do you think we should make in order to solve the problem?
In
src/libs/HybridApp.ts, make theNVP_ACTIVE_POLICY_IDconnection retriggersignInToOldDotAndChooseExperience, the same way the other five connections do. Without this, any "wait for the policy" gate would wait forever — nothing currently re-runs the function when the NVP arrives.Add a guard so the handoff only fires once the active-policy state is known: either
activePolicyIDis set, or the initial app data load has completed (ONYXKEYS.HAS_LOADED_APP), which means the user genuinely has no active policy — in that case we hand off without inventing one and let OldDot use its own default policy selection. Distinguishing "not loaded yet" from "legitimately none" is what keeps policy-less users (e.g. fresh accounts) from being deadlocked out of OldDot.Pair this with a small Mobile-Expensify (submodule) change: in the
expensify.jspolicy response handler, treat a 200 with no resolvable policy as recoverable — fall back to OldDot's default policy selection instead of the hardCrashing. Didn't get a policythrow. This covers any residual server-side path that returns an empty policy set.Result: NewDot stops sending a fabricated empty
policyIDduring the race window, and OldDot no longer hard-crashes on the remaining empty-policy cases.What alternative solutions did you explore? (Optional)
readyToShowAuthScreens: circular — that flag is set by this same function aftersignInToOldDotfires, so the gate would deadlock the sign-in.activePolicyIDbeing truthy: deadlocks users who genuinely have no active policy NVP, and does nothing unless the NVP connection also retriggers the function (today it doesn't).melvin-bot commentedon Jul 20, 2026
📣 @Hi-im-Connect! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
42 remaining items
mountiny commentedon Aug 30, 2026
last one I see is 55 so yeah I think we are good
[-][$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/-][+][Due for payment 2026-08-30] [$250] [Sentry: APP-2WT] HybridApp Android OldDot crash — Didn't get a policy in expensify.js[/+]melvin-bot commentedon Aug 30, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 30, 2026
Payment Summary
BugZero Checklist (@mallenexpensify)
rojiphil commentedon Aug 31, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment
[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: Not Required. The existing checklist is good enough to capture such issues.
[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/677408
Regression Test Proposal
Precondition:
Test:
Didn't get a policyDo we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-a923-a575-825a-e4399fdf2c34mallenexpensify commentedon Sep 1, 2026
@MelvinBot we updated the payment summary to include a link to the associated PR. I don't see it above. Why is it missing? If something needs updating, can you review https://github.com/Expensify/Expensify/issues/676523 then add details to there?
mallenexpensify commentedon Sep 1, 2026
Payment Summary
Contributor+: @rojiphil due $250 via NewDot
MelvinBot commentedon Sep 1, 2026
The PR link is missing because the fix for this issue landed in a different repo. The
Resolving PRs:line is built by matchingExpensify/AppPRs that name the issue in their### Fixed Issuessection. This one was fixed by https://github.com/Expensify/Mobile-Expensify/pull/14059, so the lookup found nothing and the whole block was dropped silently.This is a different cause than the one already tracked, so I've added the details there — https://github.com/Expensify/Expensify/issues/676523 now covers both, along with a proposed fix that would catch this case.
Evidence
fedirjhposted the Mobile-Expensify PR link in a comment on 2026-08-16.Resolving PRsline. So this isn't a batch or rollout failure — it's a per-issue lookup miss.Awaiting PaymentApp issues, every PR URL that appears in aResolving PRsblock is anExpensify/AppPR — 57 of 57. No PR from another repo has ever shown up there.The suggested fix on that issue: when the lookup comes back empty, fall back to scanning the issue's comments for any
github.com/Expensify/*/pull/<n>URL and list those. That would have surfaced PR 14059 here.One thing I couldn't check: I don't have read access to Mobile-Expensify, so I can't confirm whether PR 14059 links back to this issue in its
### Fixed Issuessection. That detail changes which of two fixes is the right one, and I noted it on the tracking issue for someone with access to check.view run
quinthar commentedon Sep 2, 2026
Approved $250 to @rojiphil