Skip to content

fix(listen): private listen env via Secret Manager references, not the Helm privateEnv overlay - #25660

Merged
Git-on-my-level merged 12 commits into
mainfrom
lane/listen-envfrom
Nov 20, 2026
Merged

Git-on-my-level merged 12 commits into
mainfrom
lane/listen-envfrom

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Private backend-listen env values (the STT cap fallback cohort and the media/noise digest serve list, both uid-bearing) were rendered as literals by every listen Helm roll from the GitHub prod secret LISTEN_PRIVATE_VALUES_YAML through the chart's privateEnv overlay. No deploy render, drift checker or train gate could see what a listen roll writes, so every listen train hit an unwaivable LISTEN_PRIVATE_VALUES_YAML incomplete row (owner brief: omi-workspace data/run-2026-11-17-v3-resume/brief-listen-private-values.md).

This moves the values out of the render:

  • Secret Manager → External Secrets → per-name secretKeyRef. One Secret Manager JSON document LISTEN_PRIVATE_ENV; a dedicated prod ExternalSecret in the backend-secrets chart (dataFrom.extract, refreshInterval: 0s) syncs it into prod-omi-backend-listen-private-env, a Secret only listen references (the shared backend secret is loaded whole via envFrom elsewhere, so it is not used). The listen chart's new privateSecretEnv declares the names; the template renders one secretKeyRef (optional: false) per name, drops public entries of the same name, and refuses a non-empty privateEnv while it is set. Per-name refs rather than envFrom because a chart env entry silently beats an envFrom key of the same name, and so the names stay declared in Git.

  • Three private names. STT_CAP_DISPATCH_COHORT and MEDIA_NOISE_MODE_SERVE_UID_SHA256S (uid-bearing), plus STT_CAP_DISPATCH_ENFORCEMENT, which stays private by ruling (lead2 4e5e71/45689e, b2cf73: keep it in the private set; no public fold-back). The listen chart no longer carries a public enforcement or cohort literal that could be mistaken for the live value; the historical chart false was never the live value. MEDIA_NOISE mode/percent and lanes were already public (config(listen): fold live media-noise and short-clip-floor values into the listen chart #25651).

  • Workflow (existing file only). The deploy path no longer reads the GitHub secret. New prod-only mode: private-env-migrate (rolls nothing) reads the secret inside the protected job, checks its name set and that folded public names equal the chart, writes one LISTEN_PRIVATE_ENV version via WIF, applies the backend-secrets chart, force-syncs, and reports per name only same/changed. A new pre-roll step "Prove private listen env is unchanged" runs after the secret sync and before the listen Helm upgrade: every declared name must be present and non-empty in the synced Secret, and where any serving template (Deployment or ReplicaSet with pods) still carries a literal, the values must be identical — otherwise nothing is deployed. Helper: .github/scripts/listen_private_env.py (never prints a value or hash).

  • Runtime manifest, validators, both drift checkers, feature-flag registry and docs follow; new runbook backend/docs/runbooks/listen-private-env.md (changing a value = new SM version → force-sync → rollout restart; never a code deploy). backend/deploy/runtime_env/README.md replaces the live-edit shortcut with the sanctioned path.

  • verify_pusher_cohost_env_diff.py: listen's enforcement and cohort are now references, not env literals, so they are pusher-only names in the comparison (pusher keeps its public observe-only values). .github/ci-budget.yaml records the new dispatch option (no new trigger, no PR runs).

The meta-repo train gate change that recognises this "private-free" source (no overlay request id; references only; ExternalSecret-Ready row) ships separately in omi-workspace.

Rollout / cutover (not done by this PR)

  1. IAM (done 2026-11-18 ~05:55Z with David's human login, authorized by David for this change only): created the empty secret LISTEN_PRIVATE_ENV in based-hardware (automatic replication, no version), and granted omi-ci-deployer-prod roles/secretmanager.secretVersionAdder on that one secret. ESO already has project-level accessor.
  2. After merge: dispatch mode=private-env-migrate (prod; no listen roll) — expect every name effect=same.
  3. Next off-peak listen train (coordinated): the gate shows the two literal→reference rows as reviewed; the in-job guard proves byte equality before Helm.
  4. Rollback of the cutover roll: mode=rollback (Helm restores the previous revision whose stored values carry the literals). Rollback of this PR before step 3: revert; the deploy path would then need the overlay again (the GitHub secret is untouched).
  5. Later cleanup: delete the GitHub secret and the evidence/private-env-migrate modes after a clean soak.

Until step 2 completes, a listen roll from main fails closed at the guard (ExternalSecret not Ready) before any listen mutation. Cloud Run deploys also apply the backend-secrets chart and will create the (not yet synced) ExternalSecret; that is inert.

Product invariants affected

  • INV-DATA-1 — the listen deploy workflow changes, but no routing, endpoint, Firebase/Firestore project or protected authority does. Only the source of two existing listen env values moves, from a rendered literal to a Secret Manager reference in the same prod project, and the values themselves are unchanged.
  • INV-MEM-4 — runtime_env.yaml is regenerated for the listen env sources only (three secret references). No memory intake, consolidation or promotion setting changes.

Also held by this change:

  • Private listen values never appear in a rendered manifest, a workflow log, or Git; only names and same/changed.
  • A listen roll cannot change a private value; a private value change cannot ride a code deploy.

Tests

  • New: backend/tests/unit/test_listen_private_env.py (migrate/guard/sync with fake kubectl/gcloud; no value leaks; every serving ReplicaSet checked), backend-secrets ExternalSecret render test, listen chart render tests (references only, privateEnv refused, credential names refused).
  • Updated: test_listen_helm_env_overrides.py (workflow: secret only in evidence/migrate steps; guard ordering; migrate never rolls), test_check_cloud_run_env_drift.py, test_stt_cap_cohort_lanes.py, test_listen_workload_identity_chart.py, test_backend_secrets_chart.py.
  • helm template prod/dev, actionlint, check_deployment_secret_boundary.py, check_feature_flag_registry.py, check_runtime_env_compose.sh pass locally.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 5 commits November 18, 2026 12:31
Private backend-listen values (STT cap fallback cohort, media/noise digest
serve list) were rendered as literals from the GitHub prod secret
LISTEN_PRIVATE_VALUES_YAML through the chart's privateEnv overlay, so no
deploy render or drift gate could see what a listen roll writes and every
train refused listen with an unwaivable incomplete row.

- backend-secrets: a dedicated prod ExternalSecret syncs one Secret Manager
  JSON document (LISTEN_PRIVATE_ENV) into prod-omi-backend-listen-private-env
  (dataFrom.extract, refreshInterval 0s: a value moves only on force-sync).
- backend-listen chart: privateSecretEnv declares the private NAMES; the
  template renders one secretKeyRef per name and refuses a non-empty
  privateEnv while it is set. STT_CAP_DISPATCH_ENFORCEMENT=true (live since
  10-20 via the overlay) is folded into the public chart unchanged.
- workflow: the deploy path no longer reads the GitHub secret; a new
  prod-only mode private-env-migrate copies it into Secret Manager inside the
  protected job (no roll), and a pre-roll guard refuses any listen upgrade
  whose private values would differ from every serving template.
- manifest, validators, drift checkers and registry follow; runbook added.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
lead2 ruling b2cf73 (applying 4e5e71/45689e): enforcement stays in the private set, no public
fold-back. privateSecretEnv now declares STT_CAP_DISPATCH_ENFORCEMENT with the cohort and the
media/noise digest list; the chart carries no public enforcement or cohort literal for prod listen.

Failure-Class: none

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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T06:21:57.294300Z
We couldn’t complete this review. Comment @codex review to try again.
32044d2 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

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 and others added 7 commits November 18, 2026 13:27
…ate-env secret

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xt logging)

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- guard: after cutover a Secret written after the oldest serving pod started is pending-restart,
  so a roll can never apply an unannounced value change (F1)
- evidence mode refuses as retired once the candidate declares privateSecretEnv (F2)
- chart refuses privateSecretEnv names that are chart-derived or workflow_dispatch overrides (F3)
- runbook: pending-restart window and why an empty value is not a supported state (F4)

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the backend-listen prod overlay: keep main's UNLIMITED_V2 backfill cap lines and this
branch's private-env secret references; recompose runtime_env.yaml.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… workflow step inventory

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 6603b13 into main Nov 20, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/listen-envfrom branch November 20, 2026 20:16
Git-on-my-level added a commit that referenced this pull request Nov 21, 2026
…teEnv (#25907)

## What


`test_record_seal_cluster_repair_deploy.py::test_cpu_admission_switch_is_declared_in_runtime_manifest_and_listen_chart`
fails on main. It renders the backend-listen chart with `--set-string
privateEnv.<key>=false` for every stage. Since #25660 the chart fails
when `privateEnv` is set alongside `privateSecretEnv`, which prod now
uses, so prod's `helm template` exits 1.

Main's changed-file selector rarely picks this file, so it hid until PRs
touching the charts selected it. It showed up on #25819.

## Change

Head `f2618fc6fa05e0562ad5040d4b894803461b9838`. Test, selector and docs
only.
- On stages whose values set `privateSecretEnv` (prod), the test asserts
the chart refuses the literal overlay with the "privateEnv is retired"
message. That is the stronger guarantee now: the switch can only change
through the Secret Manager document.
- Dev keeps the existing override render check.

- Prod also renders without the overlay and asserts the switch is
`true`. The branch matches the chart guard (`privateSecretEnv.keys`).
- `select_backend_unit_tests.py` selects this test for
`backend/charts/backend-listen/` changes, so it can't go stale
unselected again.
- `listen_pusher_pipeline.mdx` no longer tells operators to roll back
the seal overlap switch on prod listen with a `privateEnv` override,
which prod refuses. It documents the values-file PR plus listen deploy
path instead. Change note:
`docs/listen_pusher_pipeline/changes/2026-11-20-seal-overlap-rollback-prod-listen.md`.

These address all six panel findings (review-20261120t232252-b825).
There is no chart, manifest or runtime change.

## Verification

`pytest tests/unit/test_record_seal_cluster_repair_deploy.py` passes
15/15 locally with Helm, and 205 pass across the selector,
workflow-contract and seal tests. The prior prod failure reproduced at
main `9bf1acd`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
kriegcloud pushed a commit to kriegcloud/omi that referenced this pull request Nov 21, 2026
…teEnv

Since BasedHardware#25660 the backend-listen chart fails when privateEnv is set
alongside privateSecretEnv, which prod now uses. The CPU admission switch
test still passed --set-string privateEnv.<key>=false for every stage,
so prod's helm render exited 1. Main's selector rarely picks this file,
so it hid until PRs touching the chart selected it (seen on BasedHardware#25819).

On stages with privateSecretEnv, assert the chart refuses the literal
overlay, the stronger guarantee now. Dev keeps the existing override
render check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants