Repository navigation
feat(deploy): one owner for the prod backfill queue; summary-debt repair on integration (B4) - #22480
Conversation
…air on integration - The train's backfill queue reconcile no longer touches prod: the ops file's cloud_tasks spec, applied by the config-train, is the only writer of the live queue's name and rates. Non-prod keeps the manifest-or-default reconcile. - Guard test: every prod env key declared in both the manifest and the ops file carries the same value, until trains apply ops env directly. - Ops file: SUMMARY_DEBT_REPAIR_ENABLED=true on backend-integration(-staging) for lane 9's C4 enrichment-maintenance tick. 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6361251728
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [[ '${{ inputs.project_id }}' == 'based-hardware' ]]; then | ||
| echo "prod backfill queue is owned by the ops file and config-train; train does not reconcile it" | ||
| exit 0 |
There was a problem hiding this comment.
Preserve capacity bounding for the production queue
When redis_guard lowers the production worker below 15 instances, this exit discards the max_concurrent_dispatches value already computed from the live service cap. The ops spec leaves the queue at 90 dispatches while allowing the worker to fall to 8 instances with concurrency 6, so the queue can offer 90 requests to as few as 48 slots; the comments immediately below document that this produces Cloud Run rejections and long retry delays. Keep the single production owner, but have it derive the queue ceiling from the controller-owned live cap, or statically cap the queue at the floor capacity.
Useful? React with 👍 / 👎.
First staging plan (M2 dry run, dev-operator, read-only) surfaced two issues: - template_drift treated an unnamed template container (#0) as a different container from the one Cloud Run names on the revision (backend-1), blocking every env change on backend-integration-staging. Unnamed containers now pair by position; differently named containers still block. - staging.yaml carried prod's replica counts; contract (i) allowlists replica counts and lane 2's deploy.sh sizes staging (backend-sync-staging max 20, no service min). staging.yaml now matches; the mirror test compares env only. Re-plan: the only difference is SUMMARY_DEBT_REPAIR_ENABLED on backend-integration-staging, the value #22480 declared and that waits for C4. Failure-Class: none Co-authored-by: Claude Opus 5.5 <[email protected]>
## Summary M3: land the legacy-sync retirement integration branch (`integration/legacy-retire`, swarm plan `omi-knowledge-base/projects/backend-target-architecture/swarm-plan.md`, contracts in `contracts.md`) on main. **Merge with `--merge` (never squash)**; the lead runs the train from the main merge SHA. **Prod behaviour after this merge:** prod `legacy_sync` stays `on`. Every new legacy-retirement path is gated: the ramp document, default-off flags or kill switches, and the `DRAINING_PRECONDITIONS` that `ramp_set` enforces before leaving `on`. With the mode `on`, intake, sync and enrichment keep today's routes. ## M3 gates (lead ruling 6702cc; David authorized the merge, 10-21) 1. **Prep landed:** - #23068: main b859b78, the ci-budget bump and the dead-code stub removal; - review fixes #23082 and #23086; - final main merges #23096 (main 34ce402) and #23133 (main 5406315). 2. **Staging tree equality:** `OMI_RELEASE_TREE` on all four `*-staging` services equals `integration/legacy-retire^{tree}` at this head (see the evidence section below). 3. **M2 review (GLM, which replaced Grok; ruling 43bd53):** - CHANGES: 1 P1, fixed in #23082 (provider-STT outbox sweep plus draining gates). - The 2 P2s are recorded below. - The M1 blocker closure table is in `data/run-2026-10-19-legacy-retire/review/M3/m1-blocker-closure.md` (omi-workspace). 4. **Workflows:** all green on this head. 5. **Luna:** - Round 1: CHANGES, 2 majors, fixed in #23082. - Round 2: 4 majors. Two lock fixes are in #23086 (Luna SHIP); two were routed to dark-step gates. - Final-merge resolution: SHIP. ## Dark-step gates and follow-ups (none block M3; prod stays `on`) - **`provider_stt_live`** (`DRAINING_PRECONDITIONS`): before leaving `on`, prod needs: - the provider-stt queue; - the `PROVIDER_STT_TASKS_*` env; - the maintenance job; - pagination or a due-cursor for the provider-STT outbox sweep (Luna round 2 #4). - **`legacy_final_pass_rehomed`** (`DRAINING_PRECONDITIONS`, lead ruling b209a5): conversations still owned by `legacy_final_pass_v1` with no live legacy job must be re-homed to batch first, and new final-pass ownership must stop outside `on` (Luna round 2 #3). The final-pass-rehome lane owns this. - **GLM P2s:** - the router's stranded-row 409 loop without `batch_adopts_stranded` is lane 10 debt; - BYOK uploads route to batch even with legacy sync `on` (David, 10-19). This is a release-note item. ## `.github` changes in this PR and David's naming Source of the naming: swarm-plan.md, lane 7: "B4 and B5 are named .github changes (fourth round, #9)" (2026-10-19); the checkout-stall bound (2026-10-20, main 1b07e5e); #22758 build-only mode; lead ruling 209335 (David named B7 and B8 items, 2026-10-21 ~06:05Z). | File | Change | Named item | | --- | --- | --- | | `.github/workflows/config_train.yml` (new) | Config-train: plan/apply of `backend/deploy/ops`, manual dispatch, prod-train lock; workflow-level `GIT_HTTP_LOW_SPEED_*` | B4 (+ checkout-stall bound for the two env lines) | | `.github/actions/sync-backfill-lifecycle/action.yml` | Prod backfill queue names come from the ops file; the train no longer reconciles the prod queue (#22455, #22480) | B4 | | `.github/workflows/gcp_backend.yml` | `break_glass_lock` input; prod concurrency group `prod-train` | B5 | | `.github/workflows/gcp_backend_listen_helm.yml` | same | B5 | | `.github/workflows/gcp_backend_pusher.yml` | same | B5 | | `.github/workflows/gcp_parakeet.yml` | same | B5 | | `.github/workflows/gcp_llm_gateway.yml` | same (every prod deploy writer shares the lock) | B5 | | `.github/workflows/gcp_diarizer.yml` | B5 lock lines **plus** B7: OCI revision/`omi.release.tree` image labels and a batch-worker `image_digest` promotion path (verified by `check_release_tree.py`) | B5; B7 (David, ruling 209335) | | `.github/scripts/check-deployment-concurrency.py` | Guard that evaluates the new prod-train group expressions | B5 | | `.github/ci-budget.yaml` | config-train entry (B4); 1 run/day on the six deploy workflows with `break_glass_lock` (B5); 1.1/day on three build-only jobs (sync 11, #22758 base) | B4, B5, #22758 | | `.github/checks-manifest.yaml` | Registers `backend/scripts/check_release_tree.py` (the B7 promotion gate) | B7 (David, ruling 209335) | | `.github/scripts/check_duplicate_routes.py` | Counts routers mounted through `app_roles.mount_routers` (B8 OMI_ROLE map) as mounted | B8 (David, ruling 209335) | | `.github/scripts/test_pre_push_ci_verified.py` | Test hygiene: `clean_env` also pops `PRE_PUSH_BASE_BRANCH` and `OMI_PR_BODY_FILE`, so lane pushes with a non-main base do not leak into the hermetic hook runs | lead authority, ruling 66dba9 (edits an existing test script; no workflow added) | | `.github/scripts/dead_code/backend.allowlist.json` | The 7 swarm contract-stub entries are removed (L01-4); every file now has importers | allowlist hygiene (CI script data) | | `.github/workflows/sync_ledger_fence_cutover.yml` | Prod takes the `prod-train` lock, with a `break_glass_lock` input that falls back to the backend stack lock (M3 Luna review) | B5, completing it on a file that must share the backend mutation domain (lead ruling 5f60b3) | | `.github/workflows/config_train.yml` (break-glass fallback) | Break-glass shares `deploy-backend-stack-<env>` with `gcp_backend.yml` (M3 Luna review) | B4/B5 (lead ruling 5f60b3) | ## Staging tree evidence Verified 23:33-23:4xZ 10-21, on tier ro-dev: - **Services:** all four `*-staging` services (`backend-staging`, `backend-sync-staging`, `backend-sync-backfill-staging`, `backend-integration-staging`) serve `8d062ad3cfacf8b7eb26dea737a2969423548e64` at 100%. - **Tree:** `OMI_RELEASE_TREE=5c398832bc4487066abbf2d49bcf8c6f9a700818` == `8d062ad3^{tree}`. - **Image:** `us-central1-docker.pkg.dev/based-hardware-dev/staging/backend@sha256:18b8cf414566743aaee20bd2559695ec7b4536a75ec609fbc139f008bbf7ecf9`. - **Batch worker:** `sha256:0954c71c87f5`, 0 replicas. Staging is plain (no warm instances or overrides). - **Deploy log:** `data/run-2026-10-19-legacy-retire/lane01/m3/deploy-final2.log` (omi-workspace). ## Product invariants affected INV-DATA-1: integration carries lane 7's (#22430) edits to `.github/workflows/gcp_*.yml`. They add the `prod-train` concurrency/lock lines (B5) and, in `gcp_diarizer.yml`, the worker-digest promotion. No Firebase or Firestore project, auth authority or serving endpoint changes. Production-family artifacts stay on `based-hardware`. ## Line-count exceptions Line-Count-Exception: backend/routers/sync.py | 3881 -> 3966 | lane 10 legacy-dark fence wiring at the legacy call sites (#22495) plus the M3 review fixes (off-loop mode read, final-pass ACK); the file shrinks with the C6/C11 deletions Line-Count-Exception: backend/database/firestore_index_registry.py | 2196 -> 2200 | the legacy-dark zero-lost census index (sync_content_ledger created_at, lost_recordings.py soak check 5) ## Failure class Integration carries fix commits, and each declares its own class. For this merge: Failure-Class: none UI-Evidence: none -- backend/CI retirement work plus sync merges; the UI changes are main PRs that carried their own evidence 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lane 7 (legacy-retire swarm), B4: one owner for the prod backfill queue, plus summary-debt repair on backend-integration. Targets
integration/legacy-retire.Review of lane 1's sync-backfill-lifecycle conflict resolution (#22455 × main #22460)
The resolved
ops-queuesstep is correct:deploy/ops/prod.yamlviaops_train.py render-envand fails closed;sync-backfill;ENV_OVERLAYthe ops/manifestSYNC_TASKS_QUEUEcomes afterinputs.backfill_env_vars, so it wins;The remaining second source is the dispatch/platform reconcile step. It still wrote the prod queue's rates from the manifest name, while the ops file and config-train declare those rates. The two would fight once the ops values move (G3: 90/15 → 60/10, or redis_guard caps).
What
sync-backfill-lifecycle: in prod the train's backfill queue reconcile now exits without touching the queue. The ops file'scloud_tasks.sync-backfill-freshspec, applied by the config-train, is the only writer of the live queue's name and rates. Non-prod keeps the manifest-or-default reconcile.test_manifest_queue_values_agree_with_the_ops_file: every prod env key declared in both the manifest (fix(deploy): trains stop reverting the recovery queue and the fresh queue re-points #22460) and the ops file must carry the same value, until trains apply ops env directly (next B4 slice: the train appendsrender-envoutput and the queue keys leave the overlay).deploy/ops/{prod,staging}.yaml:SUMMARY_DEBT_REPAIR_ENABLED='true'on backend-integration(-staging). Lane 9's C4 moves summary-debt repair to the enrichment-maintenance Scheduler job targeting backend-integration, and the manifest enables the flag on backend-sync only.Apply timing (lead): the prod value takes effect only on a config-train apply. Until C4's Scheduler job exists, enabling it on integration adds no trigger. If backend-sync's sweep and integration's tick could both run repair, apply this only when C4 retires the backend-sync path.
Failure-Class: none
Product invariants affected
Verification
test.shontest_config_train.py(42 passed),test_cloud_run_live_caps.py,test_sync_two_lane.py: pass. The new prod-reconcile test runs the step's real bash with a recordinggcloudand asserts zero calls.ops_train.py validate: ok. actionlint and the deployment-concurrency policy: OK.Rollback
Revert this PR.
🤖 Generated with Claude Code