Repository navigation
config(ops): backend-sync max_instances 40 -> 30 (margin G1, gated) - #24303
Conversation
Source change only. The config-train is workflow_dispatch, so merging this applies nothing; the lead dispatches config_train.yml (prod, plan then apply) after #24264 has served 7h and syncdiet's gates hold for 1h. Backend deploys live-resolve the sync maxScale, so a train cannot revert the applied value. Pins test_cloud_run_rightsizing_pins.py to (min 5, max 30). Rollback: 40. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 3/5
- The value in
backend/deploy/ops/prod.yamlis applied to every prod config-train apply, so unrelated changes can also hit thebuild_planchecks intended for the gated lead dispatch. Scope it to that dispatch path.
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/ops/prod.yaml">
<violation number="1" location="backend/deploy/ops/prod.yaml:78">
P1: This value is applied by every prod config-train apply, not only the one the lead dispatches after the gates. `build_plan` checks every service in the file, so any unrelated apply (for example a queue rate change) will set backend-sync to max 30 before the 7h/1h gates hold. Keep `max_instances: 40` in this PR and change it to 30 only in the gated apply.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| # custody deferrals) has served 7h and the syncdiet gates hold for 1h. Merging | ||
| # this does not apply it; the lead dispatches the config-train after the gates. | ||
| # Rollback: 40 (floor remains 5). | ||
| max_instances: 30 |
There was a problem hiding this comment.
P1: This value is applied by every prod config-train apply, not only the one the lead dispatches after the gates. build_plan checks every service in the file, so any unrelated apply (for example a queue rate change) will set backend-sync to max 30 before the 7h/1h gates hold. Keep max_instances: 40 in this PR and change it to 30 only in the gated apply.
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/ops/prod.yaml, line 78:
<comment>This value is applied by every prod config-train apply, not only the one the lead dispatches after the gates. `build_plan` checks every service in the file, so any unrelated apply (for example a queue rate change) will set backend-sync to max 30 before the 7h/1h gates hold. Keep `max_instances: 40` in this PR and change it to 30 only in the gated apply.</comment>
<file context>
@@ -71,8 +71,11 @@ cloud_run:
+ # custody deferrals) has served 7h and the syncdiet gates hold for 1h. Merging
+ # this does not apply it; the lead dispatches the config-train after the gates.
+ # Rollback: 40 (floor remains 5).
+ max_instances: 30
min_instances: 5
backend-sync-backfill:
</file context>
| max_instances: 30 | |
| max_instances: 40 |
… G1) (#24329) ## Problem and change #24303 set `backend/deploy/ops/prod.yaml` `cloud_run.backend-sync.max_instances` to 30 for a gated apply. The lead held the apply at 02:11Z, and it never ran: live is still 40. Leaving 30 in source means the next config-train dispatch, for any reason, would apply it without the gates. This PR puts the source back to 40 and the `test_cloud_run_rightsizing_pins.py` pin back to (5, 40). Live does not change. ## Why the cap is dropped, not delayed (measured, ro-prod Cloud Monitoring, backend-sync) | hour | requests/h | avg instances | max_request_concurrencies p95 | latency p95 | |---|---:|---:|---:|---:| | 16–17Z 11-01 (before #24264) | 133.4k | 39.9 | 13.4 | 8.82 s | | 01–02Z 11-02 | 93.1k | 33.3 | 18.4 | 12.01 s | #24264 removed the short (~2.4 s) deferred re-polls, so the remaining requests are long sync jobs. In-flight per instance rose while instances fell 40 → 33 on their own. At concurrency p95 18–20 of `containerConcurrency` 20, a cap of 30 would queue work rather than trim idle capacity. The instance saving the cap targeted has already happened. ## Validation `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST` = test_cloud_run_rightsizing_pins.py, test_config_train.py, test_drift_check.py: 88 passed (4 + 52 + 32), via `bin/omi-heavy`, with no GCP credentials. The bounded pre-push gate passed. Rollback: revert this PR. Applying nothing either way: config-train is `workflow_dispatch` only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24329?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/24329?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24329&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. -->
… G1) BasedHardware#24303 set the source cap to 30 for a gated apply that never happened (lead held it at 02:11Z). After BasedHardware#24264 removed the short deferred re-polls, sync runs long jobs at max_request_concurrencies p95 18-20 of containerConcurrency 20 on ~33 instances, so a lower cap would queue work rather than trim idle capacity. Live stays 40; this puts the source back so no config-train dispatch can apply 30 without the gates. Pins test_cloud_run_rightsizing_pins.py to (5, 40). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem and change
backend-sync is pinned at its service cap of 40 instances (syncdiet, 2026-11-01): bursty hot instances
keep the autoscaler at the cap, so the instance saving from #24264 (hourly re-poll of long-stuck
custody deferrals, ~45k fewer sync-jobs/run deliveries per hour) only lands through a lower cap.
This PR changes the ops source of truth only:
backend/deploy/ops/prod.yamlcloud_run.backend-sync.max_instances40 → 30 (min stays 5), and pinstest_cloud_run_rightsizing_pins.pyto (5, 30).Merging applies nothing.
config_train.ymlisworkflow_dispatchonly. Backend deployslive-resolve the sync maxScale, so no train reverts the live value either way.
Expected: −10 instances × 24 h × $0.1789/inst-h ≈ −$43/day (syncdiet's instance-based rate),
visible only after the apply.
Apply (lead, after the gates)
Gates (syncdiet §1, lead ruling 92aecb), each held for 1 h:
d1024bc3e84f, serving since2026-11-01 19:11:16Z), so the earliest apply time is 02:11Z 11-02.
task_attempt_delaysp95 < 2 s.max_request_concurrenciesp95 ≤ 13.5.{"status":"deferred"}) share of sync-jobs/run 200s < 10%.Read-only checker (ro-prod, aggregates only), held outside the repo:
python3 -I /Volumes/Ephemeral/scratch/margin20/g1_gates.py --census. Baselines by the samemethod: gate 4 = 13.4 (16–17Z 11-01), 17.4 (18–19Z), 18.7 (19:28–20:28Z). Gate 4 may not clear
on a Sunday evening.
Apply, canonical path:
Break-glass equivalent:
infra/rollout/bin/cr_apply.sh backend-sync --max=30. The service-levelannotation is the authoritative cap (the sentinel reads it), and
--maxcreates no revision.The sentinel's hard-coded sync target (
sentinel/scripts/cloud_run_state.pyTARGETS) still reads80, which is already stale against live 40. The lead updates it to 30 at apply.
Rollback
cr_apply.sh backend-sync --max=40, which takes minutes. Then revert this PR (or set 40) so thenext config-train keeps it. Roll back on any of: attempt-delay p95 > 2 s for 15 min,
latency p95 > 12 s for 15 min, or sync-jobs-fresh depth above 2× its pre-apply hour.
Relation to #23973
#23973 edits the same key. Its body describes 5/50 → 3/20, but main is now 5/40, and the author holds
it until fresh qualification. It must not merge as-is. If it is revived after this PR, rebase it
onto 5/30. G1 does not depend on it.
Validation
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST= test_cloud_run_rightsizing_pins.py,test_config_train.py, test_drift_check.py: 88 passed (4 + 52 + 32), run through
bin/omi-heavywithno GCP credentials. The bounded pre-push gate passed.
Owns: this PR only. Review: Luna, via review.sh.
🤖 Generated with Claude Code