Repository navigation
feat(firestore-reads): cohort lifecycle_record_pending_head per serving replica - #24640
Conversation
…ng replica Luna r1 P2 on #24639: the lever keyed on the fixed namespace, so any percentage was all-or-nothing for the fleet (bucket 18: 5% = off everywhere). It now keys on the serving replica (HOSTNAME, or K_REVISION:INSTANCE_ID like fsr_read_cache.serving_config_key; inlined to keep the import closure unchanged), falling back to the namespace. 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. |
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 4/5
test_lifecycle_alarm_metrics.pycheckslever_enabledand_replica_keydirectly, so a regression that makesrecord_pendinggroup cohorts by namespace could still pass. Exercise the behavior throughrecord_pending.
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/tests/unit/test_lifecycle_alarm_metrics.py">
<violation number="1" location="backend/tests/unit/test_lifecycle_alarm_metrics.py:277">
P2: This test calls `lever_enabled` and `_replica_key` directly, so it does not prove `record_pending` cohorts by replica. A regression back to the namespace key would still pass. Route the check through `record_pending` (for example, spy on `queries.lever_enabled` and record the key it receives). Also cover the `K_REVISION:INSTANCE_ID` branch.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| seen = set() | ||
| for i in range(40): | ||
| monkeypatch.setenv('HOSTNAME', f'backend-integration-{i}') | ||
| seen.add(lever_enabled('lifecycle_record_pending_head', queries._replica_key('batch_pipeline_prod'))) |
There was a problem hiding this comment.
P2: This test calls lever_enabled and _replica_key directly, so it does not prove record_pending cohorts by replica. A regression back to the namespace key would still pass. Route the check through record_pending (for example, spy on queries.lever_enabled and record the key it receives). Also cover the K_REVISION:INSTANCE_ID branch.
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/tests/unit/test_lifecycle_alarm_metrics.py, line 277:
<comment>This test calls `lever_enabled` and `_replica_key` directly, so it does not prove `record_pending` cohorts by replica. A regression back to the namespace key would still pass. Route the check through `record_pending` (for example, spy on `queries.lever_enabled` and record the key it receives). Also cover the `K_REVISION:INSTANCE_ID` branch.</comment>
<file context>
@@ -265,3 +265,17 @@ def test_record_pending_head_lever_matches_the_full_page_with_one_document_read(
+ seen = set()
+ for i in range(40):
+ monkeypatch.setenv('HOSTNAME', f'backend-integration-{i}')
+ seen.add(lever_enabled('lifecycle_record_pending_head', queries._replica_key('batch_pipeline_prod')))
+ assert seen == {True, False} # a percentage splits replicas instead of the whole fleet
+ monkeypatch.delenv('HOSTNAME')
</file context>
…ist_index_window -> 100; record_pending_head 5% (#24648) ## What Config only. Ordinary read levers from 5% to 100% after their soak, plus one new 5% canary: | Key | Change | Serving at the lower step since | |---|---|---| | `OMI_EXTERNAL_LIST_POLLING_CACHE_PERCENT` (Cloud Run backend) | 5 -> 100 | 2026-11-04 20:52Z (#24623) | | `action_items_ttl120` | 5 -> 100 | 22:13Z (#24639) | | `memory_list_index_window` | 25 -> 100 | 22:13Z (#24639; 48h clean at 25 earlier, #23536) | | `lifecycle_record_pending_head` | 0 -> 5 | new canary; per-replica cohort since #24640 | ## Why These follow David's 2026-11-04 soak policy for ordinary read levers: 1-2h at 5% with the 5xx/latency guards, then 100% the same day. Guard evidence comes from the firestore-reads 23:00Z tick, window 22Z. The `backend` service, where these levers act, had 725 5xx out of 1.24M requests (0.06%), against 425 out of 700k (0.06%) the previous week, so it's clean. The tick's overall FAIL is the known `backend-sync` false positive: `measure.py`'s `sync_local_files` exclusion count got HTTP 429 from Logging, so the lead-ruled `/v2/sync-local-files` 503 wave went unsubtracted. That disposal is recorded in `data/run-2026-11-04-infracost/guard-5xx-attrib-2026-11-04T22Z.md` in omi-workspace. `backend-integration` 5xx since 22:00Z are MCP SSE/list timeouts and enrichment 500s; they predate the 22:13Z serve and sit on paths these levers don't touch. ## Rollout Next Cloud Run train, plus the listen/pusher legs for the shared literal. Rollback: previous values. ## Verification `pytest tests/unit/test_render_backend_runtime_env.py tests/unit/test_verify_pusher_config_references.py tests/unit/test_backend_runtime_env_validator.py tests/unit/test_firestore_read_levers.py`: 294 passed. Local push gate ran with `BACKEND_UNIT_FILE_BUDGET_SECONDS=900`; CI keeps its own 300s. ## Product invariants affected - INV-MEM-4 (path match on `backend/deploy/runtime_env.yaml` only; no memory promotion behavior changes) 🤖 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/24648?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/24648?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24648&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. -->
…5 -> 100, memory_list_index_window 25 -> 100, lifecycle_record_pending_head 0 -> 5 Ordinary read levers under David's 2026-11-04 policy (1-2h at 5% with guards, then 100% the same day): the polling cache has been at 5% since 20:52Z (BasedHardware#24623) and action_items_ttl120 / memory_list_index_window at 5/25 since 22:13Z (BasedHardware#24639). lifecycle_record_pending_head starts its 5% canary now that it cohorts per replica (BasedHardware#24640). Rollback: previous values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
lifecycle_record_pending_head(from #24624) now cohorts per serving replica:HOSTNAME, orK_REVISION:INSTANCE_ID, the same identity asfsr_read_cache.serving_config_key. It falls back to the namespace. The logic is inlined so the module's import closure doesn't grow. The lever stays off; no config change here.Why
Luna r1 P2 on #24639: the lever keyed on the fixed namespace
batch_pipeline_prod(bucket 18), so any percentage switched the whole fleet together, and 5% was off everywhere with no canary.Verification
pytest tests/unit/test_lifecycle_alarm_metrics.py tests/unit/test_firestore_read_levers.py: pass. A new test shows a 50% lever splits 40 synthetic replica hostnames into both cohorts and falls back to the namespace without replica env.Product invariants affected
None (
scripts/pr-preflight --suggest).🤖 Generated with Claude Code