Repository navigation
config(firestore): flag off singleton_loops + the four backfill-guarded levers - #22071
Merged
Merged
Conversation
…ed levers FIRESTORE_READ_LEVERS: singleton_loops 100 -> 0, backfill_task_reads/ historical_scan_memo/ledger_purge_coalesce/people_scan_dedupe 5 -> 0; the seven graduated levers stay 100 (missing keys default OFF, so the literal must stay complete). Generated with avo/firestore-reads/set_levers.py. - singleton_loops: verify UNSAFE at 2026-10-17T20:00Z (five reconcile loops acquired=0, lease starvation); starvation window coincides with sync-owner revision rolls #22061/#22063 (18:20Z/20:26Z) and leases recovered by 21Z, off stands pending lease rework (decision-2026-10-18T00Z-flagoff-five.md). - The four 5% levers: shared guard service backend-sync-backfill exempt only until 2026-10-18T01:00Z with 5xx at 7-8%/h and rising (630->2737/h 15Z-22Z) through sync-owner sequencer rework; evidence ambiguous -> off per loop judgment rules; re-enable at 5% after recovery exonerates. Reviewed by zcode glm-5.3: r1 exec-erupt-ordinary-quote-scrap-observe-reject (singleton-only, SAFE); r2 exec-print-tortoise-fire-panda-sustain-enforce caught replace-mode literal dropping the seven graduated levers (FIX-REQUIRED, fixed by restoring the complete 12-key literal + rebase onto #22066). Contract tests 79/79 green.
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. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 18, 2026
…budget lever (dark, WQ1+WQ3) (#22142) * perf(firestore): singleton lease fail-open rework — starvation worst case equals lever-off (dark) Loop: firestore-reads WQ1. singleton_loops is flagged OFF in prod (#22071) after the 2026-10-17 19-21Z fleet-wide acquisition starvation across two revision rolls; this rework is the precondition for re-ramping it. - takeover at tick expiry (Lua-side, tick PTTL as clock): a dead holder hands over within <=1 interval (<=300s) instead of the full lease TTL; only one admission per tick survives (tick SET NX inside the atomic script) - a pod wedged inside its callback fails open and runs the next invocation locally after the 900s max-hold cap (lever-off semantics) instead of skipping forever - SIGTERM release runs outside asyncio and the db executor so a starved shutdown hook cannot leave stale lease keys behind - lever-off path byte-for-byte unchanged; queue-age publisher handoff unchanged Verified: 53/53 targeted tests (42 s2 + 8 recovery + 3 real-Redis Lua) via BACKEND_UNIT_TEST_FILE_LIST; zcode glm-5.3 review SAFE (exec-flush-position-logic-lion-figure-force, all six claims re-verified, no real findings; 2 minors recorded: getsignal-None hardening unreachable under the pinned uvicorn launch, new skip outcome labels double-count on sum-by-loop dashboards). Author report: data/run-2026-10-16-firestore-reads/SOL-WQ1-lease-report.md (meta-repo). No lever config change in this PR. * perf(firestore): queue-age sample budget lever — stop rescanning the ready set every tick (dark) Loop: firestore-reads WQ3. durable_queue_age._sample_status_page re-scans the whole ready set on every publisher tick: measured 73.93M reads/day (backend-sync 71 pods + backfill 5 + backend 4 at 300s ticks, reconciled from snapshot 2026-10-18T05:00:38Z vs ~74M/day origin reads). New default-off lever queue_age_sample_budget: - 300s per-pod publish cache (FSR_QUEUE_AGE_MIN_PUBLISH_SECONDS), ages stamped at scan start, expiry re-checked under the lock; freshness lag <=600s + scan time - first-page early-stop when the full first page proves the oldest ready age strictly above the 21600s alert threshold (boundary-matched); small ages still require exhaustive scans; capped/malformed scans still omit the key (unknown, never 0) — malformed docs now force unknown even alongside valid rows - new omi_queue_age_sample_timestamp_seconds gauge makes stale publication detectable Lever-off path is instruction-identical (verified by review); 126 targeted tests pass incl. probe-counter proof 4250 -> 200 reads over five ticks; zcode glm-5.3 review SAFE (exec-cable-van-shiver-multiply-meat-three). KNOWN_LEVERS registration lands with the loop's config PR before any enable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Firestore reads loop emergency flag-off config: five
FIRESTORE_READ_LEVERSvalues → 0, other seven levers unchanged (batch-1 seven at 100%).singleton_loops(100 → 0): loop verify graded UNSAFE at 2026-10-17T20:00Z — all five reconcile loops showedacquired=0 max_hold=0for consecutive hours (lease admission starvation). Off-path restores the pre-lever per-process reconcile loops. Reviewed SAFE by zcode glm-5.3 (exec-erupt-ordinary-quote-scrap-observe-reject); the starvation window coincides with the sync owners' revision rolls (config(sync): disable expiry retirement in prod (undelivered-recording incident) #22061/fix(sync): retain expired obligations in durable redrive custody (dark) #22063 at 18:20Z/20:26Z) and leases fully recovered at 21–23Z, but the off decision stands pending lease rework (seedecision-2026-10-18T00Z-flagoff-five.md).backfill_task_reads(5 → 0),historical_scan_memo(5 → 0),ledger_purge_coalesce(5 → 0),people_scan_dedupe(5 → 0): their shared 5xx guard servicebackend-sync-backfillruns at ~8% error rate (2737 errs/h at 22Z vs the 1.46% reference; trend 630 → 2737/h from 15Z to 22Z through the sync owners' sequencer-rework deploys). The guard exemption for that service expires 2026-10-18T01:00Z and instructs "do not extend without new evidence" — the rate is not exoneration evidence, and per loop judgment rules ambiguous evidence ⇒ flag off; re-enable at 5% after the service recovers and the absolute readout shows a real drop. At 5% with scopes inert these levers remove ~0 reads (23Z verify: INCONCLUSIVE/-0.1M/day), so this is operationally near-free.Config only, generated with
avo/firestore-reads/set_levers.py; the rendered literal is identical across_base.yaml, regeneratedruntime_env.yaml, listen/pusher dev+prod values, the flag registry doc, and the two pinned contract tests. Note the literal keeps all twelve keys — missing keys default OFF (backend/config/firestore_read_levers.py), so the seven graduated levers must stay explicit at 100 (r2 review catch, fixed).Product invariants affected
FIRESTORE_READ_LEVERSkey.Test plan
backend/tests/unit/test_verify_pusher_config_references.py+backend/tests/unit/test_render_backend_runtime_env.pypass locally (79 tests).Rollout
gcp_backend.yml), so the train must complete once started. Pusher prod rides the exact-main dev-qualification path per config(firestore): ramp singleton_loops to 100% #21971 policy (dev auto-deploy re-fires on this merge; last prod pusher roll 04:11Z, pre-batch-2 — pusher's env defaulting missing keys off matches this literal's explicit 0s). Desktop-backend untouched (traffic pinned).Review chain (zcode glm-5.3): r1
exec-erupt-ordinary-quote-scrap-observe-rejectSAFE (singleton-only draft); r2exec-print-tortoise-fire-panda-sustain-enforceFIX-REQUIRED (caught replace-mode literal dropping the seven graduated levers → fixed with the complete 12-key literal + rebase onto b325c77); r3 re-review of the fixed commit.