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
[$250] [DEV] Expense report/thread not loading properly #96718
Version Number: 9.4.41-4 (DEV only) Reproducible in staging?: Needs Reproduction Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@bernhardoj Slack conversation (hyperlinked to channel name): #expensify_bugs
Action Performed:
Open the App on DEV
Go to any expense report or thread
Expected Result:
The report or thread is loaded correctly, showing the report/thread name
Actual Result:
Infinite loading, loaded but with incorrect name or missing parent navigation subtitle (From "..,")
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
On DEV, opening any expense report or thread shows one of: infinite loading in the header, a loaded-but-incorrect report name, or a missing parent-navigation subtitle (From "…").
What is the root cause of that problem?
All three symptoms collapse to a single source of truth: the persisted reportAttributes Onyx derived value. The header title, the loading skeleton, and the From "…" subtitle all read the per-report reportName from it, so if that derived value doesn't hold a correct name for a report (and its parent), you get exactly these three symptoms:
Skeleton gate is purely isLoading = !report?.reportID || !title — HeaderView.tsx:282. Empty derived name → infinite loading.
getReportName falls back to the raw, often-stale report.reportName when the derived name is missing — ReportNameUtils.ts:1131. Stale derived value → incorrect name.
Why DEV-only:reportAttributes is persisted to disk — it is not in the RAM-only list (setup/index.ts:63). On launch it restores the on-disk value and recomputes incrementally: it seeds from the old value and only rebuilds reports that appear in the change deltas — reportAttributes.ts:306 and :560. A developer running an unreleased build (9.4.41-4) and switching branches accumulates a stale or wrong-schema persisted derived value; untouched reports keep their stale/empty names forever and are never rebuilt. Staging/production users on fresh data rarely hit this.
What changes do you think we should make in order to solve the problem?
Invalidate the persisted reportAttributes derived value and force a full recompute when it can't be trusted — e.g. add a schema/version stamp to the derived value and discard-then-fully-recompute on mismatch (rather than restoring and only updating incrementally). This makes a schema change or corrupted on-disk value self-heal on the next launch instead of silently persisting stale names.
Diagnostic to confirm before implementing (medium confidence)
This needs a DEV runtime confirmation to pin the exact trigger. Ask the reporter to check the DEV console for:
Log.info breadcrumbs from the derived engine — "restored from disk" vs a fresh compute, and any [OnyxDerived] compute for … threw (a swallowed throw in the compute would leave names stale for all reports — OnyxDerived/index.ts).
Whether clearing the local Onyx DB / storage fixes it (would confirm the stale-persisted-value theory).
Whether OpenReport actually resolves against the local backend (isolates the skeleton symptom, which is separately driven by isLoadingInitialReportActions).
A candidate secondary trigger is a __DEV__-only throw along the render/compute path (e.g. RenderHTML inside a <Text>, RenderHTML.tsx:47) getting swallowed by the derived compute's try/catch — which would also leave names unset on DEV only. The console error text would distinguish this from the stale-value path.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/96718) 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.
On DEV, opening an expense report or thread intermittently shows infinite loading, the wrong report name, or a missing parent-navigation subtitle ("From …").
What is the root cause of that problem?
The name shown for a report comes from the report_attributes derived Onyx value, read via getReportName(report, derivedReportName), which falls back to report.reportName ?? '' when the derived name is absent:
This gate was just reworked (derived-values optimization #96320 + onyx-store reland #96523) right before this DEV-only report. When a freshly-opened report's name depends on data that arrives without pushing that report's own key into updates (e.g. personal details / parent report resolving after the report), its derivedReportName is never computed. getReportName then returns ''/stale, and getParentNavigationSubtitle (reading the same state) yields no "From …" subtitle.
What changes do you think we should make in order to solve the problem?
Guarantee the visible report is always re-derived. In reportAttributes.ts, when useIncrementalUpdates is on, push the current report's key into dataToIterate if its report_attributes entry is still missing (else fall back to a full scan):
🚨 Edited by proposal-police: This proposal was edited at 2026-09-02 06:14:04 UTC.
Proposal
What is the root cause of that problem?
OnyxDerived.init() restores each derived value from disk, then opens the dependency connections. Until the last one initializes, every callback is thrown away before it is recorded:
// Before all connections are established, don't write to Onyx.
// This prevents overwriting a valid disk-cached value with empty defaults,
// and avoids N-1 unnecessary Onyx writes during initialization.
// We still update dependencyValues via setDependencyValue so data accumulates correctly.
if(!areAllConnectionsSet){
Log.info(`[OnyxDerived] not all connections set for ${key}, deferring Onyx write`);
return;
}
reportAttributes has fourteen dependencies, and one of them is the locale, whose connection only initializes once translations finish loading. On DEV that takes seconds, so the window is wide. I drove a cold boot on the local dev server and watched what falls into it:
Derived value for reportAttributes restored from disk at 1.94s, immediately followed by thirteen not all connections set for reportAttributes, deferring Onyx write. Nothing is added to the pending set, so no delta survives.
The ReconnectApp response applied its onyxData at 4.28s. Six more dependency callbacks were dropped right behind it, carrying that payload's report, report action and metadata writes.
All connections initialized for key: reportAttributes only at 11.03s, when translations loaded. Exactly one compute followed it, 3ms long.
That single flush is the problem. It is the first one, so hasFlushedOnce is false and the engine cannot reconstruct any delta, and it hands the config sourceValues === undefined:
And the same flush stages the collection baselines. So the data that arrived during the window is now folded into the baseline: no future change will ever name those reports, and the disk value stands forever.
I confirmed the consequence deterministically. Setting a report while the locale connection is still pending leaves it with no entry in the derived value at all:
From there the three reported symptoms are the same defect seen from three angles. The header title is the derived name, and the skeleton gate is only !title, so a missing entry pins the report on infinite loading:
A stale entry gives the wrong name, and a missing or stale entry on the parent is what silently removes the From "…" line, since getParentNavigationSubtitle is fed the parent's derived name:
Why it shows up on DEV and not in production is ordering, not corruption. The disk value is well-formed and the right shape; it is simply never reconciled. On a production build the bundle and the translations chunk are ready long before the startup response, so the payload arrives after the connections are set and the normal incremental path handles it. On DEV the module graph and the locale chunk are slow, the API is not, and the payload lands inside the window instead.
sequenceDiagram
autonumber
participant S as Server
participant O as Onyx
participant E as DerivedEngine
E->>O: restore reportAttributes from disk at 1.94s
O-->>E: 13 dependency callbacks, all deferred
S-->>O: ReconnectApp onyxData at 4.28s
O-->>E: 6 more callbacks, all deferred
Note over E: nothing recorded, pendingDependencyIndexes stays empty
E->>E: translations load, last connection set at 11.03s
E->>O: first flush, sourceValues undefined, writes the disk value back
Note over O: report present, reportAttributes entry absent, title empty
Loading
What changes do you think we should make in order to solve the problem?
The engine knows something the config cannot infer: the first flush is the only one with no delta baselines, so "no source values" there means "I have no idea what changed", not "nothing changed". I would surface that on the compute context and let reportAttributes reconcile once against the complete dependency snapshots.
In src/libs/actions/OnyxDerived/index.ts and types.ts, mark the flush; in src/libs/actions/OnyxDerived/configs/reportAttributes.ts, fold it into the existing needsFullRecompute so useIncrementalUpdates turns off for that one pass:
The reduce already seeds from currentValue.reports, so this is a merge, not a wipe: reports that were correct keep their entries, missing ones get built, stale ones get rebuilt. resetForClear sets hasFlushedOnce back to false, so the flush after an Onyx.clear() reconciles the same way, which is what that reset already wants.
I verified both ends. A regression test that sets a report while the locale connection is still pending fails on current main with reportAttributes.reports.arriving === undefined and passes with this change, and the 65 tests in OnyxDerivedTest, OnyxDerivedSelfHealTest and reportAttributesTest stay green. In the browser I re-ran the same cold boot afterwards: the boot compute goes from 3ms to 22ms across 247 reports and the app renders normally, so the cost is one full scan per cold start, over data already in memory, which is what a fresh install does today anyway.
This does not touch the guard the deferral was added for. No derived value is written while dependencies are incomplete, and every later flush keeps its current incremental behaviour.
What alternative solutions did you explore? (Optional)
Passing context.currentValue = undefined on the first flush is a one-liner in the engine and fixes all nine persisted derived values at once, but it forces a full recompute on every one of them at startup, which is a much larger blast radius on the exact path the startup telemetry spans in this file are watching. I would rather fix the reported flow and let the other configs opt in.
I also looked at capturing the delta baselines when each connection initializes rather than at the first flush, which would keep the incremental path and cost almost nothing. I dropped it because it assumes the persisted derived value is in sync with the persisted dependency data, and those two writes are not atomic. A tab killed between them, which is routine on DEV, would leave the stale value in place with no way back. The full reconcile self-heals instead.
Invalidating the persisted value on a version or schema stamp does not fit what I observed. The restored value was correctly shaped and internally consistent; it was discarded work, not bad data, so a stamp would not have flagged it.
It is not reproducible today on a normal machine because the window that causes it is about 50 ms wide. It becomes a real bug when that window gets wider.
On startup OnyxDerived restores reportAttributes from disk, then waits for every dependency connection. Until the last one is set, each callback returns before it is recorded:
The first flush then runs with sourceValues === undefined, which the engine means as "compute from scratch", and it stages the current collections as the baselines for every later diff:
So whatever arrived in the window is now in the baseline and never produces a delta. The report keeps its old entry, or none, until something writes that report again.
I reproduced this against the production backend with no code changes. The only change was the English translations chunk (src_languages_en_ts.bundle.js) delayed by 6 s with a Playwright route. On this machine it normally loads in 43 ms, or 72 ms with the cache disabled, and All connections initialized then lands before ReconnectApp is even sent. That is why the QA retest finds nothing. The steps:
Web: create a task, comment on it, Reply in thread. The thread shows From 96718 task parent. Close the tab.
Second device, same account: rename the task.
Web: reopen the app while the translations chunk is slow, and open the thread.
ReconnectApp finished at 2.56 s and OpenReport at 3.14 s, and the window only closed at 7.19 s. Onyx then held report_<task>.reportName: "96718 task parent RENAMED" but reportAttributes.reports[<task>].reportName: "96718 task parent", and the header showed From 96718 task parent. A second rename run survived a normal reload. A report created in Classic while the tab was closed got report_ but no reportAttributes entry at all (44 entries for 45 reports).
That covers all three symptoms. The title falls back to the raw reportName (IOU, Chat Report, or ''), and an empty title keeps the skeleton up:
// We should not display the parent navigation subtitle if the user does not have access to the parent chat (the reportName is empty in this case)
if(!reportName){
return;
}
It also explains why the bug looks intermittent. Opening a report usually heals that report, because OpenReport writes it (I saw this twice). Parents, LHN rows and reports you have not opened stay wrong.
History: the deferral came with #82161 (Feb 2026), and the early return with 18f99e08c398 (2026-03-06). #95287 (relanded 2026-07-16) then made the first flush pass undefined on purpose to mean "from scratch", and reportAttributes never picked up that contract. The tests miss it because the engine suite marks translations loaded before any data is set, so no window ever exists:
In addition, reportAttributesTest never calls compute with a restored value and no sourceValues.
What changes do you think we should make in order to solve the problem?
Only take the incremental path when there is a delta to apply. The first operand of the early return then can never be true, so I would drop it rather than leave a dead check:
The first flush then runs a full scan against the complete snapshots, seeded from currentValue.reports, which are the same snapshots the engine is about to store as baselines. This one condition does both jobs. New users no longer enter the state, and a device that already holds a stale value rebuilds it on its next boot.
With the change above, the same steps show From 96718 task parent R3. ReconnectApp and OpenReport still land inside the window, and the first compute takes 4 ms. A task created while the tab was closed gets its entry (49 reports, 49 entries). A normal boot on the stale state the BEFORE run left behind rebuilt it to the current title (7 ms for 48 reports). Stashing the patch brings the symptom back: the same steps leave the derived name one rename behind, and the thread shows From 96718 task parent R3 while the task is R4.
Regression safety:
reportAttributes is the only persisted config that combines a restored currentValue with a no-delta early return. reportTransactionsAndViolations and visibleReportActions already rebuild when there is no delta, and sortedReportActions is RAM-only. That is read from code.
Steady state is unchanged. On one boot followed by a comment, Force offline on and off, Spend and a chat, the only compute without sourceValues was the first flush. Every later compute carried a delta and stayed incremental.
The deferral guard is untouched, so nothing is written while dependencies are incomplete.
compute is only called by the engine and writes only its own key, so the full scan cannot re-trigger itself.
One thing I want to be straight about: because the scan is seeded from currentValue, an entry for a report deleted while the app was closed survives. That is what happens today too, and no screen renders it without the report.
Test: in reportAttributesTest.ts, a restored value holding Stale Name with sourceValues: undefined and a locale trigger. On current main it fails with Expected: "Test Report", Received: "Stale Name"; with the change it passes. 127/127 across the 13 derived-value suites, and lint and format are clean.
What alternative solutions did you explore? (Optional)
An isFirstFlush flag on the context. It gives the same result. On the session I watched, sourceValues was only missing on the first flush, so the flag adds an engine and type change to express a signal the config already receives.
Dropping currentValue for every config on the first flush. This also removes orphan entries, but it throws away the seed that computeReportName reads for moved-expense thread names. It also changes a contract the other configs do not need changed, since they already rebuild.
Recording the deltas that arrive during the window. This keeps the restored value as the base and assumes it matches the persisted reports. Here it did not: the stale value survived a normal reload.
Patching HeaderView or ParentNavigationSubtitle. They render the stored value faithfully; the value itself is stale in Onyx.
📣 @eswar5678! 📣
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>
⚠️@eswar5678 Thanks for your interest. To be considered for this job, please post a proposal following the proposal template (note the mandatory sections). Comments claiming the job without one are not reviewed.
Activity
MelvinBot commentedon Jul 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On DEV, opening any expense report or thread shows one of: infinite loading in the header, a loaded-but-incorrect report name, or a missing parent-navigation subtitle (
From "…").What is the root cause of that problem?
All three symptoms collapse to a single source of truth: the persisted
reportAttributesOnyx derived value. The header title, the loading skeleton, and theFrom "…"subtitle all read the per-reportreportNamefrom it, so if that derived value doesn't hold a correct name for a report (and its parent), you get exactly these three symptoms:isLoading = !report?.reportID || !title—HeaderView.tsx:282. Empty derived name → infinite loading.getReportNamefalls back to the raw, often-stalereport.reportNamewhen the derived name is missing —ReportNameUtils.ts:1131. Stale derived value → incorrect name.From "…"subtitle uses the parent report's derived name and is hidden entirely when it's empty (ParentNavigationSubtitle.tsx:152-154).Why DEV-only:
reportAttributesis persisted to disk — it is not in the RAM-only list (setup/index.ts:63). On launch it restores the on-disk value and recomputes incrementally: it seeds from the old value and only rebuilds reports that appear in the change deltas —reportAttributes.ts:306and:560. A developer running an unreleased build (9.4.41-4) and switching branches accumulates a stale or wrong-schema persisted derived value; untouched reports keep their stale/empty names forever and are never rebuilt. Staging/production users on fresh data rarely hit this.What changes do you think we should make in order to solve the problem?
Invalidate the persisted
reportAttributesderived value and force a full recompute when it can't be trusted — e.g. add a schema/version stamp to the derived value and discard-then-fully-recompute on mismatch (rather than restoring and only updating incrementally). This makes a schema change or corrupted on-disk value self-heal on the next launch instead of silently persisting stale names.Diagnostic to confirm before implementing (medium confidence)
This needs a DEV runtime confirmation to pin the exact trigger. Ask the reporter to check the DEV console for:
Log.infobreadcrumbs from the derived engine — "restored from disk" vs a fresh compute, and any[OnyxDerived] compute for … threw(a swallowed throw in the compute would leave names stale for all reports —OnyxDerived/index.ts).OpenReportactually resolves against the local backend (isolates the skeleton symptom, which is separately driven byisLoadingInitialReportActions).A candidate secondary trigger is a
__DEV__-only throw along the render/compute path (e.g.RenderHTMLinside a<Text>,RenderHTML.tsx:47) getting swallowed by the derived compute's try/catch — which would also leave names unset on DEV only. The console error text would distinguish this from the stale-value path.Key files
src/libs/actions/OnyxDerived/configs/reportAttributes.ts— the derived compute (incremental gate + seed-from-old-value)src/setup/index.ts:63—reportAttributesis persisted, not RAM-onlysrc/libs/ReportNameUtils.ts:1131— name resolution + stale fallbacksrc/pages/inbox/HeaderView.tsx:282— loading skeleton gatesrc/components/ParentNavigationSubtitle.tsx:152-154—From "…"subtitle hidden when name emptyNext Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/96718)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
ahmdshrif commentedon Jul 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On DEV, opening an expense report or thread intermittently shows infinite loading, the wrong report name, or a missing parent-navigation subtitle ("From …").
What is the root cause of that problem?
The name shown for a report comes from the
report_attributesderived Onyx value, read viagetReportName(report, derivedReportName), which falls back toreport.reportName ?? ''when the derived name is absent:App/src/libs/ReportNameUtils.ts
Lines 1114 to 1119 in 3e8642c
That derived value recomputes incrementally — only reports whose keys land in
sourceValues/updatesget re-derived; others keep their prior value:App/src/libs/actions/OnyxDerived/configs/reportAttributes.ts
Lines 302 to 360 in 3e8642c
This gate was just reworked (derived-values optimization
#96320+ onyx-store reland#96523) right before this DEV-only report. When a freshly-opened report's name depends on data that arrives without pushing that report's own key intoupdates(e.g. personal details / parent report resolving after the report), itsderivedReportNameis never computed.getReportNamethen returns''/stale, andgetParentNavigationSubtitle(reading the same state) yields no "From …" subtitle.What changes do you think we should make in order to solve the problem?
Guarantee the visible report is always re-derived. In
reportAttributes.ts, whenuseIncrementalUpdatesis on, push the current report's key intodataToIterateif itsreport_attributesentry is still missing (else fall back to a full scan):Regression: this only adds the on-screen report on cache-miss, so it never skips an already-derived report and adds at most one entry.
mukhrr commentedon Jul 24, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-09-02 06:14:04 UTC.
Proposal
What is the root cause of that problem?
OnyxDerived.init()restores each derived value from disk, then opens the dependency connections. Until the last one initializes, every callback is thrown away before it is recorded:App/src/libs/actions/OnyxDerived/index.ts
Lines 208 to 215 in 2aeff10
reportAttributeshas fourteen dependencies, and one of them is the locale, whose connection only initializes once translations finish loading. On DEV that takes seconds, so the window is wide. I drove a cold boot on the local dev server and watched what falls into it:Derived value for reportAttributes restored from diskat 1.94s, immediately followed by thirteennot all connections set for reportAttributes, deferring Onyx write. Nothing is added to the pending set, so no delta survives.ReconnectAppresponse applied its onyxData at 4.28s. Six more dependency callbacks were dropped right behind it, carrying that payload's report, report action and metadata writes.All connections initialized for key: reportAttributesonly at 11.03s, when translations loaded. Exactly one compute followed it, 3ms long.That single flush is the problem. It is the first one, so
hasFlushedOnceis false and the engine cannot reconstruct any delta, and it hands the configsourceValues === undefined:App/src/libs/actions/OnyxDerived/index.ts
Lines 176 to 182 in 2aeff10
reportAttributesreads that as "a dependency fired but nothing changed", sees a populatedcurrentValuerestored from disk, and returns it untouched:App/src/libs/actions/OnyxDerived/configs/reportAttributes.ts
Lines 364 to 371 in 2aeff10
And the same flush stages the collection baselines. So the data that arrived during the window is now folded into the baseline: no future change will ever name those reports, and the disk value stands forever.
I confirmed the consequence deterministically. Setting a report while the locale connection is still pending leaves it with no entry in the derived value at all:
reportAttributes.reports = { "cached": { reportName: "Cached Report" }, - "arriving": { reportName: "Arriving Report" }, }From there the three reported symptoms are the same defect seen from three angles. The header title is the derived name, and the skeleton gate is only
!title, so a missing entry pins the report on infinite loading:App/src/pages/inbox/HeaderView.tsx
Lines 316 to 317 in 2aeff10
A stale entry gives the wrong name, and a missing or stale entry on the parent is what silently removes the
From "…"line, sincegetParentNavigationSubtitleis fed the parent's derived name:App/src/pages/inbox/HeaderView.tsx
Lines 170 to 187 in 2aeff10
Why it shows up on DEV and not in production is ordering, not corruption. The disk value is well-formed and the right shape; it is simply never reconciled. On a production build the bundle and the translations chunk are ready long before the startup response, so the payload arrives after the connections are set and the normal incremental path handles it. On DEV the module graph and the locale chunk are slow, the API is not, and the payload lands inside the window instead.
sequenceDiagram autonumber participant S as Server participant O as Onyx participant E as DerivedEngine E->>O: restore reportAttributes from disk at 1.94s O-->>E: 13 dependency callbacks, all deferred S-->>O: ReconnectApp onyxData at 4.28s O-->>E: 6 more callbacks, all deferred Note over E: nothing recorded, pendingDependencyIndexes stays empty E->>E: translations load, last connection set at 11.03s E->>O: first flush, sourceValues undefined, writes the disk value back Note over O: report present, reportAttributes entry absent, title emptyWhat changes do you think we should make in order to solve the problem?
The engine knows something the config cannot infer: the first flush is the only one with no delta baselines, so "no source values" there means "I have no idea what changed", not "nothing changed". I would surface that on the compute context and let
reportAttributesreconcile once against the complete dependency snapshots.In
src/libs/actions/OnyxDerived/index.tsandtypes.ts, mark the flush; insrc/libs/actions/OnyxDerived/configs/reportAttributes.ts, fold it into the existingneedsFullRecomputesouseIncrementalUpdatesturns off for that one pass:context.triggeredKeys = triggeredKeys; + context.isFirstFlush = !hasFlushedOnce;const needsFullRecompute = + isFirstFlush || (hasKeyTriggeredCompute(ONYXKEYS.NVP_PREFERRED_LOCALE, triggeredKeys) && preferredLocale !== currentValue?.locale) ||The reduce already seeds from
currentValue.reports, so this is a merge, not a wipe: reports that were correct keep their entries, missing ones get built, stale ones get rebuilt.resetForClearsetshasFlushedOnceback to false, so the flush after anOnyx.clear()reconciles the same way, which is what that reset already wants.I verified both ends. A regression test that sets a report while the locale connection is still pending fails on current main with
reportAttributes.reports.arriving === undefinedand passes with this change, and the 65 tests inOnyxDerivedTest,OnyxDerivedSelfHealTestandreportAttributesTeststay green. In the browser I re-ran the same cold boot afterwards: the boot compute goes from 3ms to 22ms across 247 reports and the app renders normally, so the cost is one full scan per cold start, over data already in memory, which is what a fresh install does today anyway.This does not touch the guard the deferral was added for. No derived value is written while dependencies are incomplete, and every later flush keeps its current incremental behaviour.
What alternative solutions did you explore? (Optional)
Passing
context.currentValue = undefinedon the first flush is a one-liner in the engine and fixes all nine persisted derived values at once, but it forces a full recompute on every one of them at startup, which is a much larger blast radius on the exact path the startup telemetry spans in this file are watching. I would rather fix the reported flow and let the other configs opt in.I also looked at capturing the delta baselines when each connection initializes rather than at the first flush, which would keep the incremental path and cost almost nothing. I dropped it because it assumes the persisted derived value is in sync with the persisted dependency data, and those two writes are not atomic. A tab killed between them, which is routine on DEV, would leave the stale value in place with no way back. The full reconcile self-heals instead.
Invalidating the persisted value on a version or schema stamp does not fit what I observed. The restored value was correctly shaped and internally consistent; it was discarded work, not bad data, so a stamp would not have flagged it.
58 remaining items
melvin-bot commentedon Sep 9, 2026
@thesahindia 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
frontforge01 commentedon Sep 11, 2026
Proposal
What is the root cause of that problem?
It is not reproducible today on a normal machine because the window that causes it is about 50 ms wide. It becomes a real bug when that window gets wider.
On startup
OnyxDerivedrestoresreportAttributesfrom disk, then waits for every dependency connection. Until the last one is set, each callback returns before it is recorded:App/src/libs/actions/OnyxDerived/index.ts
Lines 215 to 228 in 4302279
The last connection is the locale, which only counts once the translations chunk has loaded:
App/src/libs/actions/OnyxDerived/index.ts
Lines 274 to 282 in 4302279
NavigationRoot(and soAuthScreens, which sendsReconnectApp) does not wait for translations, so server data can arrive inside that window:App/src/Expensify.tsx
Lines 309 to 316 in 4302279
The first flush then runs with
sourceValues === undefined, which the engine means as "compute from scratch", and it stages the current collections as the baselines for every later diff:App/src/libs/actions/OnyxDerived/index.ts
Lines 189 to 196 in 4302279
reportAttributesreads the same signal as "nothing changed" and returns the restored value untouched:App/src/libs/actions/OnyxDerived/configs/reportAttributes.ts
Lines 409 to 416 in 4302279
So whatever arrived in the window is now in the baseline and never produces a delta. The report keeps its old entry, or none, until something writes that report again.
I reproduced this against the production backend with no code changes. The only change was the English translations chunk (
src_languages_en_ts.bundle.js) delayed by 6 s with a Playwright route. On this machine it normally loads in 43 ms, or 72 ms with the cache disabled, andAll connections initializedthen lands beforeReconnectAppis even sent. That is why the QA retest finds nothing. The steps:From 96718 task parent. Close the tab.ReconnectAppfinished at 2.56 s andOpenReportat 3.14 s, and the window only closed at 7.19 s. Onyx then heldreport_<task>.reportName: "96718 task parent RENAMED"butreportAttributes.reports[<task>].reportName: "96718 task parent", and the header showedFrom 96718 task parent. A second rename run survived a normal reload. A report created in Classic while the tab was closed gotreport_but noreportAttributesentry at all (44 entries for 45 reports).That covers all three symptoms. The title falls back to the raw
reportName(IOU,Chat Report, or''), and an empty title keeps the skeleton up:App/src/libs/ReportNameUtils.ts
Lines 1299 to 1304 in 4302279
The subtitle is hidden when the parent's derived name is empty, and wrong when it is stale:
App/src/components/ParentNavigationSubtitle.tsx
Lines 136 to 139 in 4302279
It also explains why the bug looks intermittent. Opening a report usually heals that report, because
OpenReportwrites it (I saw this twice). Parents, LHN rows and reports you have not opened stay wrong.History: the deferral came with #82161 (Feb 2026), and the early return with
18f99e08c398(2026-03-06). #95287 (relanded 2026-07-16) then made the first flush passundefinedon purpose to mean "from scratch", andreportAttributesnever picked up that contract. The tests miss it because the engine suite marks translations loaded before any data is set, so no window ever exists:App/tests/unit/OnyxDerivedTest.tsx
Lines 43 to 45 in 4302279
In addition,
reportAttributesTestnever callscomputewith a restored value and nosourceValues.What changes do you think we should make in order to solve the problem?
Only take the incremental path when there is a delta to apply. The first operand of the early return then can never be true, so I would drop it rather than leave a dead check:
The first flush then runs a full scan against the complete snapshots, seeded from
currentValue.reports, which are the same snapshots the engine is about to store as baselines. This one condition does both jobs. New users no longer enter the state, and a device that already holds a stale value rebuilds it on its next boot.With the change above, the same steps show
From 96718 task parent R3.ReconnectAppandOpenReportstill land inside the window, and the first compute takes 4 ms. A task created while the tab was closed gets its entry (49 reports, 49 entries). A normal boot on the stale state the BEFORE run left behind rebuilt it to the current title (7 ms for 48 reports). Stashing the patch brings the symptom back: the same steps leave the derived name one rename behind, and the thread showsFrom 96718 task parent R3while the task isR4.Regression safety:
reportAttributesis the only persisted config that combines a restoredcurrentValuewith a no-delta early return.reportTransactionsAndViolationsandvisibleReportActionsalready rebuild when there is no delta, andsortedReportActionsis RAM-only. That is read from code.sourceValueswas the first flush. Every later compute carried a delta and stayed incremental.computeis only called by the engine and writes only its own key, so the full scan cannot re-trigger itself.One thing I want to be straight about: because the scan is seeded from
currentValue, an entry for a report deleted while the app was closed survives. That is what happens today too, and no screen renders it without the report.Test: in
reportAttributesTest.ts, a restored value holdingStale NamewithsourceValues: undefinedand a locale trigger. On current main it fails withExpected: "Test Report",Received: "Stale Name"; with the change it passes. 127/127 across the 13 derived-value suites, and lint and format are clean.What alternative solutions did you explore? (Optional)
isFirstFlushflag on the context. It gives the same result. On the session I watched,sourceValueswas only missing on the first flush, so the flag adds an engine and type change to express a signal the config already receives.currentValuefor every config on the first flush. This also removes orphan entries, but it throws away the seed thatcomputeReportNamereads for moved-expense thread names. It also changes a contract the other configs do not need changed, since they already rebuild.HeaderVieworParentNavigationSubtitle. They render the stored value faithfully; the value itself is stale in Onyx.melvin-bot commentedon Sep 11, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Sep 11, 2026
@thesahindia Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
melvin-bot commentedon Sep 15, 2026
@thesahindia 12 days overdue. Walking. Toward. The. Light...
eswar5678 commentedon Sep 16, 2026
melvin-bot commentedon Sep 16, 2026
📣 @eswar5678! 📣
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:
github-actions commentedon Sep 16, 2026
melvin-bot commentedon Sep 18, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Sep 18, 2026
This issue has not been updated in over 14 days. @thesahindia eroding to Weekly issue.
roryabraham commentedon Sep 19, 2026
coming from https://expensify.slack.com/archives/C02NK2DQWUX/p1789832067407069?thread_ts=1789832013.228489&cid=C02NK2DQWUX, closing this as not reproducible