Skip to content

perf(firestore): register queue_age_sample_budget lever + publication freshness gate (dark, WQ2b) - #22205

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/firestore-reads-wq2b-registry
Oct 19, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/firestore-reads-wq2b-registry

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Firestore reads loop WQ2b registry slice: add queue_age_sample_budget to KNOWN_LEVERS (backend/config/firestore_read_levers.py) and wire the queue-age publication freshness verification required by the #22142 review before that lever may ever be enabled. Dark by construction: no FIRESTORE_READ_LEVERS value changes, no lever enabled.

  • Registry: absent key still means percentage 0 / disabled without relying on the old ValueError path; covered for unset var, empty string, empty object, and unrelated-lever cases. Repeated calls keep full scans (no cache, no early stop).
  • Freshness: omi_queue_age_sample_timestamp_seconds records the start of the last completed FRESH scan; cache hits and blocked scans do not advance it. With the budget active, freshness age stays within 600s + scan time (tests at 30s/300s tick cadences incl. 37s scan).
  • Wedged-scan semantics: before budgeted fresh-scan I/O the publisher invalidates expired age series and sets unknown=1 — a wedged scan exposes unknown, never a stale zero (tests at simulated 300s/900s/1800s blockage; timestamp stays stale until a scan completes).
  • Publisher Firestore coverage reviewed and its required body digest refreshed; query shapes unchanged; lever-off publication path unchanged.

Product invariants affected

none — no invariant registry path is touched (lever registry + publisher internals + tests only).

How it was verified

  • sol exec-innocent-tennis-uncover-proud-theme-strike: 102 tests passed (queue-age budget 39, lever registry 9, durable queue 49, substrate contract 5) via BACKEND_UNIT_TEST_FILE_LIST through backend/test.sh under omi-heavy; all 32 preflight checks passed locally; report WQ2B-registry-report.md.
  • zcode glm-5.3 review: pending (this PR).

Tests

  • backend/tests/unit/test_fsr_wq3_queue_age_budget.py (extended), lever registry tests, durable queue tests.

UI evidence

UI-Evidence: none — backend-only, no user-facing surface.

Failure class (fixes)

Failure-Class: none

Rollout

Dark: the lever stays at 0/absent everywhere. The Firestore reads loop may ramp it only after this PR is deployed and its config PR sets a percentage. Merging does not start a deploy train.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-18T18:07:52.086613Z a920dc8 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
Git-on-my-level merged commit 8ed3ad1 into main Oct 19, 2026
123 checks passed
Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
…_queries lever keys (dark, config unchanged) (#23390)

## Summary

Register `conversation_list_cursor` and `finjob_candidate_queries` in
backend `KNOWN_LEVERS`, with their origin callers documented.
Registration makes both keys addressable; an absent percentage remains
0/off. No `FIRESTORE_READ_LEVERS` YAML literal or other config value
changes.

The cursor behavior is already merged in #22450. Finalization
candidate-query behavior remains separate on
`lane/firestore-reads-wq13-candidates` at `13e1eeea47`; this PR neither
imports nor depends on that code. The cursor tests now use the
production registry instead of patching in the key.

## Product invariants affected

- INV-FSR-LEVERS — registration only; missing keys remain off, and
runtime configuration remains the sole rollout authority.
- INV-READ-BUDGET — query behavior and read budgets are unchanged;
query-shape and cursor read-count coverage run unchanged apart from
removing the registry patch.
- INV-CONTRACT-LIST-PAGE — existing pagination behavior and response
contracts remain unchanged while the cursor lever is absent/off.

These are the IDs cited by #22450; #22205's registration pattern cited
no invariant IDs.

## Verification

- 674 tests passed: lever registry 19, cursor contracts 31, rendered
runtime-env literal contracts 93, pusher config references 28,
query-shape suite 503. Each suite ran in a separate pytest process using
`backend/.venv` through `omi-heavy`.
- Command: `backend/.venv/bin/python -m pytest
backend/tests/unit/<suite>.py -q` for each of the five suites above;
rendered-literal expectations unchanged.
- Broader Firestore index guard: all seven contract files passed.
- `make preflight`: all 32 checks passed. Pre-push also validated the
committed three-file diff and the real PR body file: all 32 checks
passed.
- No GCP tier used; no cloud access needed.

UI-Evidence: none — backend registry only, no UI change.

Failure-Class: none

## Rollout and rollback

Both keys remain dark because their config percentages are absent. No
rollout is requested here; deployment and any later configuration change
belong to the rollout lead. Revert this registration commit to roll
back.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23390?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/23390?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23390&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 Oct 25, 2026
… 5->100, queue_age_sample_budget 0->5 (#23599)

## Summary

Firestore reads loop config, three runbook-gated moves in one literal
(17 keys, generated with `avo/firestore-reads/set_levers.py`,
REPLACE-mode, byte-identical at all sites):

- **Exoneration re-enable 0 → 5**: `singleton_loops`,
`usage_month_cache`, `backfill_task_reads`, `historical_scan_memo`,
`ledger_purge_coalesce`. These five were URGENT-flagged off in #23575
(merged 2f4235d, served on Cloud Run via the 2026-10-25 09:54Z train at
b71be9b, DONE 10:35Z). Guard evidence at lever 0: backend-sync 5xx rate
0.0096 (11Z) → 0.0077 (12Z) → 0.0071 (13Z) vs 0.0068 at levers 100 (09Z)
and ref 0.0010 — the rate persisted with the levers at 0, and the same
hours last week (pre-#23575) were 0.018–0.036. Per the loop runbook
exoneration rule, the levers re-enable at 5%.
- **`batch_privacy_memoize` 5 → 100**: ramp5 served 08:36:49Z
(backend-02126-x49, literal verified), >3h soak, verify PASS at
11Z/12Z/13Z, graded SUPPORTED (implied drop 115M/day at 5%, snapshot
2026-10-25T13:00:02Z.verify.json). Standard ramp5 → ramp100 rule for
SUPPORTED levers.
- **`queue_age_sample_budget` 0 → 5**: WQ2b-prescribed enable (registry
+ freshness gate merged #22205; `FSR_QUEUE_AGE_PUBLISHER=1` on prod
backend-listen values since the 2026-10-25 06:00Z train). Its caller
`durable_queue_age:_sample_status_page` is now the top origin: 0 → 18.8M
reads/h on backend-sync+backfill between 10Z and 13Z (snapshot
2026-10-25T13:00:02Z) after the flag-off un-coordinated the loops.

Config only; no code paths change. Off-path for every lever is the
current served behavior.

## Product invariants affected

- INV-MEM-4 — config-only rollout of default-off code-path levers; every
lever reverts at 0 with no data-path or authority change.
- INV-DATA-1 — value-only edit of the existing `FIRESTORE_READ_LEVERS`
key; no routing or ownership change.

## Test plan

- `backend/tests/unit/test_render_backend_runtime_env.py` +
`backend/tests/unit/test_verify_pusher_config_references.py`: 121 passed
on this branch (2026-10-25).
- Literal verified byte-identical at all 6 declaration sites +
regenerated `runtime_env.yaml`, flag registry, and both pinned contract
tests.
- Post-merge watch: verify.py per-lever gates +
backend/backend-sync/backend-sync-backfill 5xx rates hourly; if any
lever grades UNSAFE/FALSIFIED or the 5xx rate doubles again, flag off
via config PR. 5xx rate persisting at these values further implicates
the 2026-10-25 code trains, not the levers.

## Rollout

1. Train order **listen → pusher → Cloud Run** (FIRESTORE_READ_LEVERS
order; Cloud Run candidate check compares GKE env against main's
runtime_env). Note: GKE listen/pusher are still on the pre-#23575
literal, so this train also brings them current.
2. Handoff to the two-lane lead via bus after merge; ramp clocks start
at the served revision carrying this literal.
3. D+2 absolute readout per lever vs baseline; 0 for any
FALSIFIED/UNSAFE.
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