Skip to content

fix(deploy): keep Firestore read and lease counters on sync GMP scrape - #22926

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/fs-regress
Oct 20, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/fs-regress

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Restore the Firestore reads loop's visibility into backend-sync, backend-sync-backfill and backend-integration.

#22118 (merged 2026-10-18 08:26Z, live ~13Z) gave those three services a revision-local GMP keep-regex. The regex omits omi_firestore_billed_reads_by_{caller,origin}_total, omi_firestore_caller_label_overflow_total and omi_fsr_leader_lease_total. Since then:

  • Attribution blind spot. The three services disappeared from per-caller read attribution in Managed Prometheus. At the 10-18 08Z trough they carried 320M reads/day (GMP 24h: sync 142.4M, backfill 150.4M, integration 26.9M). By subtraction they now carry about 500M of the fleet's 926M/day. That's the largest growth in the 10-18 → 10-20 regression (648M → 1007M/day), and the loop could not rank it.
  • False lever flag-off. The singleton_loops lease gate went blind to holders on those services. On 10-20 09Z, listen showed skipped_owner 44–69/h with acquired=0. The loop graded that as starvation and flagged the lever off (config(firestore): flag off singleton_loops (lease starvation UNSAFE x2 ticks at 5%) #22851). In fsr_admit, a recovery loop returns skipped_owner only while the tick key is live, and only an admission sets that key, so the work was running on an unscraped holder.

This PR keeps the four families: about 270 series per instance on 10-18, against the sidecar's samples: 10000 limit. It also pins them in test_sync_scrape_retains_exporter_and_direct_sentinel_consumers, so a future trim fails in CI instead of at ingestion.

Predicted reads/day saved: 0 directly. It restores attribution for about 55% of fleet reads and the lease evidence needed to re-ramp singleton_loops, which measured −119M/day on its callers at 100% on 10-17.
Measurement line: after the Cloud Run train, avo/firestore-reads/measure.py shows origins.missing_services == [] and coverage_1h ≥ 0.8 (0.381 at 10-20 18Z). The GMP query sum by (service_name) (increase(omi_firestore_billed_reads_by_caller_total[1h])) returns rows for all three services again.

Lane / contract

fs-regress (P1, two-lane rollout swarm 10-20). Owner sign-offs: none needed; the sync scrape profile comment block already says consumer changes update the allowlist and its test together.

Product invariants affected

none

Verification

  • backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST = test_attach_cloud_run_gmp_sidecar.py + test_parakeet_request_metrics.py: 7 passed (unit layer; regex contract only).
  • Prod series counts (GMP, ro-prod, aggregates): max by (service_name) (count by (service_name, instance) (omi_firestore_billed_reads_by_caller_total)) at 10-18 08Z: sync 149, backfill 140, integration 115; origin series 100/62/79.
  • Not run: a collector startup or prod scrape. That's the deploy layer, measured by the line above.

Rollback

Revert this commit; the next Cloud Run train drops the four families again. No application behavior depends on the scrape.

Deploy

Cloud Run train (backend-sync, backend-sync-backfill, backend-integration revisions pick up the collector config). Owned by the rollout lead.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

#22118 gave backend-sync, backend-sync-backfill and backend-integration a
metric keep-regex that omits omi_firestore_billed_reads_by_{caller,origin}_total,
omi_firestore_caller_label_overflow_total and omi_fsr_leader_lease_total.
From 2026-10-18 ~13Z those three services vanished from per-caller read
attribution (320M reads/day at the 10-18 trough; ~500M/day now by
subtraction) and from the singleton_loops lease gate, which then graded a
healthy backend-sync lease holder as starvation and flagged the lever off
(#22851). Keep the four families (~270 series per instance against the
10000-sample limit) and pin them in the scrape contract test.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T19:34:58.889821Z c57b6ca PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Grok review (agentctl delegate, request_key fs-regress-review, selector family=grok) covering this PR and the companion lever PR: VERDICT: SAFE, no findings. It confirmed the keep-regex still fullmatches every previously kept family and rejects every excluded name, matches the four _total series (_created stays dropped), and that ~270 samples sit far under the 10000 limit, with read_run_monitoring_config shape checks unaffected.

@Git-on-my-level
Git-on-my-level merged commit 45a0323 into main Oct 20, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/fs-regress branch October 20, 2026 19:46
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…ers 5->100 (verify PASS x3) (#22958)

## Summary

Firestore reads loop (avo/firestore-reads), config-only change to
`FIRESTORE_READ_LEVERS` via `set_levers.py` (full 13-key replace-mode
literal): three levers graduate 5% → 100% per the runbook ramp5 rule,
ten keys unchanged.

- `backfill_task_reads` 5 → 100, `historical_scan_memo` 5 → 100,
`ledger_purge_coalesce` 5 → 100: ramp5 rule met — ramp clock started
2026-10-20T05:00Z (ledgered ref 39368136637), ≥ 3h elapsed, and
verify.py PASS for 3 consecutive hourly ticks (2026-10-20T21Z, 22Z, 23Z
snapshots: no lever UNSAFE or FALSIFIED). These three were INCONCLUSIVE
at 5% (1h windows too small); the absolute readout at 100% vs
baseline-2026-10-20T05-00Z.json decides their grade (D+2 billing
confirmation follows).
- `singleton_loops` stays 25: WQ10's plan gates 25 → 100 on the restored
lease counter being visible with missing_services == [] (WQ9, #22926).
#22926's merge 45a0323 IS served (ancestor of live backend-02035-jqv,
verified by git ancestry), but the next snapshot must first show the
restored `omi_fsr_leader_lease_total` in `lease_1h`; the loop re-checks
each tick and graduates it in a later config PR.
- Unchanged at 100: action_items_page, candidates_page,
deletion_marker_cache, queue_age_sample_budget, request_read_dedupe,
serving_config_cache, subscription_cache, usage_month_cache.
`people_scan_dedupe` stays 0 (no qualifying call site).

Regenerated by `set_levers.py`: `backend/deploy/runtime_env.yaml`,
feature-flag registry, and the contract tests pinning the rendered
literal.

## Product invariants affected

- INV-MEM-4 — named because this PR changes
`backend/deploy/runtime_env.yaml` (a registry path); the change is a
config value only (the `FIRESTORE_READ_LEVERS` literal) and does not
alter memory promotion, consolidation, or intake behavior.

## How it was verified

- `set_levers.py` replace-mode regeneration: diff reviewed — every
literal occurrence changes by exactly the three keys 5→100 (45 value
sites across 9 files).
- Contract tests: `test_render_backend_runtime_env.py` +
`test_verify_pusher_config_references.py` +
`test_firestore_read_levers.py` — 121 passed (backend/.venv, python
3.11.15, this branch).
- Guards: verify.py verdict PASS at 21Z, 22Z, 23Z ticks; guards_5xx in
band; fleet fast-ratio gate advisory.
- CI gates this PR (Backend Unit Tests + Hermetic E2E); the loop
compares failures against main's known-red set before merge-on-green.

## Tests

Contract-test updates only; no code change.

## UI evidence

UI-Evidence: none — config-only change.

## Failure class (fixes)

Failure-Class: none

## Rollout

Config-only. Since 2026-10-20 the two-lane rollout lead owns every prod
deploy: the loop will post the bus handoff after merge (train order
listen → pusher → Cloud Run; FIRESTORE_READ_LEVERS order listen ->
pusher -> Cloud Run). Rollback: revert this PR's literal (three levers
back to 5) and re-run the same train; lever-off is the safe direction.
Ramp alarm: if verify flags any lever UNSAFE/FALSIFIED at 100%, the loop
flags it back autonomously via a flag-off config PR.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/22958?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/22958?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F22958&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. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant