Skip to content

fix(deploy): backfill worker takes its queues from the ops file (B4) - #22455

Merged
Git-on-my-level merged 1 commit into
integration/legacy-retirefrom
lr/07-backfill-queue
Oct 19, 2026
Merged

Git-on-my-level merged 1 commit into
integration/legacy-retirefrom
lr/07-backfill-queue

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Lane 7 (legacy-retire swarm), B4 follow-up: the backfill worker takes its queues from the ops file. Targets integration/legacy-retire. Ownership of sync-backfill-lifecycle/action.yml for this queue fix was confirmed by the lead; lane 10's C10 deletion edit to the same file merges after the soak.

Why

.github/actions/sync-backfill-lifecycle/action.yml hard-coded SYNC_BACKFILL_TASKS_QUEUE=sync-backfill (also appended to backend-sync's env) and the worker's SYNC_TASKS_QUEUE=sync-backfill. Every prod train therefore re-pointed backfill at the queue retired after the 10-19 04:52Z Cloud Tasks stall, and the lead re-applied the fix by hand (post_train_queue.sh).

What

  • New ops-queues step (worker mode): in prod it reads both values from backend/deploy/ops/prod.yaml with ops_train.py render-env from the reviewed deploy-control source, and fails closed if either is missing. Dev keeps sync-backfill.
  • The step's outputs feed SYNC_BACKFILL_TASKS_QUEUE (backfill and backend-sync) and the worker's SYNC_TASKS_QUEUE.
  • The old sync-backfill queue reconcile is unchanged (legacy dark keeps the legacy queues untouched; lane 10 owns their deletion).

Failure-Class: none

Product invariants affected

Verification

  • test_config_train.py::test_train_takes_backfill_queues_from_the_ops_file runs the step's real bash for based-hardware (→ sync-backfill-fresh for both) and based-hardware-dev (→ sync-backfill).
  • pytest test_config_train.py test_sync_two_lane.py test_cloud_run_live_caps.py test_cloud_run_forbidden_env_deploy.py test_cloud_run_service_identity.py: 150 passed; test_backend_runtime_env_validator.py test_auto_dev_backend_scope.py test_fleet_deployment.py test_scheduler_reconcile.py test_render_backend_runtime_env.py test_plan_quota_env_retirement.py: 289 passed.
  • check-deployment-concurrency.py, check-release-process-guards.py, check-direct-backend-production-admission.py, actionlint: OK.

Rollback

Revert this PR; trains then write sync-backfill again and the ops-file config-train re-points after each train.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

sync-backfill-lifecycle hard-coded SYNC_TASKS_QUEUE / SYNC_BACKFILL_TASKS_QUEUE
=sync-backfill, so every prod train re-pointed backend-sync-backfill (and
backend-sync's SYNC_BACKFILL_TASKS_QUEUE) at the queue retired after the
10-19 04:52Z stall; post_train_queue.sh re-applied the fix by hand. In prod the
worker now reads both values from backend/deploy/ops/prod.yaml through
ops_train.py render-env in the reviewed deploy-control source, failing closed
if they are missing. Dev keeps sync-backfill.

Failure-Class: none

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

chatgpt-codex-connector Bot commented Oct 19, 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-19T08:48:52.863690Z 63558f7 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63558f701c

ℹ️ 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".

Comment on lines +104 to +105
ops_env="$(python3 "$DEPLOY_CONTROL_SCRIPT_DIR/ops_train.py" render-env --env prod \
--service '${{ inputs.service }}-sync-backfill')"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require config-train application before consuming queues

When a production ops PR changes a queue name, render-env returns the desired YAML value even if the manually dispatched config-train has not applied it yet; the shared prod-train lock only serializes runs and does not guarantee that an apply occurred first. This value is subsequently deployed into both backend-sync-backfill and backend-sync, so a normal backend promotion can begin sending backfill jobs to a queue that has not been created or reconciled. Verify that the ops file matches live state (or require an applied ops revision/hash) before consuming these values.

AGENTS.md reference: .github/AGENTS.md:L19-L21

Useful? React with 👍 / 👎.

{
echo "sync_backfill_env_vars<<EOF"
echo "SYNC_BACKFILL_TASKS_QUEUE=sync-backfill"
echo "SYNC_BACKFILL_TASKS_QUEUE=${BACKFILL_QUEUE}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Align runtime validation with the ops-owned queues

In production this output now sets backend-sync's SYNC_BACKFILL_TASKS_QUEUE to sync-backfill-fresh, while backend/deploy/runtime_env.yaml still declares sync-backfill (and likewise declares the worker's SYNC_TASKS_QUEUE as sync-backfill). The same deployment later runs validate-backend-runtime-env.py --check-live-cloud-run, whose literal-value comparison reads the newly created no-traffic service templates, so it reports these queue values as mismatches and exits before traffic promotion. Source these expected values from the ops file or exempt the ops-owned keys from that validation.

Useful? React with 👍 / 👎.

DEPLOY_CONTROL_SCRIPT_DIR="${DEPLOY_CONTROL_SCRIPTS:-backend/scripts}"
ops_env="$(python3 "$DEPLOY_CONTROL_SCRIPT_DIR/ops_train.py" render-env --env prod \
--service '${{ inputs.service }}-sync-backfill')"
backfill_queue="$(sed -n 's/^SYNC_BACKFILL_TASKS_QUEUE=//p' <<<"$ops_env")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Read backend-sync's queue from its own ops entry

The value assigned to backfill_queue is read from the backend-sync-backfill service entry, but it is later emitted into the backend-sync deployment. The ops schema declares these services independently and does not require their SYNC_BACKFILL_TASKS_QUEUE values to match, so a staged queue migration or an admission-only repoint will be overwritten with the worker's value, potentially routing new uploads back to the queue being drained. Render ${{ inputs.service }}-sync separately for the admission queue while retaining the worker entry for the worker overlay.

Useful? React with 👍 / 👎.

ENV_OVERLAY: |-
${{ inputs.backfill_env_vars }}
SYNC_TASKS_QUEUE=sync-backfill
SYNC_TASKS_QUEUE=${{ steps.ops-queues.outputs.worker_queue }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reconcile capacity on the selected backfill queue

Once production resolves SYNC_TASKS_QUEUE to sync-backfill-fresh, the later platform/dispatch invocation still updates the hard-coded sync-backfill queue rather than the selected queue. Consequently the active fresh queue remains at the ops-file concurrency of 90 even when the Redis-owned worker cap falls to 8 instances, whose concurrency-6 capacity is only 48; the action's own comments document that this over-dispatch causes Cloud Run rejections and exponential-backoff delays lasting hours. Pass the resolved queue into the reconciliation step and apply the computed max_scale * 6 limit there.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit ec45854 into integration/legacy-retire Oct 19, 2026
25 checks passed
@Git-on-my-level
Git-on-my-level deleted the lr/07-backfill-queue branch October 19, 2026 10:04
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
 sync)

Conflict in .github/actions/sync-backfill-lifecycle/action.yml: main's #22460 and lane 7's B4
(#22455) both stop trains re-pointing backfill at the retired sync-backfill queue. Resolved to
one resolution step (ops-queues): prod reads the ops file (fail-closed, lane 7); other projects
take the manifest's SYNC_BACKFILL_TASKS_QUEUE/SYNC_TASKS_QUEUE (main), sync-backfill only as
default. The queue reconcile step keeps main's manifest-driven queue name. #22460's test is
adapted to the single resolution step.
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
## 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)
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