Repository navigation
Closed
Description
Goal
Identify and reduce avoidable Firestore read amplification in Omi's high-volume query and realtime-listener paths without changing product semantics, consistency expectations, or user-data retention.
Current shape of the problem
The application has both:
- backend paths that execute Firestore queries and collection scans; and
- client/realtime paths that attach snapshot listeners and can reconnect or refetch.
The initial investigation suggests likely opportunity areas are duplicate listener attachment, reconnect loops, polling/repeated fetches, broad or unbounded list queries, fan-out reads, and cache misses. This issue intentionally excludes billing figures, production record contents, user identifiers, and exports of production data.
Requested investigation
- Build a source-level map of the main Firestore read paths in backend, mobile, desktop, and web surfaces.
- Identify query/listener patterns that can amplify reads, prioritizing shared/high-traffic code paths rather than one-off admin scripts.
- Propose privacy-safe aggregated telemetry that can attribute read behavior without storing user content or raw identifiers. Useful dimensions may include route/feature, collection category, query shape/boundedness, listener attach/re-attach/dispose events, returned-vs-read document counts, retry reason, and cache source/hit status.
- Recommend a small, testable first fix with explicit expected behavior and regression coverage.
- Document which proposals require product/consistency validation before rollout.
Constraints
- Do not inspect, export, or include production document contents, user identifiers, credentials, or billing data in issue discussion, tests, or logs.
- Prefer source inspection, local emulator tests, and aggregated privacy-safe instrumentation.
- Do not change listener semantics, query ordering, pagination, cache policy, or data retention without focused behavioral tests and a separately reviewed implementation.
- Treat Firestore reads as a cross-surface concern: a local optimization must not introduce stale UI, missed realtime updates, duplicate processing, or retry storms.
Acceptance criteria
- Source-level inventory of top shared read/query/listener paths and their suspected amplification mechanism.
- Proposal for minimal privacy-safe aggregated telemetry, including cardinality controls and no user-content logging.
- Ranked shortlist of candidate changes, each with risk and validation plan.
- One narrowly scoped first implementation proposal with regression-test outline.
- Clear statement of any production evidence still needed before selecting the first fix.
Activity
aryanorastar commentedon Aug 6, 2026
VERIFY (contributor triage): Still OPEN as an investigation epic, but substantial amplification work already landed:
perf: reduce Firestore read amplification(merged)Issue ACs ask for inventory + privacy-safe telemetry design + ranked proposals before a first fix — not a cold shrink PR. Next honest step is maintainer/ops evidence of remaining hot paths post-#9891, not another speculative read-path change.
Standing down from a new PR until residual amplification is named with source + test plan.
perf(backend): bound the chat-quota month read to the current month (#…
beastoin commentedon Aug 9, 2026
Escalation — consolidated tracking issue filed
The Firestore reads alert has fired 43 incidents (407 breaches) since onset Jul 28, with values trending up despite 6 merged hot-path fixes (#10750, #10778, #10781, #10902, #11062, #11197). Currently in a 32h+ continuous breach.
Filed #11282 as the consolidated tracking issue with full alert history and fix history.
Note: Root cause determination and fix plan require maintainer review and approval. No existing issue (including this one) is pre-accepted as the root cause or fix approach.
fix(windows): stop full action-item hydrate on every local read
fix(windows): stop full action-item hydrate on every local read (#11760)
gx01718-source commentedon Sep 8, 2026
@josancamon19 — following the contribution guide's invitation to suggest bounties, would a US$100 bounty to restore Query Explain through the existing read probe be useful for this investigation?
#12281 explicitly accepted the loss of
StreamGenerator.get_explain_metrics()because there were no in-tree Explain callers. This is that documented limitation, not a newly discovered incident cause. Atcb23ae3, I reproduced it with the unchanged probe and Firestore SDK 2.20.0: all six baseline Query/Aggregation.get()cases passed; installing the probe left both ordinary cases working but made all four plan/analyze cases raiseAttributeError: 'generator' object has no attribute 'get_explain_metrics'.Verification was an offline Python 3.12.14 harness using real SDK get/stream methods, synthetic
_make_streamresponses and blocked socket connections. It was not your Python 3.11 backend merge gate or a production test.The proposed scope is one focused PR restoring Explain access for Query/Aggregation get and stream, with regression coverage in the existing probe test suite, preserving lazy iteration, existing counters, bounded labels and telemetry fault isolation. Backend-required verification would precede a PR. This would enable diagnostics; it would not by itself reduce reads or close this audit.
There is no approved bounty or payment assumed. If this capability is now wanted, please confirm the scope and bounty before implementation, under your published merged-code/eligibility rules. If it remains intentionally out of scope, I will leave it here.
SCA-458: cut Firestore memory unbounded queries and NOT_FOUND misses (B…
gx01718-source commentedon Sep 10, 2026
@josancamon19 — I saw that this epic was closed via #13233. That changes how I would scope my earlier proposal: any Query Explain restoration should be a separate, optional diagnostics task, without reopening this investigation or claiming a reduction in production reads.
The proposed US$100 scope remains Query/Aggregation get and stream compatibility through the existing read probe, with regression coverage and the repository's required checks. My earlier reproduction was tied to the stated commit; I have not presented it as a test of current main.
Is that separate diagnostic capability still useful enough to commission? If so, please confirm the paid scope and applicable bounty terms before implementation. If it is no longer needed after the recent work, a brief confirmation would help me close the proposal.
Thanks,
Chris