Skip to content

SCA-4763: derive the isolated Pusher canary from the live workload - #26602

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/omi-control-opencode-deepseek/c8be2e95e81a
Nov 28, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/omi-control-opencode-deepseek/c8be2e95e81a

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

The protected image-only chain refused its canary verification at 8d97c41d's successor on 2026-11-28: run 46139487564 returned effective_environment_differs because the isolated canary had been helm-rendered from the dispatching main. It carried ConfigMap keys and chart env that an image-only promote never applies — production keeps the live template and the live prod-omi-backend-config. Release selected the live-derived canary (SCA-4763), and this change builds it.

What changes

  • backend/scripts/pusher_canary_from_live.py derives the isolated canary from the live objects instead of rendering it:
    • the runtime ConfigMap is a byte-for-byte copy of live prod-omi-backend-config (data and binaryData), so its fingerprint equals live's;
    • the Deployment is the live prod-omi-pusher PodTemplate with only the candidate image replaced, the canary identity labels applied, and every ConfigMap reference (envFrom, env[].valueFrom.configMapKeyRef, configMap volumes, projected sources) redirected to the copied map;
    • the Service is a plain ClusterIP selecting only the canary pod, with the live container port and no ingress, NEG or backend-config annotations.
  • gcp_backend_pusher.yml uses that helper for the isolated ConfigMap and the canary workload. The canary installs no Helm release.
  • pusher_release_receipt.py record-live gains --derived-from-live: the receipt's expected template is derived from the live baseline at receipt time (same derivation), not from a chart render. --live-release-name and --live-config-map-name name that baseline. The receipt schema is unchanged.
  • Canary cleanup deletes the plain Deployment and Service before the retained Helm lookup, which stays for a canary created by a pre-derivation revision.
  • pusher_canary_from_live.py joins CONTROL_PATHS, so a preview or canary run is accepted only from a main revision whose verifier is byte-identical.

Gates preserved

  • Parity is untouched and now has a property test: on the real live template shape, template_parity reports no class other than equal. The only differences are the excluded image, the canary names the helper already normalizes, and the ConfigMap name it renames back.
  • The isolated ConfigMap keeps live's exact data, so runtime_config_map compares equal, and the canary's startup inputs are what an image-only promote preserves.
  • Isolation is unchanged: one replica, no HPA, no ingress, a Service that selects only the canary, its own ConfigMap copy, the shared Workload-Identity KSA copied from the live template (no release-named KSA), and the same listener probe path.
  • Qualification, evidence re-fetch, Firestore readiness, runtime-capability admission, server dry runs, the candidate→baseline inverse receipt, dependency snapshots and the guarded image patch are untouched. The pinned inverse remains f26e8757….

Product invariants affected

  • INV-DATA-1

.github/workflows/gcp_backend_pusher.yml is in the INV-DATA-1 glob set. No data-plane authority moves: no production-family artifact is routed to development, staging, a beta API or an arbitrary endpoint, and Firebase Auth, Firestore and the project bindings are untouched. The workflow change is which object the isolated canary is built from; production routing and the serving digest are unchanged.

Verification

Local, on the control host (SCA-2134 keeps backend suites and type checks on worker hosts):

  • pytest -q backend/tests/unit/test_pusher_canary_from_live.py — 7 passed, including the all-classes-equal parity test and the copy fingerprint equality.
  • pytest -q backend/tests/unit/test_pusher_deployment_control_workflow.py — 29 passed.
  • pytest -q .github/scripts/test_pusher_image_only.py .github/scripts/test_pusher_canary_inverse.py — 90 passed, 96 subtests.
  • check-deployment-concurrency.py --self-test — OK; workflow YAML parses; git diff --check clean.
  • Rehearsed the derivation against the real live prod-omi-pusher Deployment, Service and ConfigMap read externally: selector matches labels, every parity class equal, copied ConfigMap fingerprint equals live sha256:bf19fcaa….

The backend suite, type check and runtime-env validation were not run here; CI is their verification for this change.

Rollout this unblocks

Merge runs the automatic development qualification on the new main. Because CONTROL_PATHS now includes the new helper, the existing preview 46137316082 can no longer back a promote from the new revision — the preview is refreshed first, then the protected canary is rerun against it. Serving stays pinned to f26e8757… until Release accepts the rerun canary receipt and authorizes the promote.

View guided diff Turn on auto-fix

The protected canary verification refused with effective_environment_differs
(run 46139487564): the canary was helm-rendered from the dispatching main, so
it carried ConfigMap keys and chart env that an image-only promote never
applies. Production stays on the live template and the live ConfigMap.

Derive the canary from the live objects instead:
- copy the live runtime ConfigMap byte for byte (identical fingerprint);
- copy the live Pusher PodTemplate, changing only the candidate image, the
  canary identity labels and the ConfigMap references;
- create a plain ClusterIP that selects only the canary.

record-live gains --derived-from-live so the receipt's expected template is
derived from the live baseline rather than a chart render. Cleanup removes
the plain Deployment and Service. The new module is a workflow control path,
and the runbook now states the derivation.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T12:05:44.527316Z f7b8d1c 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.

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

ℹ️ 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 on lines +629 to +632
python3 backend/scripts/pusher_canary_from_live.py config-map \
--namespace prod-omi-backend \
--live-config-map prod-omi-backend-config \
--canary-config-map "$PUSHER_CANARY_CONFIG"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep proposed-config canaries for full production deployments

For an ordinary production deployment (pusher_image_only=disabled, pusher_canary_only=false) that changes runtime configuration, this now qualifies a copy of the old live ConfigMap instead of the proposed configuration. In the same workflow, Apply non-secret pusher runtime config still applies the new configuration and the Helm step rolls out the candidate against it. Consequently, production receives configuration that the canary never exercised, and _validate_final_deployment() in backend/scripts/verify_pusher_promotion_evidence.py rejects the differing ConfigMap fingerprints only after that rollout. Restrict live-derived canaries to the image-only qualification lane and retain proposed-config/chart-derived canaries for full deployments.

Useful? React with 👍 / 👎.

Codex P1 on dc158aa: the derived copy also ran for ordinary full deploys,
whose canary must exercise the proposed configuration the deploy applies.
Branch on CANARY_ONLY: the isolated producer copies the live ConfigMap and
PodTemplate, the ordinary deploy keeps its render and Helm canary, and
cleanup only kubectl-deletes the canary-only objects.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exact-head review: SHIP f7b8d1c. No blocking findings. The live-derived path is gated on CANARY_ONLY, and ordinary full deployments retain the proposed-config/Helm canary. Added unit tests make no Kubernetes writes and expose no secret values. Local checks passed: 7 + 29 + 90 tests (96 subtests), workflow YAML parse, concurrency self-test, and diff check. Full backend suite, type check, and runtime-env validation were not run locally. No author-authored verdict was found; the current-head Codex bot summary is advisory.

@Git-on-my-level
Git-on-my-level merged commit 01dac73 into main Nov 28, 2026
66 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/omi-control-opencode-deepseek/c8be2e95e81a branch November 28, 2026 12:30
Git-on-my-level added a commit that referenced this pull request Nov 29, 2026
…26732)

## What changed and why

Re-pin `reviewed_scripts_tree` in
`.github/workflows/gcp_backend_listen_helm.yml` from
`686d4a44e3041439050d65e39c2aca271f562386` to
`3562810cd1cfd3a0ca13f71ae0f2bdcb630f781e`, the `.github/scripts` tree
of `origin/main` at `54b8f17e013c84aedddc805e6eac3761afdb7c65`
(SCA-4091, SCA-5350).

The step `Verify staged evidence scripts before Python` runs for
image-only evidence requests and refuses unless `HEAD:.github/scripts`
equals the pinned tree. The pin was last set in `06bd2aaf3c4`
(2026-11-27). 24 commits have changed `.github/scripts` on main since
then, so the guard now refuses every image-only evidence request,
including the one #26730 (`image_reference`) needs. This PR changes that
one line and nothing under `.github/scripts`.

### What the pin now vouches for

The pin covers exactly this diff, `git diff --stat
686d4a4
3562810` (paths relative to
`.github/scripts`):

```
 check-deployment-concurrency.py              |  88 +++++++++++++++-
 check-mobile-changelog.py                    |   4 +-
 check_firestore_collection_budget.py         |   9 +-
 check_ui_evidence.py                         |  82 ++++++++++++---
 dead_code/backend.allowlist.json             |  20 ----
 failure_class_guard_ratchet_allowlist.json   |   8 +-
 listen_overlay_evidence.py                   |  18 +++-
 notification_dispatch_boundary_baseline.json |   2 +-
 pusher_canary_inverse.py                     |   8 +-
 pusher_image_only.py                         |  68 +++++++-----
 pusher_image_only_detect.py                  |   2 +-
 pusher_image_rehearsal.py                    |  33 ++++--
 test_check_firestore_collection_budget.py    |   3 +-
 test_check_ui_evidence.py                    |  84 ++++++++++++++-
 test_mobile_changelog.py                     |  10 ++
 test_pusher_image_rehearsal.py               |  53 +++++++---
 test_worker_image_only.py                    |  34 +++---
 tests/ui-author-approval.test.cjs            | 149 ++++++++++++++++++++++++++-
 ui-author-approval.cjs                       |  78 +++++++++++---
 19 files changed, 625 insertions(+), 128 deletions(-)
```

**Executed by the Listen evidence and image-only route.** The route runs
`listen_runtime.py reconstruct` and then `listen_overlay_evidence.py`
(`job`, `apply-image-only`, `verify-image-only`), which imports
`listen_runtime` and `listen_helm_env_overrides`. Of those, only one
file changed:

- `listen_overlay_evidence.py` (+17/-1, #26730). `produce()` leaves the
new `image_reference` dispatch input out of the bound-inputs equality
and instead requires it to be blank or exactly the `image` the evidence
request names (`dispatch_binding` otherwise). A new `image_pin()`
accepts only `gcr.io/<deploy project>/backend:<7-40 hex>` or
`@sha256:<64 hex>` and returns the tag or digest. A new
`--image-reference` argument is accepted only in `argv` mode and only
without `--image-tag`; it feeds the same `helm_args()` the deploy
already used. `listen_runtime.py`, `listen_helm_env_overrides.py` and
`listen_private_env.py` are unchanged.

**Not executed by the Listen route** (in the tree, so covered by the
hash):

- `check-deployment-concurrency.py` (#26599): the Pusher lock contract
sends the isolated canary and image-only preview/promote/rollback lanes
to `deploy-gke-pusher-prod` instead of `prod-train`, with a validator
and self-test cases for those lanes.
- `pusher_image_only.py` (#26610, #26710, #26602): a read-only server
dry-run probe re-reads the Deployment and retries up to 3 times on a
stale snapshot, a live write is never retried; `BASELINE` moves to the
live digest `sha256:fd5fb969…`;
`backend/scripts/pusher_canary_from_live.py` joins `CONTROL_PATHS`.
- `pusher_image_only_detect.py` (#26710): the same `BASELINE` digest.
- `pusher_image_rehearsal.py` (#26560): provenance no longer requires an
unchanged Pusher source closure between the candidate and main; it
requires the development qualification receipt to be at most 24 hours
old (`qualification_stale`).
- `pusher_canary_inverse.py` (#26602): docstring only.
- `check_ui_evidence.py` (#26692): screenshots are required for rendered
UI paths and for Swift or Dart files whose content declares UI, not for
all client code; tests and the generated API file are exempt.
- `ui-author-approval.cjs` (#26655, #26691): test sources and
import-only Swift no longer count as UI; an approval carries to a later
head when the PR's own UI hunks are the same at both heads.
- `check-mobile-changelog.py` (#26341): `app/test/spine/` needs no
changelog entry.
- `check_firestore_collection_budget.py` (#26638): skips
`backend/.venv-eval`.
- `dead_code/backend.allowlist.json`,
`failure_class_guard_ratchet_allowlist.json`,
`notification_dispatch_boundary_baseline.json` (SCA-5535 Episodes
removal, #26630): five allowlist entries removed, one failure class
grandfathered, one baseline count 4 to 3.
- Tests only: `test_check_firestore_collection_budget.py`,
`test_check_ui_evidence.py`, `test_mobile_changelog.py`,
`test_pusher_image_rehearsal.py`, `test_worker_image_only.py`
(publish-only mode conditions and step digests, #26648),
`tests/ui-author-approval.test.cjs`.

The pin goes stale again whenever a later merge changes any file under
`.github/scripts`. If main's tree moves before this merges, the PR is
rebased and re-pinned, and only the new hunks are reviewed.

## Product invariants affected

INV-DATA-1: preserves the existing authority. The change edits one
constant in a guard step of `gcp_backend_listen_helm.yml`; it changes no
routing, service ownership, deploy target or admission rule.

## How it was verified

- `git rev-parse origin/main:.github/scripts` is
`3562810cd1cfd3a0ca13f71ae0f2bdcb630f781e` at `54b8f17e013c`, and
`HEAD:.github/scripts` on this branch equals the pinned value.
- `backend/tests/unit/test_listen_overlay_evidence.py`: 121 passed. It
includes `test_evidence_bootstrap_refuses_added_script_before_python`,
which runs this guard step's own script against a fixture tree.
- `backend/tests/unit/test_listen_overlay_workflow.py`: 40 passed.
- `backend/tests/unit/test_listen_runtime_workflow.py`: 2 passed.
- `backend/tests/unit/test_workflow_contracts.py`: 141 passed.
- `.github/scripts/test_listen_control_pin.py`: 1 passed.

Not verified here: a real image-only evidence run. No workflow was
dispatched; the guard can only pass on main after this merges.

## Tests

No test change. No test asserts the pinned hash; the guard's behaviour
is covered by
`test_evidence_bootstrap_refuses_added_script_before_python`, which
substitutes its own fixture tree hash.

## UI evidence

UI-Evidence: none -- workflow constant only

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26732?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26732?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26732&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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