Skip to content

feat(backend): plan B B3 — role-image digest inputs for the standalone gateway and pusher deploys, workers digest for the maintenance job - #23090

Merged
Git-on-my-level merged 5 commits into
mainfrom
lane/p41-b3
Oct 22, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
lane/p41-b3

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

The code half of the plan B B3 role-image cutover (backend/docs/runbooks/role-image-cutover.md, plan B §9f.4). Merging changes nothing any service deploys: every new input defaults blank, the fat builds stay the default path, and no deploy, publish run or registry write happens here. The cutover trains (first build-only publish, then gateway → pusher → maintenance job) stay with the lead.

  1. gcp_llm_gateway.yml input gateway_image_digest (blank = build and ship llm-gateway:<sha7> exactly as today). With a backend-gateway digest from a build-only run of the admitted SHA, the run skips its own build, deploys gcr.io/<project>/backend-gateway@<digest> through the already-digest-aware deploy-llm-gateway.sh (image.repository + image.digest, B2), proves the rolled-out Deployment template runs that exact reference, and runs the Cloud Run VPC probe and the smoke pod from the same image.
  2. gcp_backend_pusher.yml input pusher_role_image_digest (development only; production rejects it). A backend-pusher digest skips the fat build and deploys through the unchanged live-capacity gate, Helm release and receipts. The production qualification flow now admits backend-pusher: verify_pusher_promotion_evidence.py --expected-repository takes the comma-separated pair gcr.io/based-hardware-dev/pusher,gcr.io/based-hardware-dev/backend-pusher, the receipt must name the repository the evidence qualified, and the promotion keeps that repository name (gcr.io/based-hardware/backend-pusher@<digest>).
  3. New backend/scripts/admit_role_image.py: single-service admission for the standalone deploys. The repository is never caller-supplied; it is derived from runtime_images.json (services.<name>.image), and the digest must be sha256:<64 hex>, labelled org.opencontainers.image.revision=<deployed SHA> and carry that role's OMI_ROLE — the same properties resolve_service_images.py enforces for the stack train. Anything else fails before any mutation.
  4. messaging_operations.py desired_job admits exactly gcr.io/based-hardware/backend@sha256:… (today) or gcr.io/based-hardware/backend-workers@sha256:… instead of any based-hardware repository; maintenance-job.json is unchanged (the image is still substituted at reconcile time).
  5. Runbook B3 checklist now carries the verified dispatch inputs, the maintenance-job commands, and the one remaining pusher step (below).

.github naming — recorded

David named the B2 build-job change on 2026-10-21 ("do it", briefs/p8-arch-b2-ci.md). He named these deploy-workflow input edits on 2026-10-22 ~02:20Z: "You can do those workflow PRs and merge them" (recorded in the P49 lead brief, 10-22 02:25Z, for both this PR and #23100). Merge authorization is complete; the lead executes the merge after TRAIN Q DONE (Cloud Run → listen → pusher) per the P49 plan.

Workflow Edit Why it is needed
.github/workflows/gcp_llm_gateway.yml New workflow_dispatch input gateway_image_digest (default ''); new step "Admit role-image digest opt-in" (runs backend/scripts/admit_role_image.py --service llm-gateway); "Build and Push Docker image" gated on the input being blank; deploy step passes IMAGE_REPOSITORY/IMAGE_DIGEST to deploy-llm-gateway.sh and verifies the Deployment template image; probe and smoke --image fall back to the role reference Production gateway ships only through this workflow, which still builds its own llm-gateway image; the B3 cutover (gateway first) cannot deploy the published backend-gateway digest without an input that admits it
.github/workflows/gcp_backend_pusher.yml New workflow_dispatch input pusher_role_image_digest (default '', development only, rejected for prod in "Validate Environment Input"); new step "Admit role-image digest opt-in" (--service pusher --prefix PUSHER_IMAGE); fat build and "Resolve immutable development Pusher image" gated on the input being blank; the prod qualification step reads the evidence's repository, requires it to be pusher or backend-pusher, passes the allowlist to the verifier and promotes under the same repository name Pusher is second in the ruled cutover order; its prod path only deploys dev-qualified digests, so the qualification flow must accept the backend-pusher image, and development needs a way to run the role image before that

Note: both pusher workflows and verify_pusher_promotion_evidence.py are promotion-contract files (CONTRACT_FILES), so this PR changes contract_fingerprint(): dev qualification runs older than the merge stop promoting. Merging also triggers gcp_backend_pusher_auto_deploy.yml (development) because gcp_backend_pusher.yml is in its path filter; that run produces the fresh qualification. Either effect is development-only.

Still needed before the production pusher cutover (not in this PR)

Qualification evidence is produced only by gcp_backend_pusher_auto_deploy.yml, which builds the fat pusher image. For a backend-pusher digest to be promotable, that workflow has to deploy backend-pusher — another .github change for David to name — then one green run on the cutover SHA supplies pusher_image_digest + pusher_dev_qualification_run_id. The gateway and maintenance-job cutovers need nothing beyond this PR plus the lead's build-only publish run.

Product invariants affected

  • INV-DATA-1

Both workflows keep their production routing authorities untouched: environments, projects, WIF providers, registries and service names are unchanged; the new inputs only select which already-published image of the same project and admitted SHA a deploy runs, and a blank input is today's behaviour.

Review (GLM family, infra/rollout/bin/review.sh, rounds 1–2)

Round 1 (full, head 0dfe7ea3e6): SHIP — no P0/P1; 2 P2, 3 minor. Round 2 (delta, head 6ade66c99f): SHIP. Verdicts and full findings: /Volumes/Ephemeral/scratch/two-lane-lead/review-23090-r1.md / -r2.md (lane-local).

  • P2 stale runbook line (messaging-channels.md offered the Artifact Registry digest form desired_job now rejects) — fixed in 6ade66c99f.
  • P2 "backend-pusher prod lane unreachable end-to-end" — by design and disclosed above: the auto-deploy workflow still qualifies the fat image; this PR makes the flow accept backend-pusher so the later named change can complete the cutover.
  • Minor: empty-image_repository case guard, KeyError on an incomplete registry entry, inline interpolation of the digest inputs — all fixed in 6ade66c99f (inputs now reach the shell through env:).
  • Open follow-up (round-2 P2, defense-in-depth, same trust boundary as the pre-existing break_glass_reason pattern): Validate Environment Input and the break-glass steps still interpolate free-text dispatch inputs into bash. A follow-up should convert every free-text input in these two workflows to env:-passing.

Verification

Layer Command Result
Unit (backend, backend/test.sh under omi-heavy, nice -n 19) run 1: test_admit_role_image.py, test_resolve_service_images.py, test_messaging_operations.py, test_verify_pusher_promotion_evidence.py, test_runtime_image_contracts.py; after the delta: test_admit_role_image.py, test_pusher_deployment_control_workflow.py, test_llm_gateway_deploy_contract.py, test_workflow_contracts.py, test_messaging_operations.py 184/184, then 188/188; 0 failed
Static contract backend/scripts/runtime_image_contracts.py check passed, 19 registered images (source closures, workflow smoke markers, role map)
Formatting black --check -l 120 --skip-string-normalization on the changed Python files clean
CI full PR matrix on 6ade66c99f: python role images ✓, listen-edge image ✓, Static Contracts ✓, Formatting ✓, Hygiene ✓, Backend unit shards 1–6 ✓, PR Metadata Preflight ✓, CodeQL ✓, Analyze ✓ 36 pass, 0 fail
Image size / cold start on the private base lead's first build-only publish run pending (not this lane)

Workflow wiring is asserted by test_admit_role_image.py (parses both YAMLs: blank defaults, step conditions, env-passed inputs, allowlist, empty-repository guard, promotion repository derivation). No deploy was run and no image was built or pushed from this lane.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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 ⚠️ Failed 2026-10-22T02:10:04.979852Z
We couldn’t complete this review. Comment @codex review to try again.
345e670 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.

@cursor cursor 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.

Agentic security review found two high-severity GitHub Actions script-injection issues in the new role-image digest inputs. Both interpolate free-text workflow_dispatch values into run: scripts with ${{ }} instead of binding them through env: the way pusher_image_digest already does.

Open in Web View Automation 

Sent by Cursor Security Agent: Security Reviewer

Comment thread .github/workflows/gcp_llm_gateway.yml Outdated
set -euo pipefail
python3 backend/scripts/admit_role_image.py \
--service llm-gateway \
--digest "${{ github.event.inputs.gateway_image_digest }}" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review
Severity: HIGH

gateway_image_digest is a free-text workflow_dispatch input interpolated with ${{ github.event.inputs.gateway_image_digest }} inside run:. GitHub expands expressions before bash quoting applies, so a value such as x"; <cmd>; echo " becomes extra shell on this step.

This step runs whenever the input is non-empty, after google-github-actions/auth (including prod WIF to omi-ci-deployer-prod) and gcloud auth configure-docker. admit_role_image.py never gets to enforce sha256:<64 hex> if the shell is already hijacked. The production Pusher digest path already avoids this by binding pusher_image_digest through env: and quoting the env var.

Impact: Anyone who can dispatch this workflow can run arbitrary commands with the deploy identity, including on an approved prod run.

Fix in Cursor Fix in Web

Reviewed by Cursor Security Reviewer for commit 0dfe7ea. Configure here.

echo "LLM Gateway deploys are dev-only until the prod launch checklist is explicitly completed."
exit 1
fi
if [[ -n "${{ github.event.inputs.pusher_role_image_digest }}" && ( "${{ env.SERVICE }}" != "pusher" || "${{ github.event.inputs.environment }}" != "development" ) ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Agentic Security Review
Severity: HIGH

pusher_role_image_digest is interpolated with ${{ }} inside run: on this first-step reject check, and again later as --digest "${{ github.event.inputs.pusher_role_image_digest }}" in Admit role-image digest opt-in. Expression expansion happens before bash parsing, so a crafted digest can close [[ / quotes and run commands.

The check is meant to reject this input unless service is pusher and environment is development, but injection occurs while evaluating that check. A prod dispatch that sets the field still executes here (id-token: write is already granted). Sibling input pusher_image_digest is already passed through env: REQUESTED_DIGEST and regex-checked.

Impact: A dispatcher can execute arbitrary runner commands, including on the production reject path, and on the development admit path after GCR login.

Fix in Cursor Fix in Web

Reviewed by Cursor Security Reviewer for commit 0dfe7ea. Configure here.

@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: 0dfe7ea3e6

ℹ️ 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 thread backend/scripts/messaging_operations.py Resolved
Comment thread .github/workflows/gcp_llm_gateway.yml Resolved
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…ository guard, registry errors, CI test string

Addresses GLM review round 1 of #23090 (SHIP, 2 P2, 3 minor) and the one
CI failure (Backend unit shard 1/6):

- `test_pusher_deployment_control_workflow.py` expects the pusher build step's
  new condition (development may skip the build for an admitted
  backend-pusher digest; production still never builds). The step comment
  moves above the step name so the assertion window still sees the `if:`.
- Both admission steps take the dispatch input through `env:`
  (`ROLE_IMAGE_DIGEST_INPUT`) instead of inline `${{ }}` interpolation, the
  pattern the pusher prod selection step already uses.
- The prod qualification step fails on an evidence file without
  `image_repository` before the allowlist `case`, which an empty value would
  otherwise have matched.
- `admit_role_image.py` raises `ServiceImageError` instead of `KeyError` for
  a registry service entry without `image`/`role`.
- `messaging-channels.md` no longer offers the Artifact Registry digest form
  that `desired_job` rejects; it names the two admitted repositories.

Not changed: the pusher production lane for backend-pusher stays unreachable
until `gcp_backend_pusher_auto_deploy.yml` qualifies that image (disclosed in
the runbook and PR body; a separate `.github` change for David to name).
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…ository guard, registry errors, CI test string

Addresses GLM review round 1 of #23090 (SHIP, 2 P2, 3 minor) and the one
CI failure (Backend unit shard 1/6):

- `test_pusher_deployment_control_workflow.py` expects the pusher build step's
  new condition (development may skip the build for an admitted
  backend-pusher digest; production still never builds). The step comment
  moves above the step name so the assertion window still sees the `if:`.
- Both admission steps take the dispatch input through `env:`
  (`ROLE_IMAGE_DIGEST_INPUT`) instead of inline `${{ }}` interpolation, the
  pattern the pusher prod selection step already uses.
- The prod qualification step fails on an evidence file without
  `image_repository` before the allowlist `case`, which an empty value would
  otherwise have matched.
- `admit_role_image.py` raises `ServiceImageError` instead of `KeyError` for
  a registry service entry without `image`/`role`.
- `messaging-channels.md` no longer offers the Artifact Registry digest form
  that `desired_job` rejects; it names the two admitted repositories.

Not changed: the pusher production lane for backend-pusher stays unreachable
until `gcp_backend_pusher_auto_deploy.yml` qualifies that image (disclosed in
the runbook and PR body; a separate `.github` change for David to name).
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…e, env-passed validation input, runbook admission

Addresses Codex round 1 of #23090 (threads 6704/6708/671A/671E):

- The pusher validation step takes pusher_role_image_digest through env
  (PUSHER_ROLE_IMAGE_DIGEST_INPUT); no run: block interpolates the free-text
  digest inline anymore (671E, the line-101 half the first delta missed).
- verify_pusher_source_closure.py --image-repository: a backend-pusher
  qualification compares the Dockerfile.roles pusher-target COPY closure plus
  the role Dockerfile and backend/pusher/pylock.toml; both freshness checks
  (gcp_backend_pusher.yml and verify_pusher_promotion_evidence) select the
  closure by the repository the evidence names, and the auto-deploy triggers
  re-bake on backend/Dockerfile.roles (6708).
- Runbook step 3 gates the messaging-maintenance workers digest through
  admit_role_image.py (revision label + workers OMI_ROLE) before the job
  reconcile; messaging_operations.py keeps its authenticate-last contract
  (6704).
- Tests: role-closure coverage/drift/subset tests, promotion-evidence
  role-dockerfile drift test, workflow contract assertions for the env-passed
  input and repository-selected closure.

@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: e957d79fe9

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

Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…sure

Codex round 2 of #23090: both pusher images build from the repository root,
so .dockerignore decides what enters the build context. The auto workflow
already re-bakes on it, but production may select an older run whose digest
was built under different context rules; neither the copied paths nor the
contract fingerprint detects that. Add .dockerignore to both closures.
Git-on-my-level and others added 5 commits October 22, 2026 09:01
…e gateway and pusher deploys, workers digest for the maintenance job

The code half of the B3 role-image cutover. Merging changes nothing any
service deploys: every new input defaults blank and the fat builds stay the
default path.

- `gcp_llm_gateway.yml` input `gateway_image_digest`: a backend-gateway
  digest from a build-only run of the admitted SHA skips the llm-gateway
  build, deploys `gcr.io/<project>/backend-gateway@<digest>` through
  `deploy-llm-gateway.sh` (image.repository + image.digest, already B2),
  proves the rolled-out Deployment template runs that reference, and runs
  the VPC probe and smoke pod from the same image.
- `gcp_backend_pusher.yml` input `pusher_role_image_digest` (development
  only; production rejects it): deploys backend-pusher through the
  unchanged live-capacity gate, Helm release and receipts instead of
  building the fat image. The production qualification flow admits
  evidence naming `gcr.io/based-hardware-dev/pusher` or `.../backend-pusher`
  and promotes under the same repository name.
- New `backend/scripts/admit_role_image.py`: single-service admission that
  derives the repository from runtime_images.json and checks the digest
  format, the `org.opencontainers.image.revision` label against the
  deployed SHA and `OMI_ROLE`, the same properties the stack resolver
  enforces.
- `verify_pusher_promotion_evidence.py --expected-repository` takes a
  comma-separated allowlist; the receipt must name the repository the
  evidence qualified. This edits a promotion-contract file, so older dev
  qualification runs stop promoting; the next auto-deploy run re-qualifies.
- `messaging_operations.py desired_job` admits exactly
  `gcr.io/based-hardware/backend@sha256:…` or `.../backend-workers@sha256:…`
  instead of any based-hardware repository.
- Runbook `role-image-cutover.md` B3 checklist carries the verified
  dispatch inputs and the remaining pusher auto-deploy step.

Tests: `test_admit_role_image.py` (admission + workflow wiring), extended
`test_verify_pusher_promotion_evidence.py` and `test_messaging_operations.py`;
`runtime_image_contracts.py check` passes for 19 images.
…ository guard, registry errors, CI test string

Addresses GLM review round 1 of #23090 (SHIP, 2 P2, 3 minor) and the one
CI failure (Backend unit shard 1/6):

- `test_pusher_deployment_control_workflow.py` expects the pusher build step's
  new condition (development may skip the build for an admitted
  backend-pusher digest; production still never builds). The step comment
  moves above the step name so the assertion window still sees the `if:`.
- Both admission steps take the dispatch input through `env:`
  (`ROLE_IMAGE_DIGEST_INPUT`) instead of inline `${{ }}` interpolation, the
  pattern the pusher prod selection step already uses.
- The prod qualification step fails on an evidence file without
  `image_repository` before the allowlist `case`, which an empty value would
  otherwise have matched.
- `admit_role_image.py` raises `ServiceImageError` instead of `KeyError` for
  a registry service entry without `image`/`role`.
- `messaging-channels.md` no longer offers the Artifact Registry digest form
  that `desired_job` rejects; it names the two admitted repositories.

Not changed: the pusher production lane for backend-pusher stays unreachable
until `gcp_backend_pusher_auto_deploy.yml` qualifies that image (disclosed in
the runbook and PR body; a separate `.github` change for David to name).
…e, env-passed validation input, runbook admission

Addresses Codex round 1 of #23090 (threads 6704/6708/671A/671E):

- The pusher validation step takes pusher_role_image_digest through env
  (PUSHER_ROLE_IMAGE_DIGEST_INPUT); no run: block interpolates the free-text
  digest inline anymore (671E, the line-101 half the first delta missed).
- verify_pusher_source_closure.py --image-repository: a backend-pusher
  qualification compares the Dockerfile.roles pusher-target COPY closure plus
  the role Dockerfile and backend/pusher/pylock.toml; both freshness checks
  (gcp_backend_pusher.yml and verify_pusher_promotion_evidence) select the
  closure by the repository the evidence names, and the auto-deploy triggers
  re-bake on backend/Dockerfile.roles (6708).
- Runbook step 3 gates the messaging-maintenance workers digest through
  admit_role_image.py (revision label + workers OMI_ROLE) before the job
  reconcile; messaging_operations.py keeps its authenticate-last contract
  (6704).
- Tests: role-closure coverage/drift/subset tests, promotion-evidence
  role-dockerfile drift test, workflow contract assertions for the env-passed
  input and repository-selected closure.
…sure

Codex round 2 of #23090: both pusher images build from the repository root,
so .dockerignore decides what enters the build context. The auto workflow
already re-bakes on it, but production may select an older run whose digest
was built under different context rules; neither the copied paths nor the
contract fingerprint detects that. Add .dockerignore to both closures.
…tract test

test_pusher_auto_deploy_paths pins the exact trigger closure and parses the
paths block line-by-line, so the Dockerfile.roles entry also joins its
expected set (the inline YAML comment moved into the ci-budget rationale;
the naive parser stops at comment lines).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run: rebased onto current main and resolved the CI-budget conflict.

  • The branch was 179 commits behind main (merge state DIRTY). Rebased all 5 commits onto current main; the only conflicts were five rationale strings in .github/ci-budget.yaml where main's B5 change and this PR's B3 change rewrote the same lines. Resolved by combining both sentences (main's B5 base + the B3 sentence), matching the file's accumulate convention; check_ci_budget.py passes on the result.
  • The three failing checks on the previous head were not PR-caused: shard 5's test_dream_capacity_retry.py::test_heavy_pass_zero_cost_retries_do_not_fill_receipt_cap[True-bare_429] failure is an unrelated subsystem flake (dream subsystem untouched by this diff; sibling params passed; 20/20 parametrizations pass locally at both old and new head; main's backend unit runs failed on other tests in the same window), and shard 6's failure was a wall-clock overrun only (734s vs 720s budget, every test passing).
  • Verification before push: full scripts/pr-preflight with this PR body (49 checks, pass) and the repo backend runner over the PR's five test files (29 passed).
  • After the push (b2b3343b → 345e6707, force-with-lease against the recorded old head): all backend unit shards + suite pass (shard 6 now 9m07s, well under budget), merge state CLEAN, no new review comments.

@Git-on-my-level
Git-on-my-level merged commit f93c9f8 into main Oct 22, 2026
63 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/p41-b3 branch October 22, 2026 03:50
Git-on-my-level added a commit that referenced this pull request Oct 22, 2026
…D D2 wiring; needs David's .github naming) (#23100)

## What changed and why

Plan D **D2 deploy wiring** (lane `p41-d2`), stacked on #23088 (the
chart). It lets the lead roll the `listen-edge` GKE chart through the
existing listen workflow by an **admitted image digest** from the
build-only train. **Nothing deploys by merging this**, and the `.github`
change **is named by David** (see the table below).

- **`.github/workflows/gcp_backend_listen_helm.yml`** (existing
workflow; no new `.github` file): new `workflow_dispatch` input
`listen_edge_image_digest`. Blank (default, and the push-to-main auto
path) leaves the listen-edge release untouched. When set: GCR login +
buildx, `admit_listen_edge_image.py` reads the image config and refuses
anything that is not `gcr.io/<this project>/listen-edge@sha256:…` whose
revision label (`org.opencontainers.image.revision`) equals its
`OMI_RELEASE_SHA` stamp **and** is a commit in this repository that the
checked-out source contains (the listen `image_tag` ancestor-of-main
rule applied to a digest, so an earlier train's digest — or the previous
one, for a rollback — stays deployable after main moves on); prod
materializes `LISTEN_EDGE_PRIVATE_VALUES_YAML` (`privateEnv`, e.g. the
shared `EDGE_SHADOW_TOKEN`) with the same hygiene as
`LISTEN_PRIVATE_VALUES_YAML`; **after** backend-listen's own rollout
verification (and the prod NEG reconcile) the listen-edge chart is
helm-upgraded by digest with a 600 s rollout wait, status report, pod
listing and private-file cleanup. `mode=rollback` touches the listen
release only (edge rollback is by digest or `helm rollback`, per the
runbook).
- **`backend/scripts/admit_listen_edge_image.py`** + 23 unit tests
(wiring input validation).
- `config/deployment-setting-classification.json`:
`LISTEN_EDGE_PRIVATE_VALUES_YAML` is a secret.

Why the listen workflow and not the train's `service_images`:
listen-edge has no current image to cut over from, prod trains are
`cloud-run-only` (prod `deploy_targets=all` is rejected), and the listen
workflow already serves both environments with the same admission shape
(`image_tag` → ancestor of main; here digest → built from a commit the
checkout contains). The image itself still comes from the train (B2's
`build-role-images` publish).

## `.github` naming — recorded

| File | Change | Why it needs David | Risk if merged without naming |
| --- | --- | --- | --- |
| `.github/workflows/gcp_backend_listen_helm.yml` | New optional input
`listen_edge_image_digest`; three admission steps (GCR login, buildx,
digest admit); prod private-values materialize/cleanup; one Helm upgrade
step for `backend/charts/listen-edge` + pod listing, all gated on the
input | Edits a production deploy workflow (`prod` environment, WIF
deployer) and reads a new protected-environment secret name
`LISTEN_EDGE_PRIVATE_VALUES_YAML` | Workflow policy only: with the input
blank every existing step is byte-identical in behaviour; the new steps
never run. A set digest can only create/roll the `<env>-omi-listen-edge`
release in `<env>-omi-backend` |

**Named by David, 2026-10-22 ~02:20Z: "You can do those workflow PRs and
merge them"** (recorded in the P49 lead brief, 10-22 02:25Z, covering
this PR and #23090). Merge authorization is complete; the lead arms
`merge_on_green.sh` with `ALLOW_WORKFLOW_EDIT=1` and merges after TRAIN
Q DONE, not this lane.

## Product invariants affected

**INV-DATA-1** — path match only (`.github/workflows/gcp_*.yml`). The
change adds a listen-edge step to the listen workflow and preserves
every existing authority; no desktop-backend GKE deployment authority
returns (`.github/scripts/test_check_mobile_production_routing.py`: 12
OK locally).

## How it was verified

Repository `BasedHardware/omi`, branch `lane/p41-d2-wiring`, base `main`
(stacked on #23088, now merged as `2f43fb4f83`). All local commands
under `bin/omi-heavy run -- nice -n 19`.

- `actionlint .github/workflows/gcp_backend_listen_helm.yml`: clean.
**Layer: workflow lint.**
- `backend/scripts/check_workflow_contracts.py` on the changed files:
passed. `.github/scripts/check_deployment_secret_boundary.py --base
origin/main`: passed. `.github/scripts/check_ci_budget.py --base
origin/main`: passed. **Layer: repo checks.**
- `pytest tests/unit/test_admit_listen_edge_image.py
tests/unit/test_workflow_contracts.py
tests/unit/test_listen_helm_env_overrides.py`: **165 passed** (23 new).
**Layer: unit.**
- `.github/scripts/test_check_mobile_production_routing.py`: 12 OK.
**Layer: INV-DATA-1 mutation tests.**
- GLM review round 1 (head c67bd60): SHIP with one P2 (equality
admission made rollback-by-digest dead once main moved) — fixed in
`4a7a025178` by the ancestor rule above; round 2 reviews that delta.
- **origin/main merge (2026-10-22, head `2e45f50b4e4`, lane P49)**:
resolved `gcp_backend_listen_helm.yml` by keeping both new dispatch
inputs — `listen_edge_image_digest` (D2) and main's B5
`break_glass_lock` — and the three `ci-budget.yaml` rationale conflicts
(each records both inputs; D2 budget bumps 11/15 kept, main's
`expected_runs_per_day` kept). Re-verified under `nice -n 19`:
actionlint clean; `check_ci_budget.py --base origin/main`,
`check_deployment_secret_boundary.py --base origin/main`,
`check_workflow_contracts.py` all passed; pytest
`test_admit_listen_edge_image.py test_workflow_contracts.py
test_listen_helm_env_overrides.py test_runtime_image_contracts.py`:
**227 passed**; `make runtime-image-source-closure`: 19 registered
images OK.
- **CPU-guard allowlist delta (head `b5fff377503`)**: merging main
pulled #23176's `test_batch_audio_language.py` into this PR's shard
selection, where
`test_admitted_short_false_permission_cannot_bypass_worker_barrier[zh-clean_speech-6s-pcm16]`
sat on the 1.00s fast-unit CPU fail limit (1.05s, then 1.00s, two runner
attempts) while staying under it on main's `--all` shards and locally
(62/62 pass; guard silent locally). Allowlisted that node ID with
rationale — the same boundary remedy as the Dream retry entries
(`8d062ad3cfa`); no global threshold change, no `slow` move.
`test_fast_unit_duration_allowlist_selection.py`: 2 passed.

**Not verified** (by design): a real dispatch. The new steps need a
published listen-edge digest (the first build-only publish run is the
lead's) and a prod/dev environment; `docker buildx imagetools inspect`
against GCR is the same call `deploy-backend-stack` already makes for
`service_images`.

## Tests

`backend/tests/unit/test_admit_listen_edge_image.py` — core path: a
digest built from the checked-out SHA or from an ancestor of it yields
repository + digest + revision, `main` writes the GitHub env file; blank
input reads nothing. Error paths: tag instead of digest, other project,
other image, short/uppercase digest, `service_images` pair shape and
lists are refused **before any registry read**; a digest built from a
commit the checkout does not contain, a label without matching
`OMI_RELEASE_SHA` (refused before the ancestry check), an
unlabelled/short/`unknown` revision, a null image config, a short
checked-out SHA and a registry read failure are refused; `main` exits 1
with `ERROR`.

## UI evidence

UI-Evidence: none -- deploy workflow and scripts only.

## Rollback

Revert the PR (no runtime effect either way). Operationally: dispatch
with a blank digest = no listen-edge change; a previous digest re-rolls
the previous image.

Failure-Class: none
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