Skip to content

feat(firmware): publish only bench-tested CV1 images, with staged rollout and a kill switch - #24477

Merged
Git-on-my-level merged 127 commits into
mainfrom
feat/cv1-release-safety
Nov 4, 2026
Merged

Git-on-my-level merged 127 commits into
mainfrom
feat/cv1-release-safety

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Requested by David

What changed and why

CV1's installed overwrite-only MCUboot cannot automatically recover a bad boot,
and randomized RSA signatures mean a rebuild is not the image tested on the
bench. Publish now requires a successful build-only qa_run_id, an explicit
qa_run_attempt, and the bench-reported tested_signed_sha256 of
omi.signed.bin from this same workflow, repository and source SHA. Promotion
queries the tested attempt and downloads only its run-and-attempt-scoped artifact
name, so reruns cannot substitute newly signed bytes. It verifies the bench hash,
run/attempt provenance, version,
network opt-in and SHA-256 hashes, then attaches exactly those three tested
files. Main-only publishing remains in force. Tag creation uses the atomic git refs API
at the tested SHA, refuses existing refs, creates a draft release with
--verify-tag, and verifies the release tag SHA again before publishing. Bench app
ELF symbols are uploaded separately and never attached to a release.

QA packaging defaults to image 0 only, preserving signed app bytes and the
matching manifest entry. Network image 1 requires explicit opt-in on QA and
publish. Factory hex files, MCUboot, partitions and sysbuild layout are unchanged.
The workflow aligns BLE and signed app-header versions and refuses ordinary
3.0.90-3.0.99 releases without emergency_revert=true; the runbook explains
re-signing last good source at a higher version.

Release-body generation rejects every input containing policy/version KV lines
using the backend parser's strip/first-colon rules, rejects metadata delimiters,
and writes policy/version keys after changelog as defense in depth. Normal
publish permits only 0% or 1%; only emergency_revert=true permits up to 100%.
Wider normal cohorts require editing the release body later.

Release-body rollout_percent and blocked control firmware offers, with stable
SHA-256 cohorts, newest-eligible fallback and legacy missing-field defaults.
Blocked builds return 404 from exact-version requests and stay out of all
discovery paths. Explicit version requests ignore rollout_percent for support
and reverts while retaining the blocked kill switch.

Rollout plan: new releases start at 1% of devices on an app build that sends
device_id, and David expands
by editing the release body's KEY_VALUE block
after install, reconnect, identity, audio and battery checks stay clean. David
owns expansion before each next cohort. The app sends the lowercase hex SHA-256
of the normalized pendant DIS serial from automatic discovery and the firmware
update page; raw serials never enter firmware request URLs. If no serial is
available the parameter is omitted. Older app builds only receive a new release
at 100%; during the ramp they retain an earlier eligible release. Metadata
caching delays body edits; this cannot cancel active installs or revoke
downloaded assets.

The firmware contract tests are registered in both local and CI manifest lanes.
An internal-only mobile changelog fragment covers the app's hashed-serial
release plumbing; firmware rollout policy adds no app UI or store-note feature.
The CI inventory records the added manual inputs and replaces its unobserved
5-minute placeholder with a conservative 30-minute cold QA allowance; run
frequency, runners and job count do not expand.
They address the observed 2026-11-03 CV1 bench/rebuild hazard; there is no shared
firmware promotion primitive today. Backend policy tests use the existing
selected-file isolated runner.

Product invariants affected

  • INV-AUTH-1
  • INV-CHAT-1
  • INV-DATA-1
  • INV-NAV-1
  • INV-MEM-4
  • INV-CAP-1
  • INV-TASK-2

The 2026-11-04 batch fold merges sixteen open PRs into this branch. Their
changes to the files under these invariant globs are comment-only purpose
headers on existing hot files (the hygiene PR), test/tooling additions, and
docs; no auth, chat, data-plane, navigation, memory-promotion, capture or
task behavior changes. The firmware release controls in this PR itself still
change no capture, storage, UI or installed flash-layout contract.

How it was verified

  • Inspected NCS 2.9.0 zip.cmake → fw_zip.cmake → generate_zip.py and build-cv1.sh.
  • Repackaged retained QA run 41504767298's real OTA zip locally; output contains
    only omi.signed.bin and manifest.json, and the app SHA-256 remains
    72cf1d2e4aacfc4e43d840a356e4f3c2abfc913be70beb600833a61d5fdf8b99.
    Evidence: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/repackage-evidence.json.
  • Traced FirmwareMixin.processZipFile → Manifest.fromJson/ManifestFile.image →
    updateManager.update and the lock-checksummed mcumgr_flutter Android/iOS
    bridges: this source path accepts a one-image list with image 0. The retained
    app has no image-dependency TLV requiring image 1.
  • No firmware build/signing, BLE install, workflow dispatch, push, secrets access
    or production changes. Single-image OTA and signed-version behavior still need
    bench qualification before any release. No GCP tier used.

Tests

  • PASS: 36 focused app tests across eight files via omi-heavy run -- flutter test
    (hashed serial query and omission, DIS serial reads, version parsing, update
    session/build policy, prompt coordination, DFU guard and third-party notes).
    Log: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/review-app-tests-final.log.
  • PASS: 20 offline firmware packaging/promotion tests via omi-heavy run --
    backend/.venv/bin/python -m pytest omi/firmware/scripts/ci/test_cv1_release.py -q.
    Covers exact-attempt selection, absent attempt artifacts, required bench hash,
    hash mismatch before promotion/publication, metadata injection across all body
    inputs, backend parser compatibility, atomic tag conflicts, tag SHA changes
    before/after draft creation, and normal/emergency rollout limits.
    Log: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/guards-firmware-tests.log.
  • PASS: 99 backend firmware tests across five focused files through backend/test.sh with
    BACKEND_UNIT_TEST_FILE_LIST (rollout, specific version, legacy DFU, version
    hardening and release pagination). Endpoint tests confirm blocked exact-version
    requests return 404 and support/revert requests can bypass rollout_percent.
    Log: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/guards-backend-tests.log.
  • PASS: omi-heavy run -- actionlint .github/workflows/firmware_release.yml.
    Log: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/guards-actionlint.log.
  • PASS: OMI_PR_BODY_FILE=/Volumes/Ephemeral/scratch/cv1-lab/ota-safety/pr.md
    make preflight through omi-heavy run -- on commit
    fa2671b79b1b70639c33dc2699720302e37ef80d: all 60 checks in 695.07s.
    Log: /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/guards-preflight-committed.log.
    Earlier attempts found a malformed UI-evidence waiver (corrected), formatting
    while checks ran (completed before the successful run), and the inherited
    app changes' missing internal changelog fragment (included in this commit).

Failure class

Failure-Class: none

This adds explicit firmware release safety controls and repairs the guards that
consume the extracted release helper and generated client. It does not claim to
close one of the registry's narrower desktop/cloud release incident classes.

UI evidence (none)

UI-Evidence: none

The app changes only pass the existing DIS serial through firmware discovery
and hash it into the device_id query parameter; no layout, copy, navigation,
widgets or visible UI changes. The generated Swift client adds an optional
deviceId query argument and imports Foundation only.

The account-scoped UI author approval still matches app/lib/pages/home/
firmware_mixin.dart and firmware_update.dart by path. UI-Evidence: none is a
truthful declaration for the separate evidence check, not a human-approval waiver.
Human review remains required and has not been requested or supplied here.

🤖 Generated with Claude Code

CI failure diagnosis and fixes (2026-11-03)

  • Backend unit shard 2/6 (run 41599046894, job 125793160518):
    test_monitoring_gmp_shadow.py::test_committed_inventory_is_current compares
    219 committed query consumers with 217 computed from the current main
    dashboards. Reproduced through backend/test.sh on origin/main
    8d621bc: 1 failed, 34 passed. The PR
    branch alone passes all 35 tests; CI checked out merge 6fe29f6 of
    ee0f30f into this same main SHA, including main's dashboard edit.
    The monitoring test, generator, inventory and dashboards are outside this PR.
    No unrelated monitoring change included. Logs: ci-monitoring-main.log and
    ci-monitoring-pr.log in /Volumes/Ephemeral/scratch/cv1-lab/ota-safety/.
  • Hygiene (run 41599046902, job 125793646146): the release-process guard
    searched firmware_release.yml for the retired shell literal
    Omi_CV1_OTA_v$VER.zip after staging/publication moved to cv1_release.py.
    The guard now verifies the executable workflow calls and conditions, stages
    synthetic MCUboot bytes through the real helper, checks the named ZIP and
    manifest, and intercepts publication to assert that the staged ZIP and both
    factory HEX assets are attached. Missing/renamed/corrupt/omitted assets and
    disconnected workflow calls fail mutation tests. No guard bypass added.
    Firmware helper/workflow paths now trigger this guard locally and in CI.
  • guard (run 41599044662, job 125793200582): GitHub Contents returns
    encoding=none for the 1,128,966-byte generated Swift client. This is an API
    source-fetch failure, not missing PR-body evidence. Fetch the exact Git blob
    SHA from immutable base/head metadata, verify size/identity/completeness, then
    scan its full Swift source under a 10 MB bound. Generated files remain in
    scope; SwiftUI/AppKit still requires approval. Incomplete or unavailable blob
    evidence fails closed. Regression tests run in both manifest lanes.
    The approval workflow uses pull_request_target and checks out trusted
    github.workflow_sha: this script fix must land on main before that privileged
    workflow uses it. A PR-head script change alone cannot clear the live check.
  • UI author approval: the app/lib/pages paths match even though the changes are
    request plumbing only. PR-body declarations do not override this human gate.
    Skipped as requested; no approval/comment or remote PR edit performed.

CI repair commits and local validation

  • 3467741: exercise the extracted firmware
    staging/publication helper in the release-process guard, cover negative
    mutations, and register the affected guards/tests in both lanes.
  • 0a16fd6: collect complete immutable Swift
    source through Git blobs above the Contents API inline limit; preserve
    generated-source scanning and fail-closed approval behavior.
  • PASS: 14 UI approval regression tests through omi-heavy; read-only live PR
    evidence collection fetches both complete generated Swift blobs and returns
    required=true, allowed=false, incomplete=false without writing a status.
    Evidence: ci-live-ui-evidence.log in the same scratch directory.
  • PASS: 20 firmware packaging/promotion tests through omi-heavy.
  • PASS: bash scripts/run-release-process-guards.sh through omi-heavy.
  • PASS: all 109 release-process guard tests through omi-heavy (241.29s),
    including ten workflow/helper mutation scenarios.
  • No push, remote PR update, human approval, firmware build, deployment or GCP
    access. No GCP tier used.
  • PASS: OMI_PR_BODY_FILE=/Volumes/Ephemeral/scratch/cv1-lab/ota-safety/pr.md
    /Users/dazheng/workspace/omi/bin/omi-heavy run -- make preflight on
    0a16fd666465f53de11f416ae39c1ad99e09ac29: all 80 checks in 2311.85s.
    This includes the new UI approval regression lane, release guard and its
    109-test suite, generated API consistency, full Swift formatting/SwiftLint,
    and both web suites. Log: ci-fixes-preflight.log in the same scratch directory.

Line-count and fold register (refreshed 2026-11-04 after the batch fold)

Line-Count-Exception: app/lib/providers/device_provider.dart | 1663 -> 1670 | hashed DIS serial device_id query param (1 code line) plus the hygiene batch's comment-only purpose header; no logic added
Line-Count-Exception: app/lib/backend/preferences.dart | 1641 -> 1648 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4613 -> 4621 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2700 -> 2707 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 3138 -> 3145 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/database/action_items.py | 1742 -> 1751 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/database/conversations.py | 4607 -> 4617 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/apps.py | 2731 -> 2739 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/chat.py | 1800 -> 1809 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/conversations.py | 2486 -> 2494 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/desktop_chat.py | 2022 -> 2032 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/developer.py | 2848 -> 2857 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/payment.py | 1970 -> 1980 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/pusher.py | 1822 -> 1832 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/sync.py | 3793 -> 3802 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/routers/users.py | 2746 -> 2754 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/scripts/check_cloud_run_env_drift.py | 411 -> 2453 | serving-revision drift check compares by value hash (22389); table-driven expansion of the checker and its helpers
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1671 -> 1674 | local scorecard projection side-hooks (23435); three added lines
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3377 -> 3387 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/utils/other/storage.py | 2765 -> 2774 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/utils/stt/streaming.py | 2616 -> 2626 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: backend/utils/subscription.py | 1825 -> 1834 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/AppState/AppState+Transcription.swift | 1759 -> 1765 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/DesktopAutomationBridge.swift | 5260 -> 5267 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarView.swift | 3037 -> 3045 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift | 5942 -> 5948 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/MainWindow/Components/ChatBubble.swift | 2162 -> 2169 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/ProactiveAssistants/ProactiveAssistantsPlugin.swift | 1951 -> 1958 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatProvider.swift | 6864 -> 6871 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatToolExecutor.swift | 3926 -> 3932 | comment-only purpose header from the hygiene batch (24260); no logic added
Line-Count-Exception: desktop/macos/Desktop/Sources/Rewind/UI/RewindPage.swift | 1705 -> 1711 | comment-only purpose header from the hygiene batch (24260); no logic added

Folded PRs (their branch tips are merged into this branch; closed as folded): #21058, #21523, #22324, #22389, #23343, #23344, #23359, #23403, #23405, #23435, #23534, #23680, #23682, #23694, #23777, #24260

Git-on-my-level and others added 30 commits October 9, 2026 17:54
Picture-first on-ramp for contributors: an animated scene of where audio goes (live, saved, lost), the real exploded view and KiCad-rendered mainboard, nine behaviour cards tied to where each lives on the board, a playable day, and the questions to ask before a pendant decision.

Mintlify does not serve raw HTML, so the page mounts as a JSX snippet; the board renders are static SVGs produced by omi/hardware/consumer/explainer/build_explainer.py from the KiCad sources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cone-mode sparse worktrees do not materialise out-of-cone paths, so a
literal trigger or command path that is real at HEAD fails
validate_manifest's working-tree existence check, and every sparse
checkout hard-fails pre-push at manifest resolution with hundreds of
'explicit trigger path does not exist' errors before any check runs.

Validate against the HEAD tree as well as the working tree: present in
either passes; absent from both still fails closed (typos unchanged).
head_tree_paths() lists HEAD once per invocation, not once per path.
…heckouts

Same class as the manifest validation fix: the registry check requires
prereg docs to exist on the working tree, and a cone-mode sparse checkout
does not materialise out-of-cone paths, so feature-flag-registry failed
in any sparse lane whose cone excludes the prereg doc. Accept a prereg
path that exists on disk or is tracked at HEAD; neither still fails.
The read scanner iterates tracked paths but skipped any file absent from
the working tree, so a cone-mode sparse checkout reported every app/web
flag as 'stale registry entry'. Read sources (and chart manifests) from
disk first, falling back to the HEAD blob; an alias with no read on disk
or at HEAD still fails. Uncommitted deletions are judged against HEAD,
which is what the pushed tree will contain.
… checkouts

The drift guard that proves registered test commands actually execute
cases read test modules from the working tree only, so a cone-mode
sparse checkout failed check-manifest-contract with 'does not exist' for
every out-of-cone test module. Read disk first, HEAD blob second; absent
from both is still an offender.
The registry audit fails every locked invariant whose guard file is
absent from the working tree, and guards live across all surfaces, so a
cone-mode sparse checkout failed product-invariants on every push.
Existence now counts the HEAD tree as well; a guard in neither still
fails closed.
…checkouts

canonical_prevention_artifact paths are guard files across every
surface; a cone-mode sparse checkout does not materialise out-of-cone
paths, so validate failed on every push from a sparse lane. Existence
now counts the HEAD tree as well; a path in neither still fails.
… checkouts

Each area scanner fails when its entry tree is missing from the working
tree. A cone-mode sparse checkout legitimately excludes whole areas
(app/, desktop/macos/agent, desktop/windows), so the ratchet failed on
every push from a sparse lane even though none of those files can have
changed there. Skip areas whose entry paths carry the skip-worktree bit
(tracked, cone-excluded): they carry no signal in this worktree and CI's
dense run still enforces them. User deletions keep their 'H' tag and
keep failing closed; a skipped area also never rewrites its baseline.
The C10 check reads docs/api-reference/app-client-openapi.json from the
working tree; docs/ is outside every code surface's sparse cone, so a
cone-mode sparse lane crashed pre-push. Read disk first, HEAD blob
second.
…outs

The lint fails when desktop/macos/e2e/flows is missing, which every
cone-mode sparse checkout without the desktop surface is. Skip with a
note when the directory carries the skip-worktree bit (tracked,
cone-excluded — dense CI enforces it); deletions keep failing.
…dapter rule

- Inventory batch-pipeline-worker-metrics in expected-targets.prod.yaml.
- Add the omi_batch_pipeline_ready_age_seconds external rule to the reviewed
  adapter upgrade expectation (diff_prod_adapter.py), rejecting any modified
  live copy.
- Contract fixture models the pre-upgrade live config and finds the listen
  rule by name instead of by list position; add exact/modified/live-drift
  tests for the new rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
run_process now constructs SynchronizedWorker(..., timings=timings); the
Sync Cloud Tasks gauntlet's CpuSynchronizedWorker override rejected that
keyword, so batch-worker-1 exited before readiness.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fetch_decode timer previously wrapped prefetch.take(), so under the
production IO concurrency it measured only the later Future.result() wait;
a decode overlapping earlier GPU work appeared nearly free. Wrap the decode
callable submitted to the prefetch executor instead, keep the no-prefetch
fallback timing decode directly, and document the measurement point.
… warm

The 'Linux package · helper smoke' job's 'Install Linux runtime
dependencies' step downloads ~35 MB of debs plus package indexes from
azure.archive.ubuntu.com on every run. When that mirror is throttled the
downloads alone exceed the step's 5-minute budget and the job dies:
run 39846837408 attempt 1 (PR #23335, 2026-10-22; the same SHA passed on
rerun with the step finishing in ~14 s), run 37693118159 (main push,
2026-10-07, every fetch Ign) and run 33911765703 (PR, 2026-09-04) all
timed out identically — an infra flake, not a regression.

Mirror the fix proven for the backend twin of this flake (#23308):
cache the downloaded .deb closure keyed on the runner image with a
restore-keys fallback across ImageVersion bumps, replay warm caches with
dpkg -i (zero network on the hot path — apt-get update fetches indexes
even when every deb is local), and keep bounded apt only as the cold
path and as repair when the replay fails. Single job, no matrix, so the
save step has no concurrent same-key race to gate.

.github is edited only for this flake's own step; no workflow is added,
per the 2026-10-22 CI flake-fix and caching direction.
The fast-unit CPU duration guard failed this file twice on CI (1.04s and
1.08s over the 1.00s fail budget; both runs passed on re-run). Each of the
four tests ran its own stub_modules + load_module_fresh pair, and the block
teardown evicts every transitively imported module (httpx and friends), so
every test re-paid the full import inside the guard's measured call phase:
0.50-0.68s CPU on a quiet runner, 0.78-1.08s under the file-isolated
runner's saturation, sitting on the 1.0s cliff.

utils.task_sync has no module-level mutable state, so one module-scoped
import shared by the four tests is behaviorally identical. The per-test
store/create_calls/fail_on move onto a mutable _Harness the stub closures
dispatch through, and each test seeds it first. The single import lands in
the first test's setup phase, which the guard deliberately does not charge
(tests/conftest.py measures the call phase only so shared file setup is not
misattributed), matching the module-scoped stub_modules pattern already
used by tests/unit/test_sync_reprocess_coalesce.py.

Measured locally (nice -n 19, guard thresholds 0.1/1.0): before, the file
warned at 0.11-0.36s CPU per test; after, no guard output at all, also with
six parallel pytest processes saturating the machine, and file wall time
1.18s -> 0.27s. Test isolation unchanged: sibling task_sync files pass in
the same process before and after this file.
The build-linux job's 'Install Linux runtime dependencies' step downloads
~35 MB of .debs from azure.archive.ubuntu.com every uncached run; when
runner<->mirror throughput degrades (~68 KB/s avg in job 120062237675)
the download alone exceeds the 5-minute step budget while every
connection keeps streaming, so the per-request apt timeouts cannot catch
it. Same signature on main 2026-10-07 (job 113037996050); the re-run of
the same job on the same PR code succeeded.

Cache the .deb archives (seed /var/cache/apt/archives, download-only,
capture, unpack) so steady-state installs download nothing but version
changes, and raise the step budget to 10 minutes to cover cold-cache
runs at the worst observed throughput (34.6 MB / 68 KB/s ~ 8.5 m). Stall
bounds and the 20-minute job ceiling are unchanged.
…rror evidence

This PR's own first run (job 120074210159) missed the apt cache (first run
with the new key) and streamed the deb pool at ~40-45 KB/s — worse than
the 68 KB/s the 10-minute budget was sized from — timing out mid-download
at Get:30 of 30 (~14.4 min of pure download needed at that pacing).

20 minutes covers ~32 KB/s effective throughput while reserving 2 minutes
for index fetch and unpack, and is idempotent for warm-cache runs, which
download nothing and finish in seconds. Note the budget must cover the
cold path even though cache misses are rare: the key hashes this workflow
file, so every edit re-cold-starts the cache.
check_cloud_run_env_drift.py now reads what is serving instead of
spec.template: Cloud Run revisions from status.traffic (resolving
latestRevision entries and split traffic) and, with --gke, the GKE
ReplicaSets that hold ready pods for backend-listen, pusher and
batch-pipeline-worker. Each serving env is compared with the manifest,
rendered deploy state or chart values by key name and by a truncated
SHA-256 of the value or secret reference. Values are never printed and
hashes of sensitive-looking keys are redacted. The report flags when the
template differs from what is serving.

Report-only by default; --strict exits 1 on drift and 2 on fetch or
render errors for use after a train. Fixtures replay the 2026-10-18
23:50Z template-versus-serving misread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eck hardening

- GKE envFrom: resolve the ConfigMaps serving containers bulk-load (live
  kubectl read or offline fixture) and join their keys in the name/hash
  comparison; missing/out-of-date keys are drift, unresolvable refs
  report INVENTORY, and live-vs-chart reference drift is flagged (P1).
- Unresolved deploy-time bindings are now presence-checked: a None
  expected hash skips only the value comparison, never the key check.
- --rendered-state must exist and contain a services mapping; no silent
  fallback to the raw manifest.
- --strict exit precedence: fetch/render errors (2) outrank drift (1);
  expected-state render failures return 2 instead of a traceback.
- Offline snapshots require a top-level env list; a statusless template
  document is refused instead of being misread as serving.
- --no-cloud-run without --gke/--gke-workload is a usage error.
- Secret-ref hashes keep the project in project-qualified references
  (cross-project rebinds are visible) and include the normalized
  optional flag.
- Published env fingerprints are built from redacted placeholders for
  sensitive keys; full fingerprints stay internal for equality checks.
…xact-state keys

- Live envFrom ConfigMap data cannot prove what already-running pods
  resolved at container start (K8s never refreshes envFrom; a ConfigMap
  update carries no trustworthy last-write timestamp). Live envFrom keys
  now report INVENTORY instead of asserting OK; offline fixtures are
  snapshots and still compare exactly (P1).
- envFrom prefix is part of the reference: a prefixed source expands to
  PREFIX_KEY and its identity carries the prefix, so rebinding cfg to
  prefix: X_ + cfg is visible reference drift, not a silent match.
- With --rendered-state, provisional env_var bindings the renderer
  omitted (unset at deploy time, incl. secret env_var resolving empty)
  are dropped from the expected set instead of being inherited from the
  raw manifest as name-only false drift.
- --cloud-run-state / --gke-state loads moved inside the handled error
  section: malformed fixtures return exit 2 under --strict, never an
  uncaught exception misread as drift.
Live GKE reads mark every envFrom ConfigMap reference unproven, so the
flat skip dropped all manifest ConfigMap keys from the value comparison —
including keys the serving ReplicaSet sets through explicit env entries,
whose values are knowable (explicit env shadows envFrom; the serving
spec is immutable). A stale serving literal on an overlapping key such
as STT_SERVICE_MODELS could therefore pass --strict with only INVENTORY.

ServingTarget now records its explicit env key names and the per-target
skip excludes them: keys whose effective value comes exclusively from
envFrom keep the INVENTORY downgrade, shadowing keys are compared by
hash like any other explicit entry.
…ptional-aware identities

Review round 3 (Codex P2 x4) on the GKE envFrom provenance model:

- Live-only drift now excludes every key contributed by an unproven envFrom
  source on that target, not only keys already declared expected: a ConfigMap
  key added after the ready pods started must not read as unallowlisted
  live-only drift.
- Expected ConfigMap keys expand with the reference's prefix: the
  `name#prefix` identity is parsed instead of compared with the bare ConfigMap
  name, so a prefixed chart reference is resolved, not reported unresolved
  with phantom live-only keys.
- envFrom references are compared per serving target instead of as a union:
  during a mixed rollout a still-serving ReplicaSet without the reference no
  longer hides behind the new ReplicaSet's matching reference, and expected
  envFrom keys are excused only on targets that hold the degraded reference.
- configMapRef optionality joins the reference identity (omitted normalizes to
  false): `optional: true` on the serving side is reference drift, because it
  changes what a missing ConfigMap does to the pod.
Review follow-up: a rendered state whose top-level services mapping omits a
manifest service, or carries a non-mapping entry for it, silently fell back
to the raw manifest for that service. Deploy-time env_var bindings then
degraded to name-only checks while the command claimed exact-state
validation. Every manifest service must now have a valid rendered entry.
Review follow-up round 2:

- A rendered state service entry without an env list (missing, null, or
  non-list) is rejected instead of silently re-sourcing expected values from
  the raw manifest; the renderer always emits an env list per service.
- envFrom reference order is now compared: the K8s API resolves the last
  envFrom source when several export the same key, so a reordered reference
  list changes the effective environment and is reported as reference drift
  instead of passing as the same set. Multi-source envFrom key merging in
  envfrom_entries() follows the same last-source-wins rule.
… optional refs

Review follow-up round 3:

- Malformed entries inside a rendered env list (null, non-mapping, missing
  name) are rejected instead of silently skipped: the renderer only emits
  named mappings, and skipping would keep the manifest expectation for the
  corrupted key while reporting OK.
- --allowlist-file loading moves inside the operational-error boundary: a
  missing or malformed allowlist is an exit-2 input failure, not drift and
  not a traceback.
- Duplicate envFrom sources are preserved end to end: K8s resolves the last
  source for overlapping keys, so [A, B, A] and [A, B] are different
  effective environments and must not normalize to the same reference tuple.
- An optional envFrom reference whose ConfigMap is NotFound live resolves to
  an empty unproven contribution (INVENTORY) instead of a workload-wide
  fetch ERROR: K8s permits the pod to run without it.
…efs, accept deployed helm args

- Missing-key suppression now covers only the keys a degraded expected envFrom
  reference contributes (tracked per reference), so a snapshot that proves
  ConfigMap A while omitting B still reports keys missing from the proven A
  instead of skipping the whole expected envFrom set.
- The template-vs-serving comparison includes the ordered envFrom identities:
  rebinding ConfigMap A to B with identical data no longer passes as
  "Template = serving: yes".
- Expected GKE renders accept the exact deployed override inputs via
  --gke-helm-arg / --gke-helm-arg-file (the argv format the listen deploy
  workflow writes), so an intentionally overridden rollout is not reported as
  drift against repository defaults.

All three covered by regression tests that fail on the previous code.
…lues from helm failures

- Override arguments (--gke-helm-arg / --gke-helm-arg-file) are now scoped to a
  single workload via --gke-helm-arg-workload (default backend-listen, the argv
  file's producer): an argv generated from one chart's env indices must not be
  applied to a different chart, where the same index can name another variable
  or fail the render.
- A failing helm template no longer surfaces CalledProcessError's default str()
  (full argv, including literal --set-string values) into markdown/JSON/summary
  reports; the error is re-raised redacted.

Both covered by regression tests that fail on the previous code.
# Conflicts:
#	app/lib/pages/conversation_detail/conversation_detail_provider.dart
#	app/lib/services/capture/capture_controller.dart
…locked_byok row metric the fold's merges dropped
…the embedded script (CodeQL Bad HTML filtering regexp)
@Git-on-my-level
Git-on-my-level merged commit edc5dff into main Nov 4, 2026
68 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/cv1-release-safety branch November 4, 2026 16:34
Git-on-my-level added a commit that referenced this pull request Nov 8, 2026
…venance tests (#24912)

<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_

## What changed and why

Restores main to green.
`backend/tests/unit/test_batch_pipeline_startup.py::test_pyannote_pair...`
expected the message "pyannote pair requires the GPU image", but
`backend/diarizer/batch_pipeline_startup.py` raises "pyannote pair
requires the model runtime". The wording changed in #24477 (commit
edc5dff), which changed the code and not the test. The batch-worker
message in the same file still reads "requires the joint GPU image", and
its test is unchanged.

This PR also updates two stale assertions in
`backend/tests/unit/test_feedback_task_provenance.py`. The feedback tool
now reports a foreign conversation as "Conversation ... not found", the
wording the tombstone change (153a943) introduced on purpose. Both
tests still check that the tool reports an error and writes nothing, and
the new wording keeps that: a foreign conversation is refused without
revealing that it exists.

No code changes.

## Product invariants affected

None. Test wording only.

## How it was verified

`backend/tests/unit/test_batch_pipeline_startup.py`: 11 passed.
`backend/tests/unit/test_feedback_task_provenance.py` and
`backend/tests/unit/test_source_audio_listing.py`: 25 passed. All in the
task worktree's backend venv.

## Tests

The updated assertion is the pyannote-pair guard test. It now matches
the message the code raises.

## UI evidence

Not applicable.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24912?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/24912?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24912&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. -->
TomHacker69 pushed a commit to TomHacker69/omi that referenced this pull request Nov 8, 2026
…rd test

BasedHardware#24477 changed the raised message to 'pyannote pair requires the model runtime'
and left this test expecting the old 'GPU image' wording, which fails the
Backend unit shard on main. Match the current message.
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