Skip to content

chore(deploy): mirror the 2026-10-24 backend-sync costcut into deploy config - #23550

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/cfgsync
Oct 24, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/cfgsync

Conversation

@Git-on-my-level

Copy link
Copy Markdown
Member

What

Mirrors the lead's 2026-10-24 evening costcut (the live right-sizing #23495 did not cover) into the deploy config, so the next train re-asserts it instead of reverting it. The T4 deploy (image 646e54d, run 40138604325) came back with backend-sync at 4Gi / max 80; the lead re-applied 6Gi / min 5 / max 50 live (22:45-22:48Z), and the config-train's stale service-level annotations were still fighting it tonight (drift evidence below).

Service Setting Source before After (= live)
backend-sync memory (prod fallback) 4Gi (the 05:54Z mirror) 6Gi
backend-sync max-instances (ops) 80 50
backend-sync min-instances (ops) 1 5
backend-integration min-instances (ops) 1 (fought the deploy flag's 3) 3
backend cpu/memory/concurrency/min/max revision-inherited only 2 / 8Gi / 20 / 3 / 100 (prod-scoped)
backend-sync-staging memory (shape parity) 4Gi 6Gi

Why cfgmirror (#23495) missed it

  1. memory: chore(deploy): mirror the 2026-10-24 Cloud Run right-sizing into deploy config #23495 mirrored the 05:54Z right-sizing (4Gi). The evening costcut moved prod to 6Gi live-only; the workflow fallback kept deploying 4Gi.
  2. sync max 50: chore(deploy): mirror the 2026-10-24 Cloud Run right-sizing into deploy config #23495 deliberately left prod.yaml backend-sync.max_instances: 80 "until the lead names the flip". The config-train writes the service-level run.googleapis.com/maxScale from that file, and the deploy's Resolve live sync maxScale prefers the service-level annotation over the serving revision's template — so the lead's template-level 50 loses to the stale service-level 80 on every deploy. Verified live tonight: serving template 5/50, service-level 80.
  3. integration min: the deploy asserts 3 (prod && 3); prod.yaml asserted 1, so the config-train kept idling the projection pump between applies.
  4. backend shape: never in source — inherited revision-to-revision, so a fresh service would deploy defaults.

How

  • gcp_backend.yml: backend_sync_memory prod fallback 4Gi -> 6Gi (vars.BACKEND_SYNC_MEMORY verified unset in org, prod and development scopes; the fallback is what deploys).
  • deploy-backend-stack: the backend step gains prod-scoped shape flags --cpu=2 --memory=8Gi --concurrency=20 --min-instances=3 --max-instances=100 (dev branch empty — dev keeps inheriting). Values are the verified live serving revision backend-646e54d-40138604325-1 (22:39Z). cpu=2 pairs with 8Gi per [loop-c] main CI red: gha-ERROR: (gcloud.run.deploy) spec.template.spec.containers[N].resources.limits.memory: Invalid value specified for contain #21668 (1-CPU 8Gi deploys are rejected outright).
  • backend/deploy/ops/prod.yaml: backend-sync max 80 -> 50, min 1 -> 5 (the warm floor the conversation-finalization queue comment already sizes against: min 5 x concurrency 20); backend-integration min 1 -> 3, equal to the deploy flag so the ops file never fights the deploy.
  • backend/deploy/staging/deploy.sh: staging sync memory 4Gi -> 6Gi (drift_check EQUAL_SCALE_FIELDS parity).
  • backend/docs/runbooks/sync-ingest-archive.md: prod default memory and workflow fallback documented as 6Gi; the memory-trial recipe stays generic.
  • Contract pins: new backend/tests/unit/test_cloud_run_rightsizing_pins.py holds the workflow fallback literal, the deploy-flag shape, the ops values (including the redis_guard backfill bounds) and staging-vs-prod parity through drift_check.source_model. Updated pins: test_drift_check.py (6Gi) and test_render_backend_runtime_env.py (backend legitimately carries --cpu=2 now; every integration-specific flag still excluded from it, and backend's own prod-scoped shape is pinned literally).

Verification

  • Targeted backend unit shard green locally (394 passed) via backend/test.sh + BACKEND_UNIT_TEST_FILE_LIST over the changed test files.
  • .github/scripts/check_ci_budget.py passes with no ci-budget.yaml change (value/flags-expression edit only; no trigger, timeout, runner or job-shape change).
  • drift_check.py source --env prod against a fresh ro-prod snapshot (22:5xZ): the only scale findings are the intended reconciliations — backend-sync service_min 1 != ops 5, backend-sync service_max 80 != ops 50, backend-integration service_min 1 != ops 3 (the stale live service-level annotations the config-train will overwrite from this file). No other scale drift; the deploy-flag model matches live for all four services.

Not changed (deliberate)

  • backend-sync-backfill: already correct everywhere (4Gi / min 0 / redis_guard-bounded max, live 16); nothing to mirror.
  • backend-sync max stays live-resolved in the deploy (Resolve live sync maxScale); the cap's source of record is the ops file.
  • Dev (based-hardware-dev, non-staging) shapes untouched: the new backend flags are prod-scoped and dev keeps inheriting.
  • backend-sync concurrency/timeout: live and staging agree (20/3600) and the deploy inherits them; not part of the costcut.

Product invariants affected

  • INV-DATA-1 — edits .github/workflows/gcp_backend.yml (one deploy parameter value; no trigger, timeout, runner or new-workflow change).

… config

The T4 deploy (646e54d, run 40138604325) re-asserted backend-sync at
4Gi / max 80: #23495 mirrored the 05:54Z right-sizing, not the evening
costcut. The config-train's service-level maxScale (80, from prod.yaml)
also outranks the lead's template-level 50 in the deploy's live-resolve
step, so the cap reverted on every deploy.

- gcp_backend.yml: backend_sync_memory prod fallback 4Gi -> 6Gi
  (BACKEND_SYNC_MEMORY unset in every scope; the fallback deploys).
- deploy-backend-stack: prod backend now pins its own live shape
  (cpu 2 / 8Gi / concurrency 20 / min 3 / max 100, prod-scoped; dev
  inherits). 8Gi needs >=2 CPU (#21668).
- ops/prod.yaml: backend-sync max 80 -> 50, min 1 -> 5;
  backend-integration min 1 -> 3 (stops fighting the deploy flag).
- staging deploy.sh: sync memory 4Gi -> 6Gi (EQUAL_SCALE_FIELDS parity).
- runbook: prod default memory documented as 6Gi.
- Contract pins: test_cloud_run_rightsizing_pins.py (new) holds the
  workflow fallback, deploy flags, ops values and staging parity;
  drift/render pins updated to the costcut values.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T23:18:15.596830Z 81d61b8 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 252e3b8 into main Oct 24, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/cfgsync branch October 24, 2026 23:29
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