Skip to content

perf(firestore): enable the batch privacy generation memo in every lever manifest - #24455

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/fsr-bpp-memo
Nov 3, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/fsr-bpp-memo

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Sets bpp_generation_memo:100 in FIRESTORE_READ_LEVERS everywhere the lever map is declared: listen and pusher chart values (dev and prod), the desktop backend, and every Cloud Run service and job in runtime_env/_base.yaml and prod.overlay.yaml. All other lever values are unchanged, including prod backend-sync's usage_month_cache/usage_month_total override.

The rollout lead is setting the same value live on the serving services after train cost2-1103 (listen and pusher at fa73bb8). This PR makes the manifest match so the next deploy does not drop it.

The memo stops batch_pipeline_privacy from re-reading privacy inputs on every task attempt. That caller is the largest Firestore reader at about 6.1M reads/h on backend-integration and backend-sync. Its writer fence (#23894) and follow-up (#24402) are on main and in the serving images. Expected saving (estimate): -$28 to -$43/day. It will be read back from the Firestore reads loop caller counter after the live set.

Rollback: set bpp_generation_memo to 0 in the lever map (live env edit, no image change), or revert this PR.

Product invariants affected

  • INV-MEM-4: not affected. The changed deploy manifest is a locked path, but only the Firestore read lever map changes; memory intake and promotion routes are untouched.
  • Privacy enforcement for batch units. The memo only reuses a decision for the same task-attempt generation, and the writer fence invalidates it when privacy inputs change (backend/database/batch_pipeline_privacy.py). Failed reads never publish partial decisions (test_failed_reads_never_publish_partial_decisions). No user-visible change.

How it was verified

  • Manifest rewritten with the Firestore reads loop's set_levers.py, then compose_runtime_env.py and render_feature_flag_registry.py --as-of 2026-11-02 regenerated the outputs.
  • backend/test.sh with test_render_backend_runtime_env.py, test_verify_pusher_config_references.py, test_bpp_generation_memo.py and test_bpp_generation_fence.py: 98 + 32 + 91 + 28 passed.

Tests

Updated pinned literals in test_render_backend_runtime_env.py (including the per-host expected map) and test_verify_pusher_config_references.py.

UI evidence

None (backend config only).

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…ver manifest

Sets bpp_generation_memo:100 in FIRESTORE_READ_LEVERS for listen, pusher,
the desktop backend, every Cloud Run service and job (base and prod
overlay), so the manifest matches the live lever the rollout lead sets and
the next deploy does not drop it. The writer fence (#23894) and its
follow-up (#24402) are on main and in the serving images.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 10 files

Confidence score: 3/5

  • backend/deploy/runtime_env/prod.overlay.yaml enables batch privacy memo enforcement at 100% before the required shadow qualification. Keep bpp_generation_memo at 0 until all planes have completed 14 days of shadow runs with zero unexplained mismatches.
  • backend/deploy/runtime_env/_base.yaml raises the literal key count to 22, but runtime_env/README.md still documents 20. Update the manifest documentation and pinned key count.
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/deploy/runtime_env/_base.yaml">

<violation number="1" location="backend/deploy/runtime_env/_base.yaml:30">
P3: This new lever makes the Firestore read-train documentation’s key count stale: these literals now contain 22 keys, while `runtime_env/README.md` still says 20. Update the manifest documentation and pinned key-count expectations to include `bpp_generation_memo`.</violation>
</file>

<file name="backend/deploy/runtime_env/prod.overlay.yaml">

<violation number="1" location="backend/deploy/runtime_env/prod.overlay.yaml:540">
P1: This enables batch privacy memo enforcement at 100% before the repository’s required shadow qualification. Keep `bpp_generation_memo` at 0 until shadow runs across all planes for 14 days with zero unexplained mismatches, then ramp it through the documented staged rollout.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

# carries people=5, memory=0, privacy=0 (finjob=5).
# Lead train: listen -> pusher -> Cloud Run; do not enable additional monthly readers here.
FIRESTORE_READ_LEVERS: {value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}', category: rollout}
FIRESTORE_READ_LEVERS: {value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"bpp_generation_memo":100,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}', category: rollout}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: This enables batch privacy memo enforcement at 100% before the repository’s required shadow qualification. Keep bpp_generation_memo at 0 until shadow runs across all planes for 14 days with zero unexplained mismatches, then ramp it through the documented staged rollout.

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/deploy/runtime_env/prod.overlay.yaml, line 540:

<comment>This enables batch privacy memo enforcement at 100% before the repository’s required shadow qualification. Keep `bpp_generation_memo` at 0 until shadow runs across all planes for 14 days with zero unexplained mismatches, then ramp it through the documented staged rollout.</comment>

<file context>
@@ -537,7 +537,7 @@ overlay:
           # carries people=5, memory=0, privacy=0 (finjob=5).
           # Lead train: listen -> pusher -> Cloud Run; do not enable additional monthly readers here.
-          FIRESTORE_READ_LEVERS: {value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}', category: rollout}
+          FIRESTORE_READ_LEVERS: {value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"bpp_generation_memo":100,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}', category: rollout}
           FSR_USAGE_MONTH_TOTAL_EPOCH: {value: c2fs_20261026_r1, category: rollout}
           # Batch ladder 2026-10-29 (lead ruling 12:15Z): pin shadow 25 so a Cloud Run deploy
</file context>

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This new lever makes the Firestore read-train documentation’s key count stale: these literals now contain 22 keys, while runtime_env/README.md still says 20. Update the manifest documentation and pinned key-count expectations to include bpp_generation_memo.

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/deploy/runtime_env/_base.yaml, line 30:

<comment>This new lever makes the Firestore read-train documentation’s key count stale: these literals now contain 22 keys, while `runtime_env/README.md` still says 20. Update the manifest documentation and pinned key-count expectations to include `bpp_generation_memo`.</comment>

<file context>
@@ -27,7 +27,7 @@ environment_shared:
         SYNC_POLL_BACKOFF_ENABLED: {value: 'false', category: rollout}
         FIRESTORE_READ_LEVERS:
-          value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}'
+          value: '{"action_items_page":100,"backfill_task_reads":100,"batch_privacy_memoize":0,"bpp_generation_memo":100,"candidates_page":100,"canonical_statuses_dedupe":100,"conversation_list_cursor":100,"deletion_marker_cache":100,"finjob_candidate_queries":0,"historical_scan_memo":100,"ledger_purge_coalesce":100,"mcp_conversation_cards_cache":100,"memory_list_index_window":0,"people_scan_dedupe":0,"queue_age_sample_budget":100,"request_read_dedupe":100,"serving_config_cache":100,"singleton_loops":100,"subscription_cache":100,"sync_snapshot_resolve_cache":5,"usage_month_cache":0,"usage_month_total":0}'
           category: rollout
         FSR_QUEUE_AGE_PUBLISHER:
</file context>

@Git-on-my-level
Git-on-my-level merged commit a32c762 into main Nov 3, 2026
72 of 74 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/fsr-bpp-memo branch November 3, 2026 04:27
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
… (post-#24422 re-pin) (#24504)

## What

FIRESTORE_READ_LEVERS config-only change on top of #24455's 22-key
manifest:

- `people_scan_dedupe` 0 -> 5: the #24422 rewrite has served dark since
2026-11-03T02:49Z. Its pre-ramp base is re-pinned from a
post-dark-deploy snapshot as the PR asked
(`baseline-2026-11-03T12Z-post24422.json`: list_people 261,561/h +
read_people_generation 0 rows in top_1h ~= 6.28M/day at 1hx24; the old
~15.1M/day pin predates the dark deploy).
- `finjob_candidate_queries` 0 -> 5: flagged off 2026-11-01 during the
exogenous `/v2/sync-jobs/run` + `/v2/sync-local-files` 5xx waves. Both
routes are now named guard exclusions until 2026-11-09 (workspace main
fb748d571f7 + 852e2fb0cb3, lead rulings bus 01:18Z and b33168 03:55Z),
the guard flag_off has been quiet since 09Z, and verify 2026-11-03T12Z
is PASS.

Everything else is byte-identical to the origin/main manifest, including
`bpp_generation_memo:100` and `sync_snapshot_resolve_cache:5` and the
#24210 backend-sync `usage_month_cache`/`usage_month_total`=100
exception.

## Product invariants affected

- INV-FSR-LEVERS (REPLACE-mode literal rule respected; both keys already
in KNOWN_LEVERS; default-off sites unchanged)
- INV-MEM-4: not affected. The changed deploy manifest is a locked path,
but only the Firestore read lever map changes; memory intake and
promotion routes are untouched.

Failure-Class: none

## Verification

- `set_levers.py` REPLACE-mode with the full 22-key literal;
`compose_runtime_env.py` and `render_feature_flag_registry.py`
regenerated outputs; diff audit shows only the two keys changed across
all literal sites (the #24210 backend-sync exception preserved).
- Contract tests on the lane venv: 119/119 pass
(`test_render_backend_runtime_env.py` incl. the
`test_firestore_train_preserves_monthly_reader_scope_and_cloud_run_overrides`
expected-literal updated to the new values;
`test_verify_pusher_config_references.py`). #24210 backend-sync
`usage_month_cache`/`usage_month_total`=100 override site preserved
(rendered line 3401).
- Firestore reads loop verify 2026-11-03T12Z PASS (no lever
UNSAFE/FALSIFIED).

## Lead-owned ship plan

Deploy needed: listen -> pusher -> Cloud Run (+ desktop-backend + jobs
ride runtime_env) — FIRESTORE_READ_LEVERS train order per the two-lane
split. Config rides the next routine trains; no new train requested.


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