Repository navigation
backend: listen-edge Helm chart, listen shadow env plumbing and D2 shadow runbook - #23088
Conversation
…adow runbook Plan D D2 deploy prerequisites, chart side (no deploy, no env flip): - backend/charts/listen-edge: GKE Deployment + ClusterIP Service for the Rust edge, reachable from backend-listen pods only (NetworkPolicy, no NEG annotation, no ingress), terminationGracePeriodSeconds 40 above the binary's 23 s worst-case drain, no preStop hook, Silero model at the image's baked EDGE_VAD_MODEL_PATH, the backend-listen privateEnv pattern for EDGE_SHADOW_TOKEN, image by digest from the role-image train. Token-less service account, non-root, read-only root filesystem, zone spread, PDB. - backend-listen values: EDGE_SHADOW_URL (the in-cluster edge /v1/shadow) and EDGE_SHADOW_PERCENT=0 in the prod values only (the registry checker allows one ramp declaration; dev keeps the code default 0). The mirror stays off: percent is 0. - config/deployment-setting-classification.json: EDGE_SHADOW_URL/PERCENT/ MAX_SESSIONS, EDGE_UPSTREAM_URL and EDGE_VAD_MODEL_PATH are config; EDGE_SHADOW_TOKEN is a secret, so it is never a committed env entry on either chart and arrives only through privateEnv (LISTEN_PRIVATE_VALUES_YAML on listen, LISTEN_EDGE_PRIVATE_VALUES_YAML on the edge), which adds it. - backend/scripts/verify_pusher_cohost_env_diff.py: EDGE_SHADOW_URL (dev, prod) and EDGE_SHADOW_PERCENT (prod) are explained listen-only env; pusher receives no live audio and never mirrors. - backend/docs/runbooks/edge-shadow-rollout.md: lead-owned deploy order, the 1% -> 5% (24 h) -> 25% (>= 3 d) -> 0%+remove ramp, the edge_shadow_gate.py gates (agreement >= 99.5%, coverage >= 95%, open offset p95 <= 32 ms, <= 7.92 ms/audio-s), rollback and invariants. - tests/unit/test_listen_edge_chart.py: rendered contract (grace > 23 and no lifecycle, digest render and untagged refusal, env, no committed token and privateEnv adds/replaces once, ClusterIP without NEG, listen-only NetworkPolicy, no Ingress, SA without token, mirror off by default in both listen values files, percent declared once, EDGE_UPSTREAM_URL == the listen chart's Service name). - backend/docs/feature-flag-registry.md regenerated (as-of 2026-10-22). The deploy-workflow wiring (.github) is a separate PR that waits for David's naming.
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: 6c483fbcfc
ℹ️ 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".
| 2. **Chart**: `gcp_backend_listen_helm.yml` deploys `backend/charts/listen-edge` | ||
| in namespace `<env>-omi-backend` when dispatched with | ||
| `listen_edge_image_digest` (validated: this project's registry, revision |
There was a problem hiding this comment.
Wire listen-edge into the Helm deployment workflow
When a rollout lead follows this prerequisite, the documented deployment is impossible: at this commit .github/workflows/gcp_backend_listen_helm.yml has no listen_edge_image_digest input, does not materialize LISTEN_EDGE_PRIVATE_VALUES_YAML, and only upgrades the backend-listen chart; a repo-wide search found no other deployment consumer for backend/charts/listen-edge. Consequently no edge Service is created, and any later EDGE_SHADOW_PERCENT > 0 ramp only produces mirror connection failures.
Useful? React with 👍 / 👎.
|
|
||
| ## The gate | ||
|
|
||
| `backend/scripts/edge_shadow_gate.py` over one or two scrapes of a single |
There was a problem hiding this comment.
Pin both gate scrapes to the same pod
If this port-forward must be re-established during the required multi-day hold, targeting the Deployment can silently select a different one of the three production pods; Kubernetes documents that a matching pod is selected automatically and that the command must be rerun after that pod terminates (kubectl reference). The gate only detects a mismatch when some counter decreases, so a busier replacement pod can instead produce plausible but meaningless deltas and a false rollout decision. Resolve and record one pod identity and verify that same pod and restart identity for both scrapes.
Useful? React with 👍 / 👎.
|
GLM review round 1 (lane p41-d2,
Local re-verification by the reviewer: 12/12 new tests, registry/secret-boundary/cohost checks OK, prod+dev render by digest, untagged render refused, read-only rootfs confirmed safe (ONNX session loads from memory; ort binary download is build-time only). |
…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
…D D2 wiring) Deploy wiring for the listen-edge GKE chart (BasedHardware#23088). NOT merged until David names the .github change (same pattern as P8/B2); nothing deploys by itself. - .github/workflows/gcp_backend_listen_helm.yml: new workflow_dispatch input listen_edge_image_digest (blank = the listen-edge release is untouched). When set: login to GCR, read the image config (docker buildx imagetools inspect, as deploy-backend-stack does for service_images), admit it through backend/scripts/admit_listen_edge_image.py, materialize the prod LISTEN_EDGE_PRIVATE_VALUES_YAML privateEnv file with the same hygiene as LISTEN_PRIVATE_VALUES_YAML, and after backend-listen is verified (and the prod NEG reconcile) helm-upgrade backend/charts/listen-edge by digest with a 600 s rollout wait, status report, pod listing and private-file cleanup. mode=rollback and the push-to-main auto path do not touch listen-edge. - backend/scripts/admit_listen_edge_image.py: the digest must be exactly gcr.io/<project>/listen-edge@sha256:<64 hex> for this project, and the image config must carry the checked-out SHA as both the org.opencontainers.image.revision label and OMI_RELEASE_SHA (how the build-only train stamps it). Refused before any registry read otherwise. - tests/unit/test_admit_listen_edge_image.py: 19 cases (blank reads nothing; tag/other project/other image/short or uppercase digest/pair shape/lists refused without a registry read; other SHA, label without matching env, unlabelled, short admitted SHA, registry failure refused; main writes the GitHub env file and exit codes). - config/deployment-setting-classification.json: LISTEN_EDGE_PRIVATE_VALUES_YAML is a secret. - .github/ci-budget.yaml: refreshed for the new input; per the B2 precedent the workflow rationale records the change and both jobs take a budget bump (helm-upgrade 5 -> 15 min for the admitted-digest edge rollout wait, neg-coverage-exporter 10 -> 11 recording the trigger change). No PR runs. 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.
What changed and why
Plan D D2 deploy prerequisites, chart side (lane
p41-d2; D2 code is already on main: edge #22944, listen #22945). Nothing deploys and no env flips:EDGE_SHADOW_PERCENTstays 0.backend/charts/listen-edge: GKE Deployment + ClusterIP Service for the Rust edge, reachable frombackend-listenpods only (NetworkPolicy; no NEG annotation; no Ingress),terminationGracePeriodSeconds: 40above the binary's 23 s worst-case drain, no preStop (SIGTERM starts the drain directly), Silero model at the image's bakedEDGE_VAD_MODEL_PATH=/models/silero_vad.onnx, the listen chart'sprivateEnvpattern forEDGE_SHADOW_TOKEN, image by digest from the role-image train (B2). Token-less service account, non-root uid 10001, read-only rootfs, zone spread, PDB. Prod 3 replicas @ 1 vCPU / 512 Mi (plan D sizing), dev 2.backend-listenvalues plumbing:EDGE_SHADOW_URL= the in-cluster edge/v1/shadow,EDGE_SHADOW_TOKENcommitted empty (privateEnv-overridable throughLISTEN_PRIVATE_VALUES_YAML),EDGE_SHADOW_PERCENT: "0"in the prod values only —scripts/check_feature_flag_registry.pyallows exactly one declaration of a ramp key, so dev relies on the code default 0.backend/docs/runbooks/edge-shadow-rollout.md: lead-owned deploy order (off-peak), the registry ramp 1% → 5% (24 h) → 25% (≥ 3 d) → 0% + remove, theedge_shadow_gate.pygates (agreement ≥ 99.5%, coverage ≥ 95%, open-offset p95 ≤ 32 ms, ≤ 7.92 ms per audio second), rollback, invariants.backend/docs/feature-flag-registry.mdregenerated (as-of 2026-10-22; the EDGE rows now show their chart values).The deploy-workflow wiring (
.github/workflows/gcp_backend_listen_helm.yml+ digest admission script) is a separate PR that waits for David to name the.githubchange.Product invariants affected
none (no locked path;
backend/charts/listen-edgeandbackend/charts/backend-listenare not INV-locked).How it was verified
Repository
BasedHardware/omi, branchlane/p41-d2at1ccaa70a90, baseorigin/main. All local commands ran underbin/omi-heavy run -- nice -n 19.helm templateof the chart with prod and dev values, by digest and by tag; untagged render refused (image.tag is required). Rendered Deployment carries grace 40, nolifecycle, the env set above,privateEnv.EDGE_SHADOW_TOKENreplaces the committed entry exactly once. Layer: chart render (offline).pytest tests/unit/test_listen_edge_chart.py tests/unit/test_edge_shadow.py tests/unit/test_listen_helm_env_overrides.py: 85 passed (12 new chart contract tests + the existing mirror-off-by-default and private-values suites). Layer: unit.scripts/check_feature_flag_registry.py: OK after regeneration (it caught the duplicate ramp declaration whenEDGE_SHADOW_PERCENTwas in both listen values files — hence prod-only). Layer: repo check.cargo test --lockedinbackend/edge(unchanged crate, pinned 1.99.1 toolchain): 52 passed, 0 failed. Layer: unit. Notebackend-edge.ymlis path-filtered tobackend/edge/**and does not run on this PR because the crate is untouched.EDGE_VAD_MODEL_PATHequals the pathbackend/edge/Dockerfilebakes the model at, thencargo run --release --bin edge-shadow-replaywith that same source model file over the 3 committed shadow fixtures: allcompleted,aligned: true, 0 decode errors, 0 edge/listen-only windows, agreement 1.0. Layer: offline replay (local).Not verified (by design, lead-owned): any deploy, the live agreement gate (measured only when the lead rolls shadow at 1%), and NetworkPolicy enforcement on the prod cluster (declarative here; the ClusterIP + no-NEG boundary holds regardless).
Tests
backend/tests/unit/test_listen_edge_chart.py— core path: render by digest, env/model path, listen-only NetworkPolicy, mirror off by default in both listen values files, percent declared once, upstream equals the listen chart's Service name. Error path: untagged render must fail;networkPolicy.enabled=falsedrops the policy.UI evidence
UI-Evidence: none -- backend chart, values, runbook and tests only.
Rollback
Revert the PR. Nothing is deployed by it; the committed percent is 0 and
EDGE_SHADOW_URLalone mirrors nothing (maybe_startrequires percent > 0).Failure-Class: none