Skip to content

Revert "config: flag off 8 FIRESTORE_READ_LEVERS to 0" (#23731) - #23739

Merged
Git-on-my-level merged 1 commit into
mainfrom
lead/revert-23731
Oct 26, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lead/revert-23731

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Member

Reverts #23731 (merged c5486dd), restoring the 8 FIRESTORE_READ_LEVERS it set to 0.

Why: #23731 was a precaution against a backend-sync 5xx guard breach at the 14Z tick (0.73% vs 0.11% ref). op1 attributed those 5xx: ~256 are audio-merge manifest-retry 500s that predate the regression (722/h on 10-25), and ~110 align with Firestore expired_transaction storms caused by #23718's in-transaction decode (fixed by #23738). None are lever-linked, so the levers are exonerated and their read savings should stay.

#23731 never deployed (the serving Cloud Run, listen and pusher revisions predate c5486dd). Merging this before the next CR train keeps the lever state unchanged in production.

Product invariants affected

  • INV-MEM-4 (path match on backend/deploy/runtime_env.yaml only; this revert restores Firestore read-lever values and does not change memory promotion behavior)

Rollback: re-merge #23731.

🤖 Generated with Claude Code

…xx guard breach) (#23731)"

This reverts commit c5486dd, reversing
changes made to cf029fb.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T16:22:16.272941Z daeb8ff 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: daeb8ffb40

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

SYNC_POLL_BACKOFF_ENABLED: {value: 'false', category: rollout}
FIRESTORE_READ_LEVERS:
value: '{"action_items_page":100,"backfill_task_reads":0,"batch_privacy_memoize":0,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":0,"ledger_purge_coalesce":0,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":0,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":0,"subscription_cache":100,"usage_month_cache":0,"usage_month_total":100}'
value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":100,"candidates_page":100,"canonical_statuses_dedupe":100,"deletion_marker_cache":100,"finjob_candidate_queries":5,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":100,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"usage_month_cache":100}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the enabled usage_month_total lever

This replacement also drops "usage_month_total":100, although that lever was explicitly preserved by #23731 and is not one of the eight being restored. Missing keys default to 0 in config/firestore_read_levers.py, so the next deployment disables monthly-total reads across all configured services. Consequently, get_monthly_usage_stats and get_monthly_usage_stats_since in database/user_usage.py fall back to scanning hourly usage documents on cache misses instead of reading one warm monthly document, increasing Firestore reads and latency while monthly-total write maintenance remains enabled. Preserve this key at 100 in the source literals, generated manifest, charts, and pinned expectations.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit e30b15f into main Oct 26, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lead/revert-23731 branch October 26, 2026 16:33
Git-on-my-level added a commit that referenced this pull request Oct 26, 2026
Second conflict round after #23739 reverted the FIRESTORE_READ_LEVERS flip
(#23731) on main. Resolution identical in shape to c58ac2c: the
memory-maintenance-job manifest blocks stay deleted (the revert's in-block lever
edit dies with the block), live-surface lever values take main's reverted state
via auto-merge, and the feature-flag registry is re-rendered from the resolved
manifests (reverted lever values, no job surface). Checker OK; targeted shard
873 passed.
Git-on-my-level added a commit that referenced this pull request Oct 31, 2026
… 5xx re-escalation, WQ31) (#24194)

## Summary

Firestore read lever config — guard flag-off: 7 levers 100 -> 0
(`singleton_loops`, `usage_month_cache`, `backfill_task_reads`,
`historical_scan_memo`, `ledger_purge_coalesce`,
`queue_age_sample_budget`, `usage_month_total`). Complete 20-key
literal, delta vs main only in those 7 keys; `finjob_candidate_queries`
stays 5 (its own gate). The `usage_month_total` Cloud Run-only override
in `prod.overlay.yaml` goes 100 -> 0 with this flag-off — umt is itself
guard-flagged; #23739 (4f7e485) set the precedent of flagging umt to
0 and removing the wanted-line CR term while keeping
`FSR_USAGE_MONTH_TOTAL_EPOCH` recorded.

Reason: backend-sync 5xx guard re-escalation fired per the armed WQ30
plan. verify graded the flagged levers UNSAFE on 5 consecutive ticks
(17Z-21Z 2026-10-31: rate 0.0035-0.0036, 1550-1600 err/h excl
audio-merge, vs ref 0.0014). The 17:15Z run disposed the first raise as
exogenous (route attribution: /v2/sync-jobs/run + audio-merge retry
noise under 2x WoW traffic) and armed re-escalation: "flag off next run
if verify still FAIL post-fix-serve with 2h train-quiet tail, or on any
lever-specific why". The lead's fix train (14d7e31 carrying #24161,
#24164, #24175) went live 15:18Z on backend / backend-sync /
backend-integration (lead bus post); no train since (5h+ quiet tail);
verify still FAILs with a FLAT rate and unchanged error counts. No
lever-specific why (finjob at 5% carries the same service-scope why).
Per the runbook judgment rule, flag-off is the discriminating
experiment: if the 5xx rate persists at levers 0, the cohort is
exonerated (cause exogenous) and re-enables at 5%; if it drops, the
cohort is implicated.

## Product invariants affected

- INV-FSR-LEVERS — replace-mode literal rule respected; all 20 keys
present; absent keys remain off by default; KNOWN_LEVERS unchanged.
- INV-MEM-4 — required by the `backend/deploy/runtime_env.yaml`
generated-manifest lock; the change is the rendered
FIRESTORE_READ_LEVERS literal only.
- INV-DATA-1 — lever-off restores legacy un-memoized paths (safe
defaults, all previously serving pre-ramp).

Failure-Class: none

## Verification

- `set_levers.py` REPLACE-mode with the complete 20-key umt:0 literal (6
keys 100 -> 0 in base/charts/pins); `prod.overlay.yaml` hand-patched umt
100 -> 0 plus the same 6 keys (4 sites, set_levers does not match its
inline literal form); `compose_runtime_env.py` +
`render_feature_flag_registry.py` re-run.
- Contract-pinned expected dict in `test_render_backend_runtime_env.py`
updated per #24134/#23739 convention (6 keys 100 -> 0; the `wanted`
CR-override term removed while umt is off, epoch assertion unchanged).
- Diff audit: 43 changed-literal sites, every `+` side equals the new
20-key literal exactly; zero residual sites with any flagged lever > 0;
`finjob_candidate_queries` = 5 everywhere.
- Contract tests: `test_render_backend_runtime_env.py` 91 passed +
`test_verify_pusher_config_references.py` 28 passed (lane venv).
- Full CI: on this head.

## Lead-owned ship plan

URGENT: deploy needed listen -> pusher -> Cloud Run
(FIRESTORE_READ_LEVERS train order). Bus handoff posted to the lead;
ride the next train rather than batching.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24194?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/24194?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24194&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. -->
Git-on-my-level added a commit that referenced this pull request Nov 2, 2026
…/ledger_purge 100->0 (backend-sync 5xx 0.0134 vs ref 0.0073) (#24348)

# Firestore reads loop guard flag-off — 2026-11-02
(singleton/backfill/historical/ledger_purge 100→0)

## Summary

Firestore reads loop **URGENT guard flag-off** (autonomous, loop RUNBOOK
step 1): four `FIRESTORE_READ_LEVERS`
values 100 → **0**, everything else byte-identical to main. Response to
verify tick 2026-11-02T05:00:20Z FAIL
(pending-actions `flag_off`: singleton_loops, usage_month_cache,
backfill_task_reads, historical_scan_memo,
ledger_purge_coalesce).

- Breach: backend-sync 5xx 3652/271872 = **0.0134** (audio-merge
excluded in both windows) vs ref (prev-week
same window, excl audio-merge) 1805/248696 = **0.0073**. Hourly
trajectory: 0.0041 (22Z) → 0.0048 (23Z–00Z;
restoration #24238 served 23:52Z) → 0.0062 (01Z) → 0.0082 (02Z) → 0.0078
(03Z) → 0.0076 (04Z) → **0.0134 (05Z)**.
Evidence is ambiguous (smooth multi-hour rise, no clean step at the
serve hour), so per the runbook
("flag off on breach anyway when the evidence is ambiguous") the
flag-off proceeds as the discriminating
experiment: rate falls at 0 → restoration cohort implicated (stays 0);
rate stays >ref at 0 → exogenous again
(#23739 / lead RCA e54718 precedent), restoration re-planned with the
lead.
- Flagged off everywhere (base ×11 sites, four Cloud Run overlay sites,
listen/pusher dev+prod charts):
`singleton_loops`, `backfill_task_reads`, `historical_scan_memo`,
`ledger_purge_coalesce` 100 → 0.
`usage_month_cache` base stays 0 (it was already 0 off the #24210
exception scope).
- **Kept on purpose: `prod.overlay` backend-sync
`usage_month_cache`/`usage_month_total` = 100** — the #24210
compute-admission exception. Admission calls backend-sync
`/authorize-compute` with a 5-second client timeout;
zeroing these re-breaks admission (admission stage mean ~5.1s,
unevaluated deferrals ~3.7/s — the exact incident
#24210 fixed under lead ruling dde240). The 05Z tick's
`usage_month_cache` UNSAFE carries the shared
service-scope why (WQ30 precedent: same-why proves service-scope), and
`usage_month_total` was not flagged at
all. If post-flag-off discrimination implicates umc specifically,
zeroing the exception is #24210's documented
  rollback (admission impact accepted; lead decides).
- `queue_age_sample_budget` stays 100 (not flagged; its needle callers
read ~0 since the budget lever —
  readout 402.5M → 0.0M/day). All other keys unchanged.

Config only, generated with `avo/firestore-reads/set_levers.py`
(replace-mode, complete 20-key literal) plus the
four prod.overlay inline sites hand-patched (flagged keys only) and the
third pinned `expected` dict in

`test_firestore_train_preserves_monthly_reader_scope_and_cloud_run_overrides`
updated (set_levers' regexes do not
cover it). Stale #24194-era comment blocks refreshed to the current
scope. Regenerated `runtime_env.yaml` +
feature-flag registry.

## Product invariants affected

- INV-MEM-4 — config-only lever rollout; no data-path, promotion or
authority change; every flagged lever reverts
to flag-off behavior at 0; the #24210 admission exception is unchanged
(epoch c2fs_20261026_r1 preserved).
- INV-DATA-1 — no routing or ownership change; value-only edit of the
existing `FIRESTORE_READ_LEVERS` key.

## Test plan

- `backend/tests/unit/test_render_backend_runtime_env.py` +
`backend/tests/unit/test_verify_pusher_config_references.py`: **119/119
pass** on the lane venv
(`backend/.venv` freshly synced from pylock.macos.toml via `make
setup-backend`).
- Literal audit: 26 deploy value sites JSON-parsed — the 4 flagged keys
= 0 at every site; `usage_month_cache`/
`usage_month_total` = 100 only at the prod.overlay + rendered
backend-sync exception; `queue_age_sample_budget`
  = 100 everywhere; finjob/bpm/mliw/people = 0 everywhere.

## Rollout

1. **URGENT**: lead-owned train, order **listen → pusher → cloud-run**
(FIRESTORE_READ_LEVERS order). The loop
   does not dispatch deploys or approve gates.
2. Post-serve: hourly tick verify runs the discrimination (2 clean ticks
at 0 → cohort implicated, stays 0;
flat >ref → exogenous, restoration re-plan with the lead). Re-baseline
after the served revision changes.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24348?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/24348?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24348&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