Skip to content

fix(deploy): declare projection finish backoff on for prod backend-integration - #25307

Merged
Git-on-my-level merged 4 commits into
mainfrom
fix/finish-backoff-integration-config
Nov 14, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
fix/finish-backoff-integration-config

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Why

BATCH_PROJECTION_FINISH_BACKOFF_ENABLED is being turned on for prod backend-integration on the push captain's go (SCA-2222, SCA-2166, 2026-11-14), applied by the release executor as a config-only revision. Repo config did not declare the lever at all, so the next deploy rendered from the repo would drop it. That is what happened to five hand-set Firestore lever values at 13:45Z today (fixed by #25277). This PR makes the repo say what production is meant to run.

Both conditions of the runbook's re-enable bar that could be met from code are met:

What changed

  • backend/deploy/runtime_env/prod.overlay.yaml: BATCH_PROJECTION_FINISH_BACKOFF_ENABLED: 'true' (category rollout) for backend-integration, which runs the finish sweep, and for backend-sync, which can reach the same sweep through its authenticated reconcile and batch metrics routes (review SCA-2270; its finish counters read 0 in production today, so this is consistency, not a second saving).
  • backend/deploy/runtime_env.yaml: regenerated.
  • config/deployment-setting-classification.json: the binding is classified as config.
  • backend/docs/feature-flag-registry.md: regenerated.
  • backend/tests/unit/test_render_backend_runtime_env.py: the pin moves from "absent everywhere" to "true on prod backend-integration and backend-sync, absent on every other service and environment".

What did not change

No code path. No other service: prod backend and backend-sync-backfill render an empty BATCH_PIPELINE_WORKER_AUDIENCE, so the authenticated reconcile route that reaches the sweep cannot be invoked on them. No dev environment. The code default stays off.

Tests

tests/unit/test_render_backend_runtime_env.py and tests/unit/test_backend_runtime_env_validator.py: 364 passed. Both generator --check commands pass.

Rollout

Rides the next backend train; until then the release executor's config-only revision carries the value. Proof after the flip, posted on SCA-2173: finish reads per ten minutes before and after, completions, fresh commits per ten minutes not below half the 15:12-15:42Z baseline, and no rise in over-SLA or unfinished projections.

Kill switch: BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=false restores the legacy finish page immediately.

Product invariants affected

  • INV-MEM-4

Named because backend/deploy/runtime_env.yaml changes. This PR adds one batch-projection binding for backend-integration and touches no memory intake, consolidation, promotion or privacy TTL setting; INV-MEM-4 behaviour is unchanged.

Failure-Class: FC-deploy-literal-reverts-operator-value

🤖 Generated with Claude Code

Git-on-my-level and others added 3 commits November 14, 2026 23:49
…tegration

The finish-backoff lever is being turned on for backend-integration, the
only service that runs the projection finish sweep, now that the one-time
stamping pass has completed (#25225, #25287) and the finish counters
export from that service (#25291). Repo config did not declare the lever
at all, so the next deploy would have dropped a hand-set value.

Declare BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=true for prod
backend-integration only, regenerate runtime_env.yaml, and move the
renderer pin: present and true on prod backend-integration, absent on
every other service and environment.

Kill switch: BATCH_PROJECTION_FINISH_BACKOFF_ENABLED=false.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…t rollout

The deployment secret-boundary check requires every rendered binding to be
classified; add BATCH_PROJECTION_FINISH_BACKOFF_ENABLED to the config list.
Use the rollout category, matching its lifecycle in config/feature-flags.yaml.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T18:04:59.605080Z 13a2040 New commits
ℹ️ 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 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

VERDICT: FIX at 29d19f4cdc1c755e85f848b914ea45405cca1108.

Blocking finding [P2]: prod backend-sync also hosts an executable finish-sweep path. BATCH_PIPELINE_SERVING_ENABLED=false only stops its startup supervisor; it does not prevent RPC-triggered sweeps. This is FC-rollout-flag-absent-from-a-cohost-of-its-code-path under the review's stated acceptance criterion.

  1. Binding placement: passes. The only occurrence in the rendered manifest is prod cloud_run/services/backend-integration/env at backend/deploy/runtime_env.yaml:5013, sourced from backend/deploy/runtime_env/prod.overlay.yaml:1661. I recursively checked the whole manifest, including both environments' Cloud Run services (backend, backend-sync, backend-sync-backfill, backend-integration), jobs (notifications-job, x-connector-sync-job, frame-request-retention-job, day3-reengagement-email-job), GKE surfaces (backend-listen, parakeet, pusher, shared config_map; prod also parakeet-lid), llm_gateway and desktop_backend. Surface blocks begin at manifest lines 6/17/399/406/666/741/836/1189/1532/1848/2137/2197/2270/2314 (dev) and 2379/2417/2907/2914/3120/3132/3222/3334/3848/4334/4772/5157/5213/5283/5329 (prod). No other binding was found.

  2. Category: passes. rollout matches this key's lifecycle in config/feature-flags.yaml:281. The renderer consumes value and ignores category metadata (backend/scripts/render_backend_runtime_env.py:355, :550); the validator compares literal values (backend/scripts/runtime_env_validation/common.py:314, :337). Running those actual functions on this binding emitted true and returned no validation errors. Its normal-env classification is config at config/deployment-setting-classification.json:110; the secret-boundary check passes.

  3. Exclusive code-path claim: fails. Integration is indeed the only manifest service with serving enabled (backend/deploy/runtime_env.yaml:4848; the other declarations are false at :93/:952/:1273/:1613/:1924/:2493/:3481/:3935/:4415). However:

    • The startup guard is only at backend/utils/batch_pipeline/serving.py:436. The independent pump defaults off (backend/config/policy/kill_switches.py:34) and has no manifest opt-in.
    • The batch router is mounted for API/worker roles (backend/app_roles.py:161, :242). Prod sync has a nonempty worker audience and invoker (backend/deploy/runtime_env.yaml:3942), so its authenticated /v2/batch-pipeline/reconcile endpoint can execute reconcile_async (backend/routers/batch_pipeline.py:65, :285). Its batch /metrics endpoint also reconciles because read-only metrics is false there (manifest :4141; router :291).
    • Reconcile calls projector.sweep() without checking SERVING_ENABLED (backend/utils/batch_pipeline/serving.py:147, :218); the sweep switch defaults true (backend/config/policy/kill_switches.py:33). This runs even without the maintenance leader lease. projection.py:1677 calls _sweep_finish, which selects the finish page at :1706 and settles at :1738.
    • With backoff absent, its default is false (backend/config/policy/kill_switches.py:31), so this cohost uses the unfiltered legacy page and skips deferral (backend/utils/batch_pipeline/projection_finish_backoff.py:23, :36). Integration's clock writes therefore do not eliminate that caller's repeated reads. An offline probe executing the exact reviewed Serving.reconcile method with inert collaborators confirmed one sweep with the prod-sync settings and the maintenance lease denied. This establishes executable reachability; no production traffic or metrics were inspected.
  4. Registry generation: passes. python3 scripts/render_feature_flag_registry.py --as-of 2026-11-11 followed by git diff --exit-code produced no change. The generated binding row is backend/docs/feature-flag-registry.md:198; the other doc hunk removes the key from the undeclared-bindings list.

  5. Diff scope: passes. Against merge base c5cf5a2b3dd2c3b3b638a562d066dafd92334753, exactly five files change (14 additions, 4 deletions): the one overlay binding/comment, one generated binding, classification entry, generated registry and renderer pin (backend/tests/unit/test_render_backend_runtime_env.py:1333). No other binding, secret, queue setting or lever map changes.

Smallest repair for SHIP: extend the same prod finish-backoff binding to backend-sync, update the renderer pin to expect both sweep hosts, and regenerate the manifest and registry. Classification needs no further change. This requires the owner to expand the integration-only rollout scope; changing the serving startup flag is not a fix. If integration-only rollout must remain, the sync RPC sweep must be disabled or removed and regression-tested before asserting exclusive execution.

Validation: 364 tests passed across test_render_backend_runtime_env.py and test_backend_runtime_env_validator.py under Python 3.11; compose --check, exact registry regeneration and deployment secret-boundary validation passed. Broad make preflight stopped because detached HEAD prevented PR-body discovery; rerunning its failing Failure-Class validator with the actual PR body passed. The broad gate is not a complete pass. No push, merge or production access.

…he sweep path

Review SCA-2270: backend-sync mounts the batch router with a worker audience,
so its reconcile and batch metrics routes can run the same finish sweep even
with serving disabled. Declare the same value there so both hosts of the code
path agree.

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@Git-on-my-level Git-on-my-level left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

VERDICT: SHIP at 13a2040bd1f84e5c5a9a2240972db10335138660.

Reviewed the delta from 29d19f4cdc1c755e85f848b914ea45405cca1108. The previous blocking cohost finding is resolved.

  • The manifest now declares BATCH_PROJECTION_FINISH_BACKOFF_ENABLED: {value: 'true', category: rollout} on exactly prod backend-sync and backend-integration (backend/deploy/runtime_env.yaml:4154, :5014). A recursive check of the entire manifest found no other declaration across either environment, GKE, jobs, gateway or desktop backend. The new source binding is backend/deploy/runtime_env/prod.overlay.yaml:914; the renderer pin expects both prod sweep hosts (backend/tests/unit/test_render_backend_runtime_env.py:1338).
  • I found no reachable finish-sweep path on prod backend or backend-sync-backfill under this head's declared configuration. Both have serving false (manifest :3481, :4416), empty worker audience and invoker (:3488, :4423), no recovery-task audience, and no pump opt-in. The startup guard returns without starting serving (backend/utils/batch_pipeline/serving.py:433); the pump defaults false (backend/config/policy/kill_switches.py:34). Batch /reconcile and /metrics require worker authentication (backend/routers/batch_pipeline.py:65, :86, :285, :291), whose verifier rejects an empty audience or invoker with 403 (backend/utils/cloud_tasks.py:706). Recovery/shadow routes use the separate recovery audience (router :71), also absent on those two hosts. Provider completion drains use the owner-only path (backend/routers/batch_provider_stt.py:68, backend/utils/batch_pipeline/serving.py:132), rather than the global finish sweep. Leaving backoff undeclared on these two services is consistent with the current configuration.
  • rollout remains consistent with config/feature-flags.yaml:281; the existing config classification still covers the key (config/deployment-setting-classification.json:110). No category or classification change was needed.
  • Compose --check passes. Running scripts/render_feature_flag_registry.py --as-of 2026-11-11 leaves the working tree unchanged, including backend/docs/feature-flag-registry.md:198. The registry document correctly has no additional delta when the second host adds the same value.
  • Exactly three files change in this delta: overlay, generated manifest and test pin (10 additions, 4 deletions). No other bindings, secrets, queues or lever maps change. git diff --check and the deployment secret-boundary check pass.

Independently reran both runtime-env test files on Python 3.11: 364 passed. Repository review only; no push, merge or production access. This verdict covers the reviewed configuration, not live rollout verification.

@Git-on-my-level
Git-on-my-level merged commit 8df57ef into main Nov 14, 2026
67 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/finish-backoff-integration-config branch November 14, 2026 18:15
Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
… (SCA-2283) (#25320)

## Why
`BATCH_PROJECTION_FINISH_BACKOFF_ENABLED` was turned off in production
at 19:41Z on 2026-11-14 (revision `backend-integration-provfix-off1114`)
by the SCA-2175 owner on its 5xx-doubling trigger, and the push captain
ruled that it stays off (SCA-2173, SCA-2222, SCA-2283). Main still
declares it `'true'` for prod backend-integration and backend-sync since
#25307, so the next deploy rendered from the repo would turn it back on.
This PR makes the repo say what production runs.

The flag saved nothing while it was on (17:11Z to 19:41Z): every finish
row on backend-integration is an async-policy row, and those are never
deferred. Finish rows read stayed at 63k to 69k per five minutes and
completions stayed at 0. The real fix is #25314 (SCA-2280).

## What changed
- `backend/deploy/runtime_env/prod.overlay.yaml`: the binding is
`'false'` (category rollout) for `backend-integration` and
`backend-sync`. It stays declared, not removed, so an operator value
cannot silently differ from the repo.
- `backend/deploy/runtime_env.yaml`,
`backend/docs/feature-flag-registry.md`: regenerated.
- `config/feature-flags.yaml`: the flag's record says terminal `off`,
with a dated note. Its ramp stays in the record because the registry
check requires one on a pending rollout row; the note says it is
suspended. Whether to remove the flag is decided after the #25314
readout.
- `backend/tests/unit/test_render_backend_runtime_env.py`: the pin moves
from `'true'` to `'false'` on those two services; absent everywhere
else, as before.

- `prod.overlay.yaml` `forbidden_env` for `backend` and
`backend-sync-backfill`: the flag is on the removal list. Both services
still serve a hand-set `true` from 2026-11-13 (read from the
traffic-receiving revisions at 20:26Z). Deploy merges env, so leaving
the key undeclared would keep it. Neither service runs the finish sweep,
so the value is inert there; this makes the repo and production agree.
The test pins the removal.

## What did not change
No code path. The code default was already off. No other environment. On
backend and backend-sync-backfill the only change is removing an inert
leftover.

## Tests
`tests/unit/test_render_backend_runtime_env.py` and
`tests/unit/test_backend_runtime_env_validator.py` pass; both generator
`--check` commands pass.

## Rollout
Rides Train 2 (cut-off 01:00Z on 2026-11-15). After it serves, the cost
owner reads the value back from the revisions receiving traffic on both
services. To turn it on again: set it `'true'` here; nothing else is
needed.

## Product invariants affected

- INV-MEM-4

Named because `backend/deploy/runtime_env.yaml` changes. This PR changes
one batch-projection binding and touches no memory intake,
consolidation, promotion or privacy TTL setting; INV-MEM-4 behaviour is
unchanged.

Failure-Class: FC-deploy-literal-reverts-operator-value

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit to Git-on-my-level/omi that referenced this pull request Nov 14, 2026
Production turned BATCH_PROJECTION_FINISH_BACKOFF_ENABLED off at 19:41Z on
2026-11-14 and the ruling is that it stays off (SCA-2283). Main still said
true since BasedHardware#25307, so the next rendered deploy would have turned it back on.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
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