Repository navigation
perf(firestore): default the unread list projection writer off - #24240
Conversation
With OMI_LIST_VERSION_EPOCH never set, nothing reads the list projection rows or versions, yet the writer added a version and a row write to every conversation/action-item commit: ~4.0M writes/day on 2026-11-01 (write probe; 1.9M Cloud Run + 2.1M listen, pusher unmeasured). Default it off; turning it back on is a fleet-wide flip before the epoch ramp (registry). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
2 issues found across 8 files
Confidence score: 4/5
backend/docs/list-serving-projection.mdstill says the writer is enabled by default, which could lead operators to follow incorrect rollout or rollback steps. Update the guide to match the new default-off behavior.backend/database/released_memory_projection.pytreats an emptyOMI_LIST_PROJECTION_WRITER_ENABLEDvalue as enabled, so declaring the variable without a value can turn the writer on unexpectedly. Parse only explicit enabled values as true.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/database/released_memory_projection.py">
<violation number="1" location="backend/database/released_memory_projection.py:162">
P3: An empty `OMI_LIST_PROJECTION_WRITER_ENABLED=` is treated as enabled, while unset is treated as disabled. The default-off intent breaks if the variable is ever declared with an empty value. Consider parsing an explicit truthy set (for example `in {'1', 'true', 'on', 'yes'}`) so only explicit opt-in enables the writer and reader. Apply the same change in `config/list_projection.py`.</violation>
</file>
<file name="backend/config/list_projection.py">
<violation number="1" location="backend/config/list_projection.py:14">
P2: The deployment guide still tells operators that the writer is on by default, contradicting this new default-off behavior. Update `backend/docs/list-serving-projection.md` so rollout and rollback instructions describe the writer as off until the fleet-wide enablement and reader epoch ramp.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| # (fswrites, 2026-11-01): with no reader, the version and row writes were | ||
| # ~4M Firestore writes/day that nothing read. Turning the writer back on is a | ||
| # fleet-wide flip followed by full writer convergence before any epoch is set. | ||
| return os.getenv('OMI_LIST_PROJECTION_WRITER_ENABLED', 'false').strip().lower() not in {'0', 'false', 'off'} |
There was a problem hiding this comment.
P2: The deployment guide still tells operators that the writer is on by default, contradicting this new default-off behavior. Update backend/docs/list-serving-projection.md so rollout and rollback instructions describe the writer as off until the fleet-wide enablement and reader epoch ramp.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/config/list_projection.py, line 14:
<comment>The deployment guide still tells operators that the writer is on by default, contradicting this new default-off behavior. Update `backend/docs/list-serving-projection.md` so rollout and rollback instructions describe the writer as off until the fleet-wide enablement and reader epoch ramp.</comment>
<file context>
@@ -7,4 +7,8 @@
+ # (fswrites, 2026-11-01): with no reader, the version and row writes were
+ # ~4M Firestore writes/day that nothing read. Turning the writer back on is a
+ # fleet-wide flip followed by full writer convergence before any epoch is set.
+ return os.getenv('OMI_LIST_PROJECTION_WRITER_ENABLED', 'false').strip().lower() not in {'0', 'false', 'off'}
</file context>
| conversations = len(parent) == 3 and parent[2] == 'conversations' and surface == 'mcp_cards' | ||
| card_coverage = bool(os.environ.get('OMI_LIST_VERSION_EPOCH', '').strip()) and os.environ.get( | ||
| 'OMI_LIST_PROJECTION_WRITER_ENABLED', 'true' | ||
| 'OMI_LIST_PROJECTION_WRITER_ENABLED', 'false' |
There was a problem hiding this comment.
P3: An empty OMI_LIST_PROJECTION_WRITER_ENABLED= is treated as enabled, while unset is treated as disabled. The default-off intent breaks if the variable is ever declared with an empty value. Consider parsing an explicit truthy set (for example in {'1', 'true', 'on', 'yes'}) so only explicit opt-in enables the writer and reader. Apply the same change in config/list_projection.py.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/database/released_memory_projection.py, line 162:
<comment>An empty `OMI_LIST_PROJECTION_WRITER_ENABLED=` is treated as enabled, while unset is treated as disabled. The default-off intent breaks if the variable is ever declared with an empty value. Consider parsing an explicit truthy set (for example `in {'1', 'true', 'on', 'yes'}`) so only explicit opt-in enables the writer and reader. Apply the same change in `config/list_projection.py`.</comment>
<file context>
@@ -159,7 +159,7 @@ def projected_stream_list(query: Any, budget: Any = None, *, surface: str, _sour
conversations = len(parent) == 3 and parent[2] == 'conversations' and surface == 'mcp_cards'
card_coverage = bool(os.environ.get('OMI_LIST_VERSION_EPOCH', '').strip()) and os.environ.get(
- 'OMI_LIST_PROJECTION_WRITER_ENABLED', 'true'
+ 'OMI_LIST_PROJECTION_WRITER_ENABLED', 'false'
).strip().lower() not in {'0', 'false', 'off'}
eligible = (
</file context>
…unt list validators Lead conditions for #24240: a test that readers never consult a version with the writer off (epoch empty or set), and sizing for the epoch reader. Add omi_list_conditional_requests_total{origin,validator} so the share of list GETs that could ever be answered 304 is measured before any ramp. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tay in the doc (#24251) ## Summary Stops every audio, transcription and lifecycle PR from editing the same 8,791-line doc. `backend/AGENTS.md` told every audio, transcription, conversation-lifecycle, speaker or listen/pusher change to update `backend/docs/listen_pusher_pipeline.mdx` in the same PR. Between 10-18 and 11-01: - **165 fleet PRs** edited that file; - **77 of them had to merge `main` back in**, and each catch-up re-ran the pre-push gate and a full CI cycle (shipspeed baseline, conflict hot spots). The new rule: - **Change notes** (what changed, why, rollout and flag state, evidence) go in `backend/docs/listen_pusher_pipeline/changes/YYYY-MM-DD-<slug>.md`, one new file per change. Concurrent PRs never touch the same note. - **Contracts stay in the pipeline doc**: env vars and defaults, wire and payload fields, ordering and idempotency guarantees, sequence diagrams. Tests (for example `tests/unit/test_vad_cache_ttl_config.py`) and the flag registry cite that file, so contract edits still happen there. - Notes are folded into the doc periodically by one docs-only PR. The `backend/AGENTS.md` rule is shortened to stay inside its `agents-md-lean` byte budget; the detail lives in `changes/README.md`. ## Rollout / merge notes - Docs and agent instructions only. No runtime, workflow or deploy change. - **Merge after the 23:00Z train** (lead 9a266d): five vroute lanes and #24238/#24240 are editing the pipeline doc today. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24251?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24251?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24251&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Decision PR for the rollout lead (bus 65693f / 941502). It turns the list-projection writer (#23394) off by default until its reader ramps.
Measured by the write probe (#24218) on 2026-11-01 (Sunday, 15-minute window scaled per day), the list-projection version and row writes are:
So that is ≈4.0M writes/day, about $5.5/day on a Sunday and likely $8-10 on weekdays (weekday volume ran about 1.9x). Every conversation update carries one version write and one row write. On listen, for example:
update_conversation_segments: 0.38M source / 0.38M version / 0.33M row per day.update_conversation_finished_at: 0.33M / 0.33M / 0.33M per day.Nothing reads them:
OMI_LIST_VERSION_EPOCHis empty everywhere. Its ramp (owner: two-lane lead, due 2026-10-24) never started.utils/list_version_check.pyand the MCP card reader indatabase/released_memory_projection.pyboth require the epoch.*_list_rowscollections.Change:
config/list_projection.writer_enabled()and the matching read inreleased_memory_projection.pynow default tofalse. Explicittruestill turns the writer on.rollout, default off, owner two-lane lead,review_by2026-11-15.trueon every writer service and revision.Catch-up on re-enable (lead d8fd89 / 12:48Z conditions)
Stale rows and versions never serve:
Versions. A version is a random token in the list ETag scope, which also includes the epoch. While the writer is off,
ListVersionCheck.startreturns before reading any version, whatever the epoch. The new test covers this for both families, with and without an epoch.Re-enable order:
trueon every writer service.OMI_LIST_VERSION_EPOCH.A fresh epoch changes every ETag, so a validator issued before or during the gap can never match. The first conditional request after the new epoch reads the source and issues a new tag. Existing coverage:
test_list_projection.py"new-rollout-after-writer-gap" asserts 200 after a gap.Rows.
*_list_rowsare a migration substrate that no code reads, and a partial legacy update can never mark a row ready. Any future row reader must backfill or prove coverage after a writer gap. Re-enabling alone does not make them complete.Would the epoch reader save more reads than these writes cost?
Not shown, and not measurable today:
/v1/conversations758k,/v1/dev/user/action-items602k,/v1/action-items236k. That is about 38M reads/day, about $17/day at $0.461/M.If-None-Match. With the epoch empty,/v1/conversationsemits nolp0tag for HTTP caches to revalidate.omi_list_conditional_requests_total{origin, validator}(3 origins × present/absent). If the present share on these routes is high, the ramp case can be made with numbers.Product invariants affected
Verification
All runs used
backend/test.shunderbin/omi-heavy+nice -n 19, at the unit layer:test_list_projection(20),test_memory_change_head(50),test_released_memory_projection(27),test_conversation_smart_merge_audit_sdk(26), and the other files that reference the projection collections or installer: all pass.OMI_LIST_PROJECTION_WRITER_ENABLED=trueexplicitly.scripts/check_feature_flag_registry.py: OK.Live check after deploy:
omi_firestore_billed_writes_total{collection=~"users/(list_serving_versions|conversation_list_rows)"}goes to ~0, and fleetwrite_countdrops by about the same amount.Rollback
Set
OMI_LIST_PROJECTION_WRITER_ENABLED=truefleet-wide, or revert.Failure-Class: none
🤖 Generated with Claude Code