Repository navigation
feat(deploy): build-only mode in gcp_backend.yml for listen-only rollouts - #22758
Merged
Merged
Conversation
…rollouts gcp_backend_listen_helm.yml deploys an explicit image_tag only when backend:<sha7> already exists, and only gcp_backend.yml mode=deploy built it, so a listen-only fix forced a full backend train. mode=build-only reuses the deploy path's boundary validation, Release Eligibility admission, and break-glass audit jobs, runs in the same Environment (prod approval + prod WIF for the prod registry), then builds, smokes, and pushes only backend:<sha7> and records its digest. It has no Cloud Run, GKE, traffic, or runtime env step, never moves :latest, and never re-pushes an existing <sha7> tag. Deploy and repair-traffic-only jobs are unchanged; the source-admission checker now also pins the build-only job's condition, admitted checkout, and forbidden surfaces. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups for the build-only image job: - treat only gcloud's exact not-found diagnostic for the image as a free tag; every other describe failure fails closed - read the shared buildcache without writing it, so no mutable tag moves - label new images with the admitted revision and refuse an existing tag labelled with a different SHA - compare the registry digest against all RepoDigests without a pipe that can SIGPIPE under pipefail - add !cancelled() so a cancelled run cannot start the push - checker pins smoke-before-push, the HEAD == admitted check, one root checkout, and forbids cache-to and alert helpers Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read the existing tag's revision label without swallowing inspect errors, check out full history so the short tag disambiguates like the listen workflow, and count path: . checkouts as root in the admission checker. 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. |
…n the wall clock Five direct-delivery budget-expiry tests set a 0.05s real handler budget and count get_sync_job reads (1 queued, 2 processing, 3+ completed) to stage a terminal transition the expiry recovery should observe. With the passthrough run_blocking, the first real suspension before the pipeline is the shielded run-lock acquire; on a loaded runner the 50ms has already elapsed there, so the cancellation lands before read 2, the recovery read sees 'processing', and the handler takes the preserved-lock deferral (409) instead of the terminal branch. Reproduced locally with a 60ms stall in read 1. The tests now keep the module's default budget and capture the attempt's budget timeout through a delegating asyncio proxy on the module; the pipeline stub reschedules it to now, so the expiry always lands inside the pipeline. Test-only; production code is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Oct 20, 2026
#22758 moved five direct-delivery budget tests off a 0.05s real handler budget. test_terminal_cleanup_deferral_inherits_the_recovery_deadline still used it, and it stages its outcome by counting job reads (read 4 is the terminal one). An 80ms stall in the attempt's job read lets the budget expire before the pipeline runs. The recovery then never reaches its terminal read and the replacement enqueue is never called. Reproduced locally with that stall; with this change the test passes with the stall on reads 1-3. It now uses #22758's _pipeline_expiring_the_handler_budget, which keeps the production budget and expires it inside the pipeline stub. The inherited recovery deadline (now + the 0.2s cleanup timeout) is unchanged. The same class, in the opposite direction: two tests require healthy work to finish inside a tiny real budget. Parakeet pressure used a 20ms per-request timeout and daily summary a 50ms per-user budget. Both now use 0.5s; the hung or blocked case still times out. The other 0.05s handler-budget tests in test_sync_cloud_tasks.py stage only queued and processing reads, so where the expiry lands does not change their branch. They are left as they are; that file goes away with the legacy deletion (lane 10). Test-only; production code is unchanged. Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 20, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Oct 20, 2026
* test(backend): ratchet tiny real-clock budgets in tests Three times on 2026-10-20 a backend unit test that shrank a production budget to tens of milliseconds raced a loaded CI runner (#22758, #22767, and the legacy-retire change C10). Add a static AST ratchet over backend/tests/**/*.py that flags budget/deadline/timeout names set to a literal in (0, 0.5) s via attribute assignment, setattr/patch.object/ patch, setenv/os.environ/patch.dict, or keyword arguments to code under test. Harness waits (wait_for, Event.wait, get, join, ...), mock call assertions, and functions that control the clock are excluded. The 100 current offenders are allowlisted with a blame owner and #22767; the test fails on new offenders and on stale entries so the list only shrinks. It is a codebase scan, so it is marked slow and listed in tests/slow_guardrail_manifest.txt (~0.45 s). Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): close real-clock ratchet gaps from review Grok review (FIX-FIRST) found four gaps: - `'monotonic': time.monotonic` counted as a fake clock and exempted six real-clock ack-budget tests in test_listen_pusher_session.py. Only a clock replaced by something other than time.* / None counts now, and decorators are part of the inspected source. The six sites are grandfathered (106 entries). - patch.object(obj, 'NAME', new=v) was not read. - The byte prefilter missed parenthesized, ' +0.05', and 1_0e-2 values. It is possessive now so whitespace runs cannot backtrack. - patch.dict('os.environ', ...), patch.dict(..., NAME='0.05') and values={...} were not read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): real clock passed via new= or parens is not a fake clock Grok r2: the optional `new=` introducer could be skipped so the lookahead tested `new`, and `(time.monotonic)` slipped past it, so `patch.object(obj, 'monotonic', new=time.monotonic)` still exempted the function. Introducers (`new=`/`value=`, parentheses, whitespace) are now consumed possessively and also rejected by the lookahead. Self-tests cover both real-clock spellings and a fake `new=` clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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)
ZhaZhaBei
pushed a commit
to ZhaZhaBei/omi
that referenced
this pull request
Oct 22, 2026
Conflict: .github/ci-budget.yaml (main BasedHardware#22758 build-only mode vs B5 break_glass_lock). Main's if conditions and estimates are kept, and each rationale also notes B5. deploy, firestore_readiness and validate-production-boundary go to 1.1 runs/day (build-only dispatches on top of trains), so the budget check passes against integration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gcp_backend_listen_helm.ymldeploys an explicitimage_tagonly whengcr.io/<project>/backend:<sha7>already exists. Until now onlygcp_backend.yml mode=deploybuilt that image, and it also rolls every Cloud Run service. So a listen-only fix forced a full backend train, sometimes during a record-lane ramp hold.This adds
mode=build-onlytogcp_backend.yml. David named this.githubedit on 2026-10-20.validate-production-boundary,firestore_readiness(exact-SHA Release Eligibility proof, main ancestry, Firestore readiness) andrecord_break_glassnow also run forbuild-only. The newbuild-imagejob uses the deploy job's exactneedsand success/audit predicate, with only the mode changed.build-imageruns in the same GitHub Environment as deploy (prod→ required reviewers plus the prod WIF binding that pushes to the prod registry). The repo's prod WIF is environment-bound, so a no-approval push path would also weaken the registry boundary.runtime_image_contracts.py smoke) anddocker pushes onlybackend:<sha7>. It records the registry digest (and checks it against the pushed RepoDigest) in the job output and run summary, and prints the follow-up listen dispatch. It has no Cloud Run, GKE, Helm, traffic, runtime-env or alert-policy step. It never pushes:latestand never writes:buildcache(it only reads the cache). New images carryorg.opencontainers.image.revision=<admitted SHA>. The job's condition adds!cancelled(), so a cancelled run cannot start a push.<sha7>already exists, the job records that digest and does not rebuild or re-push. This stops GKE pods that pull by tag from getting a different digest. Only gcloud's exact[<image>] is not found or is not a valid namediagnostic counts as "free" (verified against the real registry with a read-only describe). Any otherdescribeerror fails closed. An existing tag whose revision label names a different SHA fails the job.build-onlyrejectsdeploy_gateway=true, because it builds only the backend image.deploy,repair-trafficandrecord_break_glassjobs are byte-identical. The only deploy-mode changes are the widenedif:on the two shared jobs and one newbuild-only-only boundary rejection.Workflow-level concurrency stays
deploy-backend-stack-<env>, so a build-only run serializes with backend deploys in the same environment.Matching contract/test updates (required by repo checks)
.github/scripts/check_backend_deploy_source_admission.pynow pins the widened admission condition. It also pins the build-only job's exact condition,needs, Environment and single admitted-SHA checkout, and that it smokes before pushing. It rejects any serving-surface fragment in the job (deploy-backend-stack,gcloud run, GKE credentials,kubectl, Helm mutations, traffic, env updates,:latest,push: true) and any rawrelease_shause.It also requires smoke to come before the single
docker push, a HEAD == admitted-SHA check, exactly one root checkout and!cancelled(), and forbidscache-to:andensure_*alert helpers..github/scripts/test_check_backend_deploy_source_admission.py: mutation tests for the above..github/ci-budget.yaml: refreshed inventory, with explicit manual-dispatch run estimates and rationale, because the checker treats any new dispatch input as a trigger change.backend/docs/runbooks/prod_hotfix_runbook.mdx: mode table plus a "Listen-only fixes (mode: build-only)" section. The workflow header documents all three modes.Not changed on purpose
The break-glass audit issue keeps its "Backend deploy ran without a Release Eligibility proof" wording, even for a build-only dispatch. Changing that text would change deploy-mode behaviour, which this PR keeps byte-identical. The issue's run link identifies the mode.
Product invariants affected
Failure class (fixes)
Failure-Class: none
The
fix(deploy):commit applies review follow-ups to the new, unshipped build-only job in this same PR; no shipped behaviour failed.Verification
actionlint .github/workflows/gcp_backend.yml: clean.python3 .github/scripts/run_checks.py --lane local --base origin/main --changed-files <diff>: 30/30 manifest checks pass, including backend-deploy-source-admission(+fixtures), gcp-backend-production-boundary(+fixtures), backend-runtime-image-source-closure, backend-workflow-contracts, deployment-secret-boundary, ci-budget(+fixtures).check-deployment-concurrency.py,check_release_rings.pyand its tests, andvalidate-backend-runtime-env.py --env prod --check-workflows: pass.test_workflow_contracts,test_runtime_image_contracts,test_verify_backend_release_vector,test_render_backend_runtime_env,test_llm_gateway_deploy_contract,test_backend_runtime_env_validator, and others): 497 passed.Dispatch after merge (prod example):
🤖 Generated with Claude Code