Repository navigation
feat(backend): plan B B2 — role-image CI build+probe, train publish, per-service image opt-in - #22971
Conversation
… image opt-in Plan B B2 prerequisites (workflow change named by David on 2026-10-21). Nothing changes what any service deploys until a deploy passes service_images. - role_images.yml builds every backend/Dockerfile.roles target and the new listen-edge image (backend/edge/Dockerfile) on PRs that touch an image input and on every backend merge to main. It runs each role's offline dependency probe, an HTTP health/identity/drain probe for the edge, and records size and cold-start import time. No registry access. - gcp_backend.yml build-only gains build-role-images: the same build and probe on the private base at the admitted SHA (OMI_RELEASE_SHA stamped, revision label), push by short SHA, digests and a ready service_images value in the summary, fat-image baseline for comparison. - deploy-backend-stack takes service_images: per-service role digests for the Cloud Run four, listen and the stack gateway, validated (registry, role image, OMI_ROLE, revision label) before any mutation. Blank keeps today's image everywhere. The release-vector verifier expects each moved service at its digest; listen and gateway charts accept image.digest. - main.py, pusher/main.py, llm_gateway/main.py and utils/messaging/maintenance.py adopt omi_logging.configure_logging with default_format='text', which keeps today's split streams and textPayload filters; their pending logging-guard entries are removed, so the role images (no longer build_only) pass the guard. Runbook: backend/docs/runbooks/role-image-cutover.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…make and g++ Drop setup-buildx from build-role-images so docker build loads images for the probes, and give the edge builder cmake (bundled opus fallback) and g++ (static ONNX Runtime links libstdc++). 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. |
ort-sys downloads ONNX Runtime at build time through ureq/native-tls, which builds openssl-sys; the runtime stage needs no OpenSSL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8501aacb7b
ℹ️ 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".
| outputs["llm_gateway"] = gateway or f"gcr.io/{project}/llm-gateway:{short_sha}" | ||
| outputs["llm_gateway_repository"] = gateway.split("@")[0] if gateway else "" | ||
| outputs["llm_gateway_digest"] = gateway.split("@")[1] if gateway else "" | ||
| outputs["release_vector_args"] = " ".join(f"--service-image {s}={r}" for s, r in sorted(pairs.items())) |
There was a problem hiding this comment.
Exclude gateway overrides from backend release-vector args
When service_images includes the advertised llm-gateway opt-in, this output forwards it to every verify_backend_release_vector.py invocation, but that verifier explicitly accepts only the four Cloud Run services and backend-listen; it therefore exits with service images name unknown services: ['llm-gateway']. A development deploy with deploy_gateway=true consequently mutates the gateway and creates Cloud Run candidates, then deterministically fails before promotion. Either omit the gateway pair from these arguments or extend the verifier to evaluate it.
AGENTS.md reference: .github/AGENTS.md:L28-L30
Useful? React with 👍 / 👎.
| python3 .deploy-control/backend/scripts/role_images.py build \ | ||
| --sha "$ADMITTED_SHA" --registry "gcr.io/${PROJECT_ID}" --baseline --context . --manifest "$MANIFEST" |
There was a problem hiding this comment.
Preserve build-only support for older admitted SHAs
When mode=build-only is dispatched for any valid admitted ancestor from before this change, the runtime checkout does not contain backend/edge/Dockerfile, but the workflow-owned current role_images.py and registry unconditionally try to build listen-edge from it here. The admission logic explicitly permits any merged ancestor, so this new parallel job makes previously supported build-only runs finish red after the ordinary backend image may already have been pushed. Gate the role-image train on source support, constrain admission to compatible SHAs, or use role-image controls from the admitted source.
Useful? React with 👍 / 👎.
| pull_request: | ||
| paths: | ||
| - "backend/Dockerfile.roles" |
There was a problem hiding this comment.
Run role-image PR checks for copied backend sources
The PR trigger is limited to Dockerfiles, locks, registry/scripts, and edge files, even though every Python role target copies backend application source and probes imports from it. A PR that changes backend/main.py, llm_gateway/, pusher/, or another copied module without touching one of these listed paths skips both role-image builds and dependency probes; for example, a newly imported package missing from the role lock is discovered only after merge when the manual release train fails. Include the copied backend source surface (or derive an equivalent complete selector) in this trigger.
AGENTS.md reference: backend/AGENTS.md:L217-L217
Useful? React with 👍 / 👎.
- listen-edge probe expects the 12-char release_sha label the binary exports (sanitize_release_sha), and rejects a full-40 label. - llm-gateway opt-in leaves the Cloud Run/listen release vector; the gateway step proves its Deployment runs the opted-in digest after rollout. - role-image registry tags use 12 hex chars (no 7-char prefix collisions). - check-workflows ignores comment lines and accepts role_images.py verify. - build-role-images forecast at build-image's manual run rate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Grok review (FIX-FIRST at 8501aac): dispositionFixed in
Built-image evidence from this PR's first
The four app targets were one image's bytes (0.3–0.4 s per extra target). |
…er image input pusher/Dockerfile now copies backend/omi_logging.py, so the dev qualification path filter and the pusher source-closure tests include it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Plan B B2 prerequisites: role images become built, probed and published from one SHA, and each backend-stack service can take its role image by digest. Merging changes nothing any service deploys. Every deploy keeps shipping today's image until a dispatch passes
service_images.David named this workflow change on 2026-10-21 (two-lane lead session): role-image build job + per-service image inputs (plan B B2)
.github/workflows/role_images.yml.backend/Dockerfile.rolestarget (api,workers,realtime,gateway,pusher) and the newlisten-edgeimage (backend/edge/Dockerfile).backend/edge/**) and on every backend merge to main.runtime_image_contracts.py smoke --target). This closes B1's "no built-image probe ran" gap.listen-edgegets an HTTP probe:/healthzand/readyz, theomi_edge_build_info{release_sha}identity, and a clean SIGTERM drain.backendimage as a baseline.python:3.11-slimbase, because no PR workflow holds a GCP credential.deploy-backend-stack, plus thegcp_backend.ymldispatch inputservice_images.service=gcr.io/<project>/<role image>@sha256:<digest>pairs forbackend,backend-sync,backend-sync-backfill,backend-integration,backend-listen(needsdeploy_targets=all) andllm-gateway(needsdeploy_gateway=true).backend/scripts/resolve_service_images.pychecks that each ref is in this project's registry, is the role image the registry maps that service to, carriesOMI_ROLE=<role>, and is labelled with the admitted SHA.verify_backend_release_vector.py --service-imageexpects each moved service at its digest and records it in evidence. The default evidence schema is unchanged.image.digest, renderingrepo@digest.image.tagis still required and still set.backend/docs/runbooks/role-image-cutover.md.gcp_backend.ymlbuild-role-imagesinmode=build-only.listen-edgeon the private base at the admitted SHA, stamped withOMI_RELEASE_SHAand the revision label, and probes each one before publish.gcr.io/<project>/<image>:<sha7>. It refuses to overwrite a tag of another SHA and reuses a same-SHA tag.service_imagesvalue, and uploadsrole-images-<env>.json.main.py,pusher/main.py,llm_gateway/main.pyandutils/messaging/maintenance.pyadoptomi_logging.configure_logging(..., default_format='text'). Their five pending logging-guard entries are removed, and the role images (no longerbuild_only) now pass the guard.textPayload. Several live log metrics aretextPayload-only (messaging maintenance failures, daily summary extractors), so JSON is a per-serviceOMI_LOG_FORMAT=jsonstep after consumer admission (runbook updated).INFO:logger:msgtoINFO logger: msg;uvicorn.errorstartup lines move from stderr to stdout;lastResort, WARNING+ only);access_policy='keep').The listen-edge image is in this train for D2 (#22945). Its deploy still needs the GKE Deployment and Service, which is D2's deploy step.
Lane / contract
Swarm label
arch-b2(plan B B2, P8 brief). Owner sign-offs: none needed. B1's files (Dockerfile.roles,runtime_images.json, the contract script and its tests) are this lane's predecessor. The edge Dockerfile adds no crate changes.Product invariants affected
INV-DATA-1: path match only (
.github/workflows/gcp_backend.yml). No desktop-backend deployment authority or customer data-plane route changes; the backend stack keeps its projects and routing.Verification
All runs were on m5 (shared, high load), through
bin/omi-heavy run -- nice -n 19.backend/test.shon test_role_images, test_resolve_service_images, test_verify_backend_release_vector, test_omi_logging, test_logging_entrypoint_guard, test_runtime_image_contracts, test_backend_listen_helm_defaults (Helm render of digest mode)runtime_image_contracts.py checkcheck_logging_entrypoints.py --base origin/maincheck_ci_budget.py --base origin/mainrun_checks.py --lane localRole Imagesrun (public base)Not run locally: any docker build. m5 has no Docker daemon up, and B1's local amd64 build OOM'd. This PR's own
Role Imagesrun is the first built-image probe. The private-base build and the publish path (build-role-images) first run on the lead's next build-only train.Rollback
Revert this PR. Blank
service_imagesalready ships today's images. A logging rollback isOMI_LOG_FORMAT=text(already the default) or a revert.Next steps (B3 cutover, lead-owned deploys; out of scope here)
gcp_llm_gateway.yml, and pusher throughgcp_backend_pusher.ymlwith dev-qualifiedpusher_image_digest. Each needs a role-digest input (backend-gateway, andbackend-pusherin the qualification flow) before its production cutover. In development the gateway can cut over now viaservice_images=llm-gateway=…withdeploy_gateway=true.deploy/messaging/maintenance-job.json/messaging_operations.pyat thebackend-workersdigest.service_images=backend-listen=…withdeploy_targets=all(development). The prod path is Cloud Run-only today, so listen prod goes viagcp_backend_listen_helm.yml, which needs the same digest input.backend→backend-api, and the other three →backend-workers.Failure-Class: none
🤖 Generated with Claude Code