Repository navigation
margin-20: config right-sizing (Cloud Run, GKE floors, Firestore levers, idle T4s) - #24596
Conversation
Set memory_list_index_window=100 only on prod Cloud Run/listen/pusher. Preserve monthly-reader scopes and all other levers. Token-validated negative caches stay absent: tombstone has no read saving, and legal-hold needs a qualified eligible-hit share above 50 percent. Rollback: restore memory_list_index_window=0 on the same six targets; roll listen, then pusher, then Cloud Run.
Backend memory 8Gi to 4Gi; backfill memory 3Gi to 2Gi and concurrency 6 to 10. Match staging shape; preserve dev sizing and the Redis-owned maxScale. Rollback: backend memory 8Gi; backfill memory 3Gi and concurrency 6 in deploy flags and staging shape.
Listen minReplicas 20 to 12, pusher 12 to 8. Retain listen CPU request 1 and all current scale-out metrics/ceilings; actual 24h listen CPU p95 reaches 1.09 cores. Rollback: restore listen minReplicas=20 and pusher minReplicas=12 and reroll the corresponding Helm releases.
Set replicaCount and autoscaling.minReplicas together from 6 to 4. Retain the 12-worker ceiling, scale-out metrics and on-demand pool. No daytime saving is assumed while demand pins the HPA at 12. Rollback: restore both replicaCount and autoscaling.minReplicas to 6 and reroll prod-omi-batch-pipeline-worker.
Match the already-live sync interval: shared profile 30s to 60s, with existing keep-lists and sample limits intact. Rollback: restore interval 30s and redeploy services using the shared RunMonitoring profile.
There was a problem hiding this comment.
3 issues found across 18 files
Confidence score: 3/5
action.ymlraises production worker concurrency without updating the backfill dispatch budget, so Cloud Tasks may still cap throughput at the old allowance. Update the queue-cap contract and ops value to match.- The production chart lowers the worker floor to 4, but the capacity runbook still tells operators to keep it at 6. Update the runbook’s bounds, checklist, and rollback guidance.
cloud_run_gmp_sidecar.yamlchanges the shared scrape interval to 60s, while the rollout runbook still assumes 30s for backend and desktop. Update its cadence, freshness, and cost guidance.
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=".github/actions/sync-backfill-lifecycle/action.yml">
<violation number="1" location=".github/actions/sync-backfill-lifecycle/action.yml:242">
P2: This raises production worker concurrency to 10 without keeping the backfill dispatch budget in sync. Update the queue-cap contract/ops value to use the new concurrency, otherwise Cloud Tasks can continue limiting throughput to the old six-per-instance sizing and delay queued backfills.</violation>
</file>
<file name="backend/charts/batch-pipeline-worker/prod_omi_batch-pipeline-worker_values.yaml">
<violation number="1" location="backend/charts/batch-pipeline-worker/prod_omi_batch-pipeline-worker_values.yaml:16">
P2: This chart lowers the production floor to 4, but the capacity runbook still declares min 6 as current and instructs operators to keep both values at 6. Update the runbook’s current bounds, checklist, and rollback guidance with this change, or keep the source floor at 6; otherwise Helm rollouts and incident procedures give contradictory capacity instructions.</violation>
</file>
<file name="backend/deploy/cloud_run_gmp_sidecar.yaml">
<violation number="1" location="backend/deploy/cloud_run_gmp_sidecar.yaml:12">
P3: This shared profile now scrapes every 60s, but the rollout runbook still describes backend and desktop as 30s. Update those cadence, freshness, and cost references so operators do not use a stale monitoring window.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| --max-instances=${{ steps.live-max-scale.outputs.max_scale }} | ||
| --max=${{ steps.live-max-scale.outputs.max_scale }} | ||
| --concurrency=6 | ||
| --concurrency=${{ inputs.project_id == 'based-hardware' && '10' || '6' }} |
There was a problem hiding this comment.
P2: This raises production worker concurrency to 10 without keeping the backfill dispatch budget in sync. Update the queue-cap contract/ops value to use the new concurrency, otherwise Cloud Tasks can continue limiting throughput to the old six-per-instance sizing and delay queued backfills.
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 .github/actions/sync-backfill-lifecycle/action.yml, line 242:
<comment>This raises production worker concurrency to 10 without keeping the backfill dispatch budget in sync. Update the queue-cap contract/ops value to use the new concurrency, otherwise Cloud Tasks can continue limiting throughput to the old six-per-instance sizing and delay queued backfills.</comment>
<file context>
@@ -237,9 +239,9 @@ runs:
--max-instances=${{ steps.live-max-scale.outputs.max_scale }}
--max=${{ steps.live-max-scale.outputs.max_scale }}
- --concurrency=6
+ --concurrency=${{ inputs.project_id == 'based-hardware' && '10' || '6' }}
--cpu=2
- --memory=${{ inputs.project_id == 'based-hardware' && '3Gi' || '8Gi' }}
</file context>
| # margin-20: lower the off-peak warm floor from 6 to 4; day demand still scales | ||
| # to max 12. replicaCount and autoscaling.minReplicas are one floor: change both. | ||
| # Rollback: restore both to 6. OD-first placement and scale-out signals stay intact. | ||
| replicaCount: 4 |
There was a problem hiding this comment.
P2: This chart lowers the production floor to 4, but the capacity runbook still declares min 6 as current and instructs operators to keep both values at 6. Update the runbook’s current bounds, checklist, and rollback guidance with this change, or keep the source floor at 6; otherwise Helm rollouts and incident procedures give contradictory capacity instructions.
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/charts/batch-pipeline-worker/prod_omi_batch-pipeline-worker_values.yaml, line 16:
<comment>This chart lowers the production floor to 4, but the capacity runbook still declares min 6 as current and instructs operators to keep both values at 6. Update the runbook’s current bounds, checklist, and rollback guidance with this change, or keep the source floor at 6; otherwise Helm rollouts and incident procedures give contradictory capacity instructions.</comment>
<file context>
@@ -10,15 +10,13 @@ dataPlaneProject: based-hardware
+# margin-20: lower the off-peak warm floor from 6 to 4; day demand still scales
+# to max 12. replicaCount and autoscaling.minReplicas are one floor: change both.
+# Rollback: restore both to 6. OD-first placement and scale-out signals stay intact.
+replicaCount: 4
autoscaling:
enabled: true
</file context>
| path: /metrics | ||
| interval: 30s | ||
| # margin-20: halve shared-profile ingestion; rollback 30s. | ||
| interval: 60s |
There was a problem hiding this comment.
P3: This shared profile now scrapes every 60s, but the rollout runbook still describes backend and desktop as 30s. Update those cadence, freshness, and cost references so operators do not use a stale monitoring window.
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/cloud_run_gmp_sidecar.yaml, line 12:
<comment>This shared profile now scrapes every 60s, but the rollout runbook still describes backend and desktop as 30s. Update those cadence, freshness, and cost references so operators do not use a stale monitoring window.</comment>
<file context>
@@ -8,7 +8,8 @@ spec:
path: /metrics
- interval: 30s
+ # margin-20: halve shared-profile ingestion; rollback 30s.
+ interval: 60s
timeout: 10s
metricRelabeling:
</file context>
…oors, backfill concurrency, memory lever) (#24601) Reverts the parts of #24596 that Luna blocked, keeping the cleared Cloud Run backend 8->4Gi and GMP 60s changes: - listen minReplicas back to 20, pusher back to 12 (P1: scale-in and the roll can drop live sockets without the qualified admission drain) - batch-pipeline-worker replicaCount/minReplicas back to 6 (P1: capacity runbook) - backfill keeps 2Gi but concurrency back to 6 (P2: 2Gi qualified only at 6) - FIRESTORE_READ_LEVERS memory_list_index_window back to 0 everywhere (P2: no cohort readout); listen/pusher env identical to pre-#24596 Co-authored-by: Claude Opus 5.5 <[email protected]>
…; memory_list_index_window 25 (#24639) ## What Config only, one batched lever change: | Key | Change | Why | |---|---|---| | `FSR_SUBSCRIPTION_TTL_SECONDS` | 60 -> 55 (all services) | cl2-replay's verified privacy replay (1,049 faulted transitions, 2026-11-04 20:12Z) found that, with both invalidations lost, the Redis `EX 60` subscription/BYOK entry is still served at exactly +60.000s: 37 mismatches at 0s margin. 55s gives 0 with 5s margin. | | `action_items_ttl120` | 0 -> 5 | Ordinary lever from #24624: the version-bumped action-item page cache reuses pages for at least 120s instead of the deployed 30s. | | `memory_list_index_window` | 0 -> 25 | Back to the cohort that soaked 48h clean (#23536). The #24596/#24601 revert objected to the 0->100 jump, not the lever. | | `backend/docs/runbooks/external-list-reads.md` | wording | States the live 5% polling-cache cohort from #24623 (Luna r1 minor on #24623). | Luna r1 removed `lifecycle_record_pending_head` from this change: it cohorts on a single namespace key, so 5% would be off on every replica. A follow-up keys it per replica. This also satisfies lead2's enforce requirement for #24622 (`1104-b059ba`): the subscription TTL becomes 55s. The new privacy caches already use a strict `< 60.000s` bound. ## Rollout David's 2026-11-04 policy for ordinary read levers: 5% for 1-2h with the firestore-reads 5xx/latency guards, then 100% the same day in a follow-up. Rollback: set any key back to its previous value. ## Verification - `pytest tests/unit/test_render_backend_runtime_env.py tests/unit/test_verify_pusher_config_references.py tests/unit/test_firestore_read_levers.py tests/unit/test_backend_runtime_env_validator.py`: 294 passed. - `pytest tests/unit/test_fsr_s4_caches.py`: passes (TTL ceiling 60 unchanged; 55 is within it). - Local push gate ran with `BACKEND_UNIT_FILE_BUDGET_SECONDS=900` (host load ~50); CI keeps its own 300s budget. ## Product invariants affected - INV-MEM-4 (path match on `backend/deploy/runtime_env.yaml` only; no memory promotion behavior changes) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ing_head 5, memory_list_index_window 0 -> 25 Ordinary read levers under David's 2026-11-04 policy (5% for 1-2h, then 100): - action_items_ttl120 / lifecycle_record_pending_head (code BasedHardware#24624) start at 5%. - memory_list_index_window returns to 25, where it soaked 48h clean before the BasedHardware#24596/BasedHardware#24601 revert; that revert objected to the 0->100 jump, not the lever. Rollback: set any key back to 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reduces verified production capacity floors, two Cloud Run memory limits, and Firestore reads through existing levers. Shared Cloud Run GMP collection moves to 60s. This is a config-only PR with existing contract pins updated; no product-code, merge, deployment, or production write is included. The lead owns qualification and rollout.
Config readbacks used
ro-prodon 2026-11-04 ~10:43–10:55Z; caller coverage was rechecked at 11:25Z. Source was checked against main; this branch incorporates main's zero-replica T4 fallback. Seven-day Cloud Monitoring application-memory data covers 2026-10-28T10:41Z–2026-11-04T10:40Z, with every API page fetched, application and collector containers separated. Percentiles/maxima below are histogram bucket upper bounds, not averages disguised as maxima.memory_list_index_window=100prod-omi-backend-listenprod-omi-pusherreplicaCount=4ANDautoscaling.minReplicas=4, max 12prod-omi-batch-pipeline-workervia diarizer/worker trainOMI_GMP_RUN_MONITORING_CONFIGmatches checked-in 30s profile; distinct sync profile already 60sEstimates are hypotheses from the scouts' billing-calibrated rates and measured caller volumes, not realized savings or proof of 20% margin. Floor savings depend on overnight demand and node autoscaling; no overlapping whole-node/packing savings are added. Existing output models and paid/trial feature admission are unchanged.
Rollout and deploy trap
Do not deploy this PR from the review lane. The rollout lead must roll listen → pusher → Cloud Run so cross-service candidate admission sees matching Firestore literals. Keep serving immutable image tags for chart-only rolls. The worker chart is a separate train.
Known trap:
cloud-run-deploy-resets-maxscale. Save/read back the lead's ops env/scale before the train and restore untouched overrides using the existing procedure. The Redis guard owns backfill maxScale (live service/revision 16, bounds 8–40); this PR does not edit it. Sync maxScale remains 40. The Cloud Tasks dispatch budget keeps its conservative six slots per capped instance / ceiling 90; this PR does not raise arrival limits. Verify each traffic-serving revision, not just the service template, after deployment.Existing drift is explicitly not resolved by this PR: Cloud Run serves
people_scan_dedupe=0andfinjob_candidate_queries=0while source carries 5 for both. Lead must preserve/reconcile those pre-existing pending ramps. Monthly-reader scope is retained: sync 100/100 forusage_month_cache/usage_month_total, other three Cloud Run services and GKE 0/0. Dev, jobs, and desktop Firestore literals are not changed.Before rollout, the lead should reconcile the existing operator runbooks with the proposed targets:
backend/docs/runbooks/batch-vendor-routing-capacity.mdstill instructs a 6/12 floor, andbackend/docs/runbooks/cloud-run-metrics-ingestion.mdstill describes the shared 30s profile. Their dated live/audit observations remain historical evidence; the proposed source targets are 4/12 and 60s, with rollback to 6 and 30s. Detailed review follow-ups are inops.md; this source PR stays config-only.Post-deploy read back actual values and identities, watch OOM/5xx, socket/queue health and background p95 delay (authority threshold: no more than 15 minutes worse). Use the margin meter for realized run-rate; revert the relevant commit if a controlled signal breaches its gate.
Items skipped after verification
tombstone_negative_cacheabsent→100legal_hold_fence_cacheabsent→100people_scan_dedupe5→100usage_month_cache0→100gmp-public/config, filter{}; no repo declarationverboseLogging: false, but live nginx access log is unconditional; skip on drift rule. Installed chart 6.33.0 has nonginxConfig.accessLogkeyops.mdCode and ledger verification
Existing levers are consulted on main:
backend/database/legal_holds.py:540–550→privacy_negative_cache.decide;backend/database/conversation_tombstones.py:15–26;backend/database/memories.py:458andbackend/utils/memory/memory_service.py:1515; skipped levers atbackend/database/person_aliases.py:252andbackend/database/user_usage.py:609. All are inKNOWN_LEVERS.backend/database/privacy_negative_cache.py:18–24validates the durable token on every reuse. Neither negative-cache key has a recorded correctness rollback, but their read economics do not qualify them as verified cuts:privacy_negative_cache.py:18–24always callsreference.getthroughprivacy_check_metrics.py:104–120. Tombstones start with one lookup; legal holds start with two. Both keys remain absent/off. Memory-window FLAG_OFF was FALSIFIED savings grading on 10-27; the ledger's WEAK 1.2M/day reduction sets the conservative estimate here. The old people implementation had ineffective scope and was rewritten; that does not prove the new 5% cohort is live on Cloud Run.VAD caller inventory:
backend/utils/sync/pipeline.py:986,backend/routers/speech_profile.py:132→backend/utils/stt/vad.py:302, maintenance scriptbackend/scripts/stt/j_apply_vad_to_speech_profiles.py:30; chat uses strict local VAD atbackend/utils/chat.py:160. The async hosted helper has no in-tree caller. Hosted transport atbackend/utils/stt/vad.py:150,276is bypassed whenSTT_GPU_FLEET_OFF=true, verified on prod Cloud Run/listen/pusher. Streaming/batch strict VAD is local. The HTTP image can select CPU (backend/modal/vad_modal.py:15,28), but no CPU conversion or callerless claim is qualified by this PR.Episode investigation: same-source in-cluster
sum(increase(llm_gateway_requests_total{lane_id="omi:auto:episode-incremental",phase="terminal"}[1h]))at ~10:55Z and offsets 4h/24h gives the counts above (~151k/day now vs ~177k/day yesterday at that hour). GMP has no gateway request series; Cloud Run moment counters cover only a small portion of the fleet, so source/coverage mismatch is a plausible explanation for 1.1k/day, not a proven reconstruction of the earlier query.backend/config/episodes.py:179–195hardcodes 60s/180s rate limits.backend/utils/episodes/service.py:939–960applies pause/recovery guards and choosesnotes_freefor composer-owned closed episodes;backend/utils/episodes/composer.py:813–852already implements that suppression.backend/utils/episodes/incremental.py:349–388can add one validator repair call. Changing these constants or broader admission/quality switches would be product work.Verification
/Users/dazheng/workspace/omi/bin/omi-heavy: final Firestore/renderer/drift/two-lane/pusher-reference/privacy-safety suites: 241 passed.test_cross_service_deploy_contract: 23 passed, 3 optional historical replays skipped.backend/scripts/pre-deploy-check.sh: 357 passed on the final reduced scope.test_fsr_wq5_index_window.py: 28 passed, covering cursor boundaries, hidden rows and bounded reads.memory_list_index_windowchanges, on exactly six prod hosts; dev/jobs/desktop and every other lever remain unchanged.make preflightand PR-body validation passed (56 selected checks). The installed full pre-push hook passed on the final head, including selected backend units and typechecking (0 errors).GOOGLE_APPLICATION_CREDENTIALSand everyCLOUDSDK_*variable were removed before push; no skip flags were used.Detailed local readbacks, scripts, test logs, and the lead's ops list:
/Volumes/Ephemeral/scratch/planscost-handoff/m20config/(ops.md,evidence/). No credentials or generated evidence are committed.Product invariants affected
Failure class (fixes)
No
fix:commits; this PR changes configuration and updates existing contract pins.