Repository navigation
M3 final round 2: merge main (54063157) into integration - #23133
Conversation
…le Check Two mobile-app-checks infra flakes from 2026-10-21, both failing outside any product code: Android: every Gradle-configuring mobile job (compile-smoke, unit-tests, emulator acceptance) auto-downloaded NDK 28.2.13676358 inside Gradle configure via AGP, which has no retry. A truncated dl.google.com response failed the job with "Error on ZipFile unknown archive" (runs 39506049904, 39469917718, 39626150998; dead 5 s into a download that takes ~22 s when healthy). All three jobs now pin NDK_VERSION in job env (equal to build.gradle's ndkVersion fallback, asserted by test_mobile_ci_infra_guards.py), restore the extracted NDK from one shared actions/cache key, and preinstall through install_android_ndk.py, which verifies the install, purges partial NDK + sdkmanager temp state, and retries once with a 10-minute per-attempt timeout. Only the emulator job saves the cache: it runs in every event the readers do, and compile-smoke keeps post-job saves off the Mobile App Checks wall. On a cache hit the jobs make no NDK request to dl.google.com at all. iOS: the 40-minute job ceiling sat below the measured cold path - 39:25 of real steps plus the ~1 min post-job Post Setup Flutter cache save (run 39634604539 attempt 1) - so a healthy cold job reported cancelled after every real step passed and Mobile Release Eligibility aggregated the failure. The ceiling moves to 50 with the measurements recorded in the workflow comment; the CI budget check counts p50 (19 min, unchanged), not the ceiling. Adds the mobile-ci-infra-guards and mobile-ci-ndk-installer manifest checks covering both guards. The timeout move is registered as a pinned exception in scripts/ci/test_nightly_main_workflow.py (nightly-graph budget guard), which asserts the exact new ceiling so any later drift still fails.
…gible_reason label (P34 follow-up) Lead rulings 603b95 and f12e4a, follow-up to the P34 local-delivery split. - replay_delivery: a live tail write still blocked when the frame's residence deadline passes (the unpaced initial-leg case: a blocked ws.send never raises AudioDeliveryExpired) latched no local reason and fell to connection_lost, which votes on the provider serve-failure circuit and counts as provider failure while the vendor socket stayed open. Any unconfirmed write with the connection alive now latches delivery_expired (censored, no circuit vote). - demand telemetry: omi_listen_demand_exhausted_sessions_total gains the bounded ineligible_reason label - the first failing admission condition (recovery_off / unmanaged_chain / onboarding / phone_call / language_unqualified / no_profile; none for eligible cohorts) - so the ~300/10m ineligible sessions hitting chain_exhausted can be split by exclusion. capture_demand_admission's eligibility conjunction is untouched.
…o 50 backend/tests/unit/test_workflow_contracts.py asserts the iOS Compile Check timeout literally; it still said 40 after the ceiling moved to 50 (PR run 39654485678, backend unit shard 1/6). No other test pins the value: the mobile-ci-infra-guards contract and the nightly budget exception already assert 50.
…s metric Review of the P34 follow-up (Luna, SHIP, minor): a batch preview can move an admitted session into the ineligible cohort after admission with no exclusion reason, so that session closes on the (ineligible, none) series; it was not pre-initialized, so increase() would read its first burst as zero.
…mpts in 25 min Review round 1 (SHIP, two P2 findings) on #23084: - A per-attempt timeout killed only the cmdline-tools sdkmanager wrapper, not the Java worker it spawns without exec, so a stalled extractor could keep writing into the tree the retry purges. sdkmanager now runs in its own session and the timeout kills the whole process group; the hung- attempt test records the worker's pid and asserts it is gone. - A 600 s per-attempt cap did not fit the 25-minute Android Compile Smoke and JVM ceilings if the first attempt hung (600 s + ~22 s retry + ~20 min body > 25). The cap is 240 s: two attempts cost at most 8 min next to the ~13 / ~9 minute p50 bodies, still ~3 MB/s for a slow CDN day. - sdkmanager receives --sdk_root=<android-home>, so it installs under the root this script verifies and purges even when --android-home diverges from $ANDROID_HOME (tested against a divergent environment). - The writer-covers-readers guard now asserts each reader job's whole `if` is contained in the writer's, not only its event-name literals.
…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.
…es stop looping Intake stores rule-settled review fragments with discarded=True. When the first-summary wake for such a row runs, _reprocess_conversation_after_update re-derives the discard verdict and calls discard_by_relevance, which returns False because the row is already hidden. The callback then returned None without a discard receipt, and with FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED (prod since #22099, 2026-10-18) reprocess.run raised FirstSummaryCallbackPending: a 409, a Cloud Tasks retry with backoff, and the same result on every attempt. After the attempt cap the sweep re-created the wake. Before the flag the same path silently deleted the obligation. On 2026-10-21 backend-sync logged ~3,000 callback_pending retries per hour (2,990 of 3,000 sampled enrichment outcomes), every non-OK response on sync-jobs-fresh was an sr- task on its 4th-10th attempt, and the outbox held 4,839 fresh-lane and 4,792 backfill-lane obligations overdue for 4h+ with no lease and no deferral. Those retries share the queue that carries every real first summary. The read predicate derives `discarded` for every uncurated review row, so the callback cannot tell a stored discard from a refused write by looking at the row. database.conversations.rule_discard_outcome now reports the write's own outcome: `discarded` on a write, `already_discarded` for a stored hide (no cache or index side effects), else `refused`. discard_by_relevance keeps its True-only-on-write contract for the relevance backfill script. The pipeline receipts both `discarded` and `already_discarded`; a refusal (revised, curated, deleted) still leaves the obligation for the next attempt to re-read.
…the NDK Review round 2 (FIX-FIRST, one P2) on #23084: after SIGKILLing the sdkmanager process group, Popen.wait reaps only the wrapper, so the retry's purge could start while a worker was still draining out of the run queue. The timeout path now polls the group with signal 0 (bounded at 10 s) until every member is gone before the purge and retry. The hung-attempt test's fake records whether its non-exec'd worker still exists when the retry invocation starts and asserts it is gone.
…gible_reason label (P34 follow-up) (#23087) ## Summary Two lead-ruled follow-ups to #23074 (P34). (1) `replay_delivery.py`: a live tail whose write is still blocked when the frame's residence deadline passes — the unpaced-initial-leg case, where a blocked `ws.send` never raises `AudioDeliveryExpired` — previously latched no local reason and fell to the default `connection_lost`, which votes on the provider's serve-failure circuit and counts as provider failure while the vendor socket stayed open (review of #23074, lead ruling 603b95: "local stall must not vote the circuit or count as provider failure"). The `clock() < packet_deadline` half of the guard is dropped; any unconfirmed write with the connection alive latches `delivery_expired`. (2) Lead ruling f12e4a: `omi_listen_demand_exhausted_sessions_total` gains a bounded `ineligible_reason` label — the first failing admission condition (`recovery_off` / `unmanaged_chain` / `onboarding` / `phone_call` / `language_unqualified` / `no_profile`, `none` for the eligible cohorts) — because ~300/10m ineligible sessions are the only cohort hitting `chain_exhausted` and the cohort alone cannot say which exclusion they share. ## Behavior change Deliberate and lead-ruled, scoped to one branch: the residence-deadline tail stall now reports `delivery_expired` (censored, no circuit vote, no provider-failure attribution) where it reported `connection_lost` (attributable, circuit-opening). The label change is telemetry-only: `capture_demand_admission`'s eligibility conjunction is untouched; `ineligible_reason` only names why a session already judged ineligible is in that cohort. ## How to read it - The stall: `sum by (reason) (increase(omi_fallback_total{job="backend-listen-metrics",component="stt_live_session"}[10m]))` — the residence-deadline case now lands in `delivery_expired` instead of `connection_lost`. - The exclusion split: `sum by (ineligible_reason, outcome) (increase(omi_listen_demand_exhausted_sessions_total{job="backend-listen-metrics",demand_cohort="ineligible"}[10m]))` (outcome=yes means the session also exhausted its selection/recovery hop). - Zero children exist for every reason from pod start. ## Lane / contract Lane soniox-telemetry (P34 follow-up; rulings 603b95 + f12e4a). Contract row in `swarm/contracts.md`: `omi_listen_demand_exhausted_sessions_total ineligible_reason`. Owner sign-offs for other lanes' files: none needed. ## Product invariants affected none ## Verification `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST` (13 files, unit layer, under `omi-heavy`, 4 workers): new `test_unpaced_tail_write_blocked_through_residence_deadline_is_local_not_provider_death` (reproduced the reviewer's scenario failing before the fix: `typed_death_reason` was None with the vendor alive), the demand-telemetry suite extended (first-failing-condition mapping incl. `no_profile`, bounded labels, zero children, `finish()` carries the reason). Not run: the full backend suite, any live or prod check. ## Rollback Revert the PR. No flags, no data migration. Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23087?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/23087?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23087&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. -->
…nds inside its wall A full replay prefix was exactly REPLAY_PREFIX_SECONDS of audio delivered at exactly the endpoint rate into a wall of the same length. The whole budget was spent by construction: the last 16 KiB packet is admitted at 19.968s and must be written and observed by the 10ms poll before 20.000s. Any late write confirm on that packet, or one rebased slot earlier, rejected the successor as `replay_send_stalled` (pre-P34: `capacity_full`) while the pump slept and the listen pod sat idle. On 2026-10-21 ~1,050 prefixes/day landed in the `omi_stt_replay_wall_seconds` 20–25s bucket (7–15% of near-full prefixes per provider pair, including successor=parakeet where no network write exists), and the mean prefix was 14–18.5s, so near-full prefixes are the norm. `bounded_snapshot` now retains `(wall - margin) * rate` seconds of audio (`LISTEN_REPLAY_PREFIX_MARGIN_SECONDS`, default 1.0; `0` restores the exact wall prefix). The wall itself is unchanged, so the margin is slack, and the adopted live tail starts 1s further from its 26s bound. The cut comes off the oldest unanswered second and is metered in `omi_stt_replay_skipped_seconds_total` like any budget cut. Tests simulate the death with the real Modulate adapter over a slow-ack fake transport on the virtual clock: with margin 0 a 50ms final confirm rejects the prefix (queue high-water <= 2, 39 of 40 packets written) and a 10ms one survives; with the default margin a final confirm up to ~0.9s lands inside the wall, a 1.5s one is still rejected, and a sustained sub-realtime transport is still rejected. Existing replay pins move from 20s/115s/40 packets to 19s/116s/38 (and 9.5s at a declared 0.5x rate). Rollback: set LISTEN_REPLAY_PREFIX_MARGIN_SECONDS=0 on listen, or revert. Failure-Class: new
…es stop looping (#23092) ## Summary Sync intake stores rule-settled "review" fragments with `discarded=True`. When the first-summary wake for such a row runs, `_reprocess_conversation_after_update` re-derives the discard verdict and calls `discard_by_relevance`, which returns `False` because the row is already hidden. The callback then returned `None` with no discard receipt, and with `FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED` (prod since #22099, 2026-10-18) `reprocess.run` raised `FirstSummaryCallbackPending` → HTTP 409 → Cloud Tasks retry with backoff → the same result on every attempt; after the attempt cap the 2-minute sweep re-created the wake. Before the flag the same path silently deleted the obligation. On 2026-10-21 backend-sync logged ~3,000 `callback_pending` retries/hour (2,990 of 3,000 sampled enrichment outcomes), every non-OK response on `sync-jobs-fresh` was an `sr-` task on its 4th–10th attempt, and the outbox held 4,839 fresh-lane + 4,792 backfill-lane obligations overdue ≥4h with no lease and no deferral. Those retries share the queue that carries every real first summary (P44 write-up: `data/run-2026-10-13-two-lane-nemotron/first-summary-finished-at-2026-10-21.md` in the workspace repo). The read predicate derives `discarded` for every uncurated review row, so the callback cannot tell a stored discard from a refused write by looking at the row; only the write's own outcome can. `database.conversations.rule_discard_outcome` now reports `discarded` (a write; cache/index side effects run), `already_discarded` (stored hide; no side effects) or `refused` (deleted, revised, curated, non-completed, missing). `discard_by_relevance` keeps its True-only-on-write contract for `scripts/conversation_relevance_backfill.py` and `test_people_stats_cache`. The pipeline receipts both `discarded` and `already_discarded` (the relevance metric is recorded only for a real write); a refusal still leaves the obligation for the next attempt to re-read, as before. ## Lane / contract Lane first-summary (P44 brief, two-lane program); contracts: none. No other lane's files edited. ## Product invariants affected none (no locked path touched). ## Verification Layer: unit (synthetic fixtures), m5, `nice -n 19`, `BACKEND_PYTEST_WORKERS=4`, via `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST`: - Directly affected files, 210 passed: `test_sync_reprocess_coalesce.py` (91; +3 new: the pipeline receipts an intake-discarded fragment without a second write, with and without a process context; an admitted obligation on such a row settles `processed` through the real callback instead of raising `FirstSummaryCallbackPending`; the existing persistence test now also asserts the relevance metric count), `test_rule_discard_visibility.py` (44; +2 new: the real DB function against the strict Firestore fake receipts a stored discard without rewriting it, and `rule_discard_outcome` distinguishes `discarded` / `already_discarded` / `refused` with exactly one cache invalidation), `test_owner_recognition_telemetry.py` (23), `test_people_stats_cache.py` (52, unchanged contract). - Neighbouring consumers, 720 passed: relevance backfill, free-tier matrix, mobile client journeys, owner-identity telemetry, sync cross-job assignment, enrichment custody, fragment visibility, lineage allowlist/dedupe/recording, minimal redrive, `test_sync_v2`, summary delivery, summary persistence. - `scripts/backend-python-format --check` clean on all six files. - NOT run locally: the full backend unit suite (CI selects it because `database/conversations.py` changed), integration/emulator suites, and any live layer. No deploy; the fix is dark until the next train. ## Rollback Revert. No flag: the new tri-state is internal to the discard write; `discard_by_relevance` is unchanged for its callers. Failure-Class: FC-permanent-write-rejection-retried-forever Line-Count-Exception: backend/database/conversations.py | 4475 -> 4501 | rule_discard_outcome must live beside discard_by_relevance: the strict-store tests monkeypatch this module's db, cache and index seams, and the relevance backfill keeps the bool wrapper Line-Count-Exception: backend/utils/sync/pipeline.py | 3644 -> 3647 | the rule-discard branch of the callback that owns it now branches on the write outcome <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23092?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/23092?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23092&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. -->
…adow runbook (#23088) ## 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_PERCENT` stays **0**. - **New `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** (SIGTERM starts the drain directly), Silero model at the image's baked `EDGE_VAD_MODEL_PATH=/models/silero_vad.onnx`, the listen chart's `privateEnv` pattern for `EDGE_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-listen` values plumbing**: `EDGE_SHADOW_URL` = the in-cluster edge `/v1/shadow`, `EDGE_SHADOW_TOKEN` committed empty (privateEnv-overridable through `LISTEN_PRIVATE_VALUES_YAML`), `EDGE_SHADOW_PERCENT: "0"` in the **prod values only** — `scripts/check_feature_flag_registry.py` allows exactly one declaration of a ramp key, so dev relies on the code default 0. - **Runbook `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, the `edge_shadow_gate.py` gates (agreement ≥ 99.5%, coverage ≥ 95%, open-offset p95 ≤ 32 ms, ≤ 7.92 ms per audio second), rollback, invariants. - `backend/docs/feature-flag-registry.md` regenerated (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 `.github` change. ## Product invariants affected none (no locked path; `backend/charts/listen-edge` and `backend/charts/backend-listen` are not INV-locked). ## How it was verified Repository `BasedHardware/omi`, branch `lane/p41-d2` at `1ccaa70a90`, base `origin/main`. All local commands ran under `bin/omi-heavy run -- nice -n 19`. - `helm template` of the chart with prod and dev values, by digest and by tag; untagged render refused (`image.tag is required`). Rendered Deployment carries grace 40, no `lifecycle`, the env set above, `privateEnv.EDGE_SHADOW_TOKEN` replaces 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 when `EDGE_SHADOW_PERCENT` was in both listen values files — hence prod-only). **Layer: repo check.** - `cargo test --locked` in `backend/edge` (unchanged crate, pinned 1.99.1 toolchain): **52 passed, 0 failed**. **Layer: unit.** Note `backend-edge.yml` is path-filtered to `backend/edge/**` and does not run on this PR because the crate is untouched. - Offline replay "through the rendered config": rendered the prod chart, asserted its `EDGE_VAD_MODEL_PATH` equals the path `backend/edge/Dockerfile` bakes the model at, then `cargo run --release --bin edge-shadow-replay` with that same source model file over the 3 committed shadow fixtures: all `completed`, `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=false` drops 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_URL` alone mirrors nothing (`maybe_start` requires percent > 0). Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23088?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/23088?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23088&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. -->
…le Check (#23084) ## Summary Kills the two mobile CI infra flakes from 2026-10-21 (both filed as CI debt on the rollout bus), using existing workflows only — no new workflow. ### 1. Android: preinstall + cache the pinned NDK (corrupt-download flake) Every Gradle-configuring mobile job — **Android Compile Smoke**, **Android JVM Unit Tests**, **Android Emulator Acceptance** — auto-downloaded NDK 28.2.13676358 inside Gradle configure via AGP, which has **no retry**: one truncated dl.google.com response failed the job before any app code ran (`Error on ZipFile unknown archive`; runs 39506049904, 39469917718, 39626150998 — dead 5 s into a download that takes ~22 s when healthy; four hits in 48 h). - All three jobs pin `NDK_VERSION` in job env — the same variable `app/android/app/build.gradle` already resolves for `ndkVersion`. - Each job restores the extracted NDK under one shared cache key (`${{ runner.os }}-android-ndk-<version>`); only the Emulator job **saves** it (it runs in every event the readers do, and compile-smoke keeps post-job cache saves off the Mobile App Checks wall). - Each job preinstalls via `.github/scripts/install_android_ndk.py`: verifies the install from `source.properties`, purges the partial NDK dir + `$ANDROID_HOME/.temp`, retries once, 4-minute per-attempt timeout that kills sdkmanager's whole process group (the wrapper does not exec its Java worker), and passes `--sdk_root` so sdkmanager writes under the root the script verifies. Two attempts cost at most 8 min, which fits the 25-minute compile-smoke/JVM ceilings next to their ~13/~9 min p50 bodies. - On a cache hit the jobs make no NDK request to dl.google.com at all. ### 2. iOS Compile Check: ceiling 40 → 50 (post-job cache save was cancelled) Run 39634604539 attempt 1 (PR #23068): real steps finished at **39:25** (16:12 manifest checks + 16:27 Xcode build, cold), then the post-job `Post Setup Flutter` cache save (59 s measured on the sibling success run 119312386446) hit the 40-min ceiling. The job reported **cancelled after every real step passed**, and Mobile Release Eligibility aggregated it as a failure. 50 keeps the wedge-guard above that measured cold path. The CI budget check counts p50 (19 min, unchanged), not the ceiling — `check_ci_budget` passes unchanged. ### 3. Contract tests (two new manifest checks) - `mobile-ci-infra-guards` — workflow invariants: the NDK pin equals build.gradle's `ndkVersion` fallback in all three jobs; exactly one NDK cache step per job under the shared key; exactly one cache writer whose event set covers every reader's; the installer invoked through an explicit `python3`; the iOS ceiling stays at 50. - `mobile-ci-ndk-installer` — installer behavior against a fake sdkmanager: present → skip; first-attempt success never retries and pins `--sdk_root`; corrupt first attempt is purged and retried once; double failure exits nonzero; a stale revision is not "installed"; a hung attempt has its whole process group killed (the fake's non-exec'd worker pid is proven dead) and recovers on retry; missing `ANDROID_HOME` is a usage error; `--android-home` wins over a divergent `$ANDROID_HOME`. ## Product invariants affected None — CI configuration, one CI helper script, and contract tests under `.github/` only. No product path changes. ## Failure class Failure-Class: FC-gate-timeout-below-cold-cost The iOS fix is exactly this class's contract: a fixed time budget must exceed the worst-case healthy cold cost, and the static timing-contract test (`mobile-ci-infra-guards` asserts the 50-min ceiling) keeps the value from silently regressing below the cold path again. ## Verification (this worktree, base aa7e1d6) - `run_checks.py --lane local` — 8/8: `mobile-ci-infra-guards` 4/4, `mobile-ci-ndk-installer` 8/8, `deferred-work-markers`, `workflow-checkout-stall-bounds`, `workflow-apt-network-bounds`, `ci-budget` ("CI budget check passed"), `main-push-ci-economy-contract` 7/7, `desktop-swift-ci-contract` 52/52. - Standalone: `test_check_ci_budget` 12/12; manifest validation via `run_checks` (both new entries SELECTED). - `actionlint` on `mobile-app-checks.yml`: clean. ## Notes - No deploy needed (CI config only). - The 14:52Z "in_progress after Complete job" anomaly on Generated Files / CodeQL Rust (~23 min of status lag at 14:37:37Z → ~15:00Z, then PASS) is GitHub-side status propagation (community discussions 15133 and 125013), not repo-fixable; documented in the rollout run records.
A healthy demand handover (demand_switch.py) replays the whole unanswered ring uncut and refused only past the exact 20s wall, so exactly-the-wall capture could still miss the wall at 1x and reject the candidate, bypassing the new margin. Its refusal threshold is now the same wall-minus-margin the failure path holds back; past it the healthy source keeps serving (refuse, never cut). The default 15s hidden dwell still fits. Pinned: 19.0s admitted, 19.5s and 20.0s refused with the source retained.
…nds inside its wall (#23108) ## Summary A full replay prefix was exactly `REPLAY_PREFIX_SECONDS` (20 s) of audio delivered at exactly the endpoint rate (1.0×) into a wall of the same length, so the budget was spent by construction: the last 16 KiB packet is admitted at 19.968 s and has to be written and observed by the 10 ms poll before 20.000 s. Any late write confirm on that packet — or one rebased slot earlier — rejected the successor as `replay_send_stalled` (pre-P34: `capacity_full`) while the pump slept in its own pacer and the listen pod sat idle. On 2026-10-21 about 1,050 prefixes/day landed in the `omi_stt_replay_wall_seconds` 20–25 s bucket (7–15 % of near-full prefixes per provider pair, including `successor=parakeet` where no network write exists), and the mean prefix was 14–18.5 s, so near-full prefixes are the norm. Replay queue high-water never exceeded 4 packets, so this was never the 2000-packet queue or a stalled transport. `bounded_snapshot` now retains `(wall − margin) × rate` seconds of audio, margin from `LISTEN_REPLAY_PREFIX_MARGIN_SECONDS` (default 1.0; `0` restores the exact-wall prefix). The wall itself is unchanged, so the margin is pure slack, and the adopted live tail starts 1 s further from its 26 s bound. The cut comes off the oldest unanswered second and is metered in `omi_stt_replay_skipped_seconds_total` like any budget cut. Evidence and the wider local-delivery-death analysis: `omi-workspace data/run-2026-10-13-two-lane-nemotron/local-delivery-deaths-2026-10-22.md` (P47, label `delivery-deaths`). Branch `lane/delivery-deaths` into `main`. ## Lane / contract P47 `delivery-deaths` (two-lane rollout swarm); no shared contract rows touched (no new metric names, labels, or outcome tokens). Owner sign-offs: none needed — only `replay_delivery.py`, `config/live_stt_replay.py`, their tests and the operational doc. ## Product invariants affected none ## Verification Layer: backend unit tests, virtual clock, no live vendor. All run through `bin/omi-heavy run -- … backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST`, `nice -n 19`: - New `tests/unit/test_replay_prefix_wall_margin.py` (27 tests): the real `SafeModulateSocket` with recovery writer pacing over a slow-ack fake transport pumps a full-ring prefix through `replay_chunks`. Margin 0: a 50 ms final write confirm rejects the prefix with `replay_send_stalled` / `replay wall budget exhausted` (40 packets admitted, 39 written, queue high-water ≤ 2); a 10 ms one survives. Default margin: a final confirm up to ~0.9 s lands inside the wall, a 1.5 s one is still rejected, and a sustained sub-realtime transport (0.9 s per 0.512 s packet) is still rejected. `bounded_snapshot` shapes (wall, rate, margin) and env parsing (default, `0`, clamp, garbage) are pinned. - Existing replay pins updated from 20 s / 115 s skipped / 40 packets to 19 s / 116 s / 38 (and 9.5 s at a declared 0.5× rate), expressed from the config constant: `test_live_recovery_matrix.py` (97 passed), `test_live_replay_provider_pairs.py` (31), `test_live_stt_resilient_stream.py` (28). - All 24 unit files importing `live_stt_replay`, `replay_delivery`, `resilient_stream`, `bounded_snapshot` or `replay_chunks` pass (including P34's `test_soniox_local_delivery_deaths.py`, `test_parakeet_window_live.py` 200, `test_live_recovery_canary_regressions.py`, `test_live_recovery_pacing.py`). - Review round 1 (Luna, P2): the healthy demand handover (`routers/listen/demand_switch.py`) replays the whole unanswered ring uncut and refused only past the exact 20 s wall, bypassing the margin. Its refusal threshold now uses the same wall-minus-margin; past it the healthy source keeps serving (refuse, never cut). `test_live_demand_switch.py` (20 passed): 19.0 s admitted, 19.5 s and 20.0 s refused with the source retained and not dead; the default 15 s hidden dwell still fits. NOT run: the full backend suite (the selector falls back to all 2,126 files for a `config/` change; CI runs it), staging, or any live listen pod. ## Rollback Set `LISTEN_REPLAY_PREFIX_MARGIN_SECONDS=0` on the listen deployment to restore the exact-wall prefix without a code deploy, or revert this PR. Nothing persisted; no schema, metric or label change. ## Failure class Declaring `new`: **FC-wall-budget-equals-paced-work-duration** — a fixed wall budget that bounds work delivered at a fixed pace must exceed that work's duration at that pace; sizing the work to the whole budget leaves only scheduler/write-confirm jitter as slack, so a healthy, keeping-up delivery is rejected as a local capacity failure. Root cause: `bounded_snapshot` kept `min(REPLAY_PREFIX_SECONDS, wall) × rate` seconds while `replay_chunks` gave it `min(wall, REPLAY_PREFIX_SECONDS)` of wall, and `_next_audio_slot` never earns catch-up credit, so the last packet's slot sits 32 ms before the wall. Durable guard: the margin is an explicit config primitive and the knife edge is pinned by the virtual-clock simulation (exact wall must fail on a 50 ms confirm; margined must pass), so the budget cannot silently return to equality. Why not a shared primitive: the pacer and the wall are already shared (`ReplayPacer`, `replay_chunks`); the missing piece was the sizing rule, which now lives in the one function that sizes the prefix. Failure-Class: new
…ldown (#23085) * fix(dream): resume model calls across reservation capacity bursts Retry the pending planner/verifier call within the existing session and deadline, with bounded jitter and fresh lease, capacity and per-attempt budget checks. Use a 10-second local/shared 3.8 saturation cooldown while retaining legacy policy. Settle known-zero rejections and preserve reported or conservative attempt usage. Cover burst recovery, peer cooldowns, budget settlement, deadlines and cancellation. Failure-Class: none Co-Authored-By: Codex Sol <[email protected]> * fix(dream): exclude zero-cost retries from turn accounting Release known-zero attempt minute holds without persisting a receipt or consuming the receipt cap. Preserve billed and unknown usage accounting. Record model lanes only after a completed model call so retries do not inflate reported turns. Cover 64-turn heavy passes with repeated bare 429s and no-dispatch waits, including exhausted retries, and full receipt-cap billing boundaries. Validation: backend/test.sh, eight targeted files, 589 passed and one deselected; final retry suite rerun passes the CPU duration guard. Co-Authored-By: Codex Sol <[email protected]> * test(dream): keep the drain-deadline test budget at 0.5 s for loaded CI runners Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(dream): count a model turn once its transport completes Counting lanes only on a clean return dropped completed calls whose payload then failed to parse, which made the canary read a healthy malformed-verifier response as a model failure. Count on return, or once the transport completed; zero-cost capacity retries never complete and stay uncounted. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Codex Sol <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Main moved 16 commits past 34ce402 while #23096 ran CI; the only conflict was the generated backend/docs/feature-flag-registry.md, re-rendered as of 2026-10-21 (check_feature_flag_registry.py passes). CI budget vs main and the label ratchet pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
…ichment callback (M3 final round 2) Main 4c7ccd0 switched the legacy copy (utils/sync/pipeline._reprocess_conversation_after_update) to lifecycle_service.rule_discard_outcome so admitted first-summary wakes stop looping on review rows; test_enrichment_callback_parity requires the C2 enrichment copy to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the CPU guard (2nd trip) 1.16-1.28s CPU on integration CI shard 2 in two consecutive runs of #23133 (0.25s locally; green on main's shards). Second trip -> allowlist per the lane-1 flake policy, with a removal note. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d062ad3cf
ℹ️ 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 | ||
| label = the checked-out SHA). Blank input leaves the listen-edge release | ||
| untouched — re-pass the same digest to apply a chart-only change. |
There was a problem hiding this comment.
Wire listen-edge into the claimed deploy workflow
The documented deployment path does not exist in the current tree: .github/workflows/gcp_backend_listen_helm.yml has no listen_edge_image_digest input, does not read LISTEN_EDGE_PRIVATE_VALUES_YAML, and only runs Helm against backend/charts/backend-listen; its push filter also excludes this new chart. Consequently, dispatching the workflow as instructed cannot create or update listen-edge, blocking the D2 rollout and its digest-based rollback.
Useful? React with 👍 / 👎.
| def pid_is_gone(pid: int, wait_seconds: float = 5.0) -> bool: | ||
| deadline = time.monotonic() + wait_seconds | ||
| while time.monotonic() < deadline: | ||
| try: | ||
| os.kill(pid, 0) | ||
| except ProcessLookupError: | ||
| return True | ||
| except PermissionError: | ||
| return False | ||
| # A SIGKILLed orphan stays a zombie until init reaps it; keep polling. |
There was a problem hiding this comment.
Treat killed zombie workers as exited
On containerized runners whose PID 1 does not promptly reap orphaned children, the SIGKILLed fake worker remains a zombie, so os.kill(pid, 0) continues succeeding even though it cannot write anything. I reproduced this with python3 .github/scripts/test_install_android_ndk.py: the worker was [sleep] <defunct> and this assertion failed after the installer had already waited ten seconds, making the newly registered CI check environment-dependent. Detect zombie state as terminated rather than requiring the PID to disappear.
Useful? React with 👍 / 👎.
| if current.get('discarded'): | ||
| return 'already_discarded' |
There was a problem hiding this comment.
Check the revision fence before accepting an existing discard
When a callback reads revision N of an already-discarded review row and a concurrent sync append advances the stored row to N+1 before this transaction, this early return reports already_discarded without checking expected_sync_content_revision. The changed sync and enrichment callers treat that outcome as terminal by setting PROCESS_CONTEXT['discarded'], so a stale fragment decision can acknowledge the callback instead of taking the intended refused path for revised content. Move the revision comparison ahead of the existing-discard shortcut.
Useful? React with 👍 / 👎.
| - name: EDGE_SHADOW_URL | ||
| value: "ws://prod-omi-listen-edge.prod-omi-backend.svc.cluster.local:8080/v1/shadow" | ||
| # EDGE_SHADOW_TOKEN (sent as x-edge-shadow-token; must match listen-edge's) | ||
| # is a secret: never committed here, set only through privateEnv |
There was a problem hiding this comment.
Document the listen-edge call in the owning pipeline map
These values introduce a concrete backend-listen-to-listen-edge WebSocket call, including a new shadow-audio URL and token contract, but backend/docs/listen_pusher_pipeline.mdx contains no listen-edge or EDGE_SHADOW entry and is unchanged by this commit. Update that owning map so the new inter-service audio path, its fail-closed behavior, and its configuration are discoverable alongside the rest of the listen pipeline.
AGENTS.md reference: backend/AGENTS.md:L159-L159
Useful? React with 👍 / 👎.
8d062ad
into
integration/legacy-retire
…a wall-clock race (#23153) ## Summary Mobile App Checks run [39680972837](https://github.com/BasedHardware/omi/actions/runs/39680972837) (#23133, a backend-only head) failed the Android Emulator Acceptance probe in round 0 of the `burst` case with "A queued stop terminated the later active transfer." **This is a harness timing flake, not a service bug**; the production `SyncTransferForegroundService` behaved correctly in every log, and no stale queued stop ever terminated a transfer. ### Cause `ProbeActivity` scheduled `ACTIVE` at +1.5 s and its own `stop()` at +4.0 s on the main thread. In `burst`, the 201 queued start commands are delivered on that same thread *before* `ACTIVE`, so `ACTIVE` slips by `batch − 1.5 s` and the window before the intended stop shrinks to `4.0 s − batch`: | source | per-command cost | burst batch | ACTIVE slip | window before stop | | --- | --- | --- | --- | --- | | CI pass 39676205471, rounds 0–4 | 3.0–13.0 ms | 0.6–2.6 s | 64–1635 ms | 2.5 s → **1.36 s** (round 1) | | CI fail 39680972837, round 0 | ~26 ms (from its `empty` case) | ≈ 5.2 s | > 3.7 s | **≈ 0** | | local idle, API 36 | 1.4 ms | 0.27 s | 6 ms | 2.5 s | | local, 96 guest busy loops | ~30 ms | 6.0 s | 4.6 s | **0** → identical failure | Local reproduction (unmodified `origin/main`, `omi_android_gate_api36`): `ACTIVE` 09.053, `SURVIVED` 09.125, the activity's own stop delivered 09.204 — 202 promotions before `ACTIVE`, one after. The runner's dumpsys landed after that intended teardown. The runner also raised before writing the case logcat, so the CI artifact holds only `0-empty*` and could not show this. ### Service correctness `stop()` sets a volatile flag then queues `ACTION_STOP`; `start()` queues a start then clears the flag; `onStartCommand` decides from the flag at delivery. All of these run on the main thread, so every queued burst command delivers with the flag false. The existing Robolectric test `a stale queued stop does not terminate a later accepted start` covers stop-N-then-start-N+1 and was green on the failing run. Production ordering through Dart's refcounted `SyncTransferKeepAlive` is strictly alternating start/stop. No user impact. ### Change - **ProbeActivity**: in `burst`/`restart`, register an exported receiver, log `ACTIVE`, and stop only on the runner's `com.omi.fgsprobe.VERIFIED` broadcast (30 s fallback logs `VERIFY_TIMEOUT`). `SURVIVED` follows the ack-driven stop by 2 s. Other modes unchanged. - **android_fgs_probe.py**: per-case flow in `run_case()`; on `ACTIVE`, verify dumpsys, write `<round>-<mode>-active-*.log`, then broadcast; fail with a message that names the evidence; `VERIFIED` required and `VERIFY_TIMEOUT` fatal for those modes. - **android_fgs_probe_test.py** (`android-fgs-probe-runner-contract`): ack only after verification; verification latency cannot race the stop; an inactive service saves evidence and fails without an ack; the fallback marker fails the case; other modes neither verify nor ack. - **SyncTransferForegroundServiceTest**: 100 queued start/stop pairs plus a final start deliver in order with no `stopSelfResult`, foreground with the wake lock held; only the later stop ends the service. - README documents the handshake; `{"kind": "none"}` changelog fragment (harness only). ## Product invariants affected none ## Failure class (fixes) Failure-Class: FC-wall-budget-equals-paced-work-duration The activity's fixed +4.0 s wall-clock stop was the budget; the 201 paced command deliveries plus the runner's verification were the work. At the failing emulator's ~26 ms per command the work exceeded the budget and a healthy, keeping-up service was rejected as a failure. The handshake removes the wall budget from the verification step instead of margin-sizing it. ## Verification Repository `BasedHardware/omi`, this branch at the PR head; local emulator `omi_android_gate_api36` (API 36, arm64, headless). - `python3 app/scripts/android_fgs_probe_test.py` — 5 tests OK (hermetic, host layer). - `./gradlew :app:testDevDebugUnitTest --tests com.friend.ios.sync.SyncTransferForegroundServiceTest` (JDK 21, SDK 36) — 12 tests, 0 failures, including the new 100-pair burst test (JVM/Robolectric layer). - `python3 app/scripts/android_fgs_probe.py --rounds 5` under 96 guest busy loops (emulator layer, the condition that reproduces CI) — **25/25 cases pass**; burst batches 4.0–9.1 s, `ACTIVE→VERIFIED` 0.7–1.8 s. Same command, unmodified `origin/main`, same load — fails with the CI message. - `--rounds 2` at idle — 10/10 pass; `ACTIVE→VERIFIED` 113–613 ms. - `scripts/pr-preflight --lane local` — passes. CI's Android Emulator Acceptance job runs the fixed probe on this PR. Evidence detail (workspace): `data/run-2026-10-13-two-lane-nemotron/swarm/state/refs/p48-android-stop-race-evidence.md`. Closes the `swarm/known-red.md` row for this failure. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23153?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/23153?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23153&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. -->
## Summary M3: land the legacy-sync retirement integration branch (`integration/legacy-retire`, swarm plan `omi-knowledge-base/projects/backend-target-architecture/swarm-plan.md`, contracts in `contracts.md`) on main. **Merge with `--merge` (never squash)**; the lead runs the train from the main merge SHA. **Prod behaviour after this merge:** prod `legacy_sync` stays `on`. Every new legacy-retirement path is gated: the ramp document, default-off flags or kill switches, and the `DRAINING_PRECONDITIONS` that `ramp_set` enforces before leaving `on`. With the mode `on`, intake, sync and enrichment keep today's routes. ## M3 gates (lead ruling 6702cc; David authorized the merge, 10-21) 1. **Prep landed:** - #23068: main b859b78, the ci-budget bump and the dead-code stub removal; - review fixes #23082 and #23086; - final main merges #23096 (main 34ce402) and #23133 (main 5406315). 2. **Staging tree equality:** `OMI_RELEASE_TREE` on all four `*-staging` services equals `integration/legacy-retire^{tree}` at this head (see the evidence section below). 3. **M2 review (GLM, which replaced Grok; ruling 43bd53):** - CHANGES: 1 P1, fixed in #23082 (provider-STT outbox sweep plus draining gates). - The 2 P2s are recorded below. - The M1 blocker closure table is in `data/run-2026-10-19-legacy-retire/review/M3/m1-blocker-closure.md` (omi-workspace). 4. **Workflows:** all green on this head. 5. **Luna:** - Round 1: CHANGES, 2 majors, fixed in #23082. - Round 2: 4 majors. Two lock fixes are in #23086 (Luna SHIP); two were routed to dark-step gates. - Final-merge resolution: SHIP. ## Dark-step gates and follow-ups (none block M3; prod stays `on`) - **`provider_stt_live`** (`DRAINING_PRECONDITIONS`): before leaving `on`, prod needs: - the provider-stt queue; - the `PROVIDER_STT_TASKS_*` env; - the maintenance job; - pagination or a due-cursor for the provider-STT outbox sweep (Luna round 2 #4). - **`legacy_final_pass_rehomed`** (`DRAINING_PRECONDITIONS`, lead ruling b209a5): conversations still owned by `legacy_final_pass_v1` with no live legacy job must be re-homed to batch first, and new final-pass ownership must stop outside `on` (Luna round 2 #3). The final-pass-rehome lane owns this. - **GLM P2s:** - the router's stranded-row 409 loop without `batch_adopts_stranded` is lane 10 debt; - BYOK uploads route to batch even with legacy sync `on` (David, 10-19). This is a release-note item. ## `.github` changes in this PR and David's naming Source of the naming: swarm-plan.md, lane 7: "B4 and B5 are named .github changes (fourth round, #9)" (2026-10-19); the checkout-stall bound (2026-10-20, main 1b07e5e); #22758 build-only mode; lead ruling 209335 (David named B7 and B8 items, 2026-10-21 ~06:05Z). | File | Change | Named item | | --- | --- | --- | | `.github/workflows/config_train.yml` (new) | Config-train: plan/apply of `backend/deploy/ops`, manual dispatch, prod-train lock; workflow-level `GIT_HTTP_LOW_SPEED_*` | B4 (+ checkout-stall bound for the two env lines) | | `.github/actions/sync-backfill-lifecycle/action.yml` | Prod backfill queue names come from the ops file; the train no longer reconciles the prod queue (#22455, #22480) | B4 | | `.github/workflows/gcp_backend.yml` | `break_glass_lock` input; prod concurrency group `prod-train` | B5 | | `.github/workflows/gcp_backend_listen_helm.yml` | same | B5 | | `.github/workflows/gcp_backend_pusher.yml` | same | B5 | | `.github/workflows/gcp_parakeet.yml` | same | B5 | | `.github/workflows/gcp_llm_gateway.yml` | same (every prod deploy writer shares the lock) | B5 | | `.github/workflows/gcp_diarizer.yml` | B5 lock lines **plus** B7: OCI revision/`omi.release.tree` image labels and a batch-worker `image_digest` promotion path (verified by `check_release_tree.py`) | B5; B7 (David, ruling 209335) | | `.github/scripts/check-deployment-concurrency.py` | Guard that evaluates the new prod-train group expressions | B5 | | `.github/ci-budget.yaml` | config-train entry (B4); 1 run/day on the six deploy workflows with `break_glass_lock` (B5); 1.1/day on three build-only jobs (sync 11, #22758 base) | B4, B5, #22758 | | `.github/checks-manifest.yaml` | Registers `backend/scripts/check_release_tree.py` (the B7 promotion gate) | B7 (David, ruling 209335) | | `.github/scripts/check_duplicate_routes.py` | Counts routers mounted through `app_roles.mount_routers` (B8 OMI_ROLE map) as mounted | B8 (David, ruling 209335) | | `.github/scripts/test_pre_push_ci_verified.py` | Test hygiene: `clean_env` also pops `PRE_PUSH_BASE_BRANCH` and `OMI_PR_BODY_FILE`, so lane pushes with a non-main base do not leak into the hermetic hook runs | lead authority, ruling 66dba9 (edits an existing test script; no workflow added) | | `.github/scripts/dead_code/backend.allowlist.json` | The 7 swarm contract-stub entries are removed (L01-4); every file now has importers | allowlist hygiene (CI script data) | | `.github/workflows/sync_ledger_fence_cutover.yml` | Prod takes the `prod-train` lock, with a `break_glass_lock` input that falls back to the backend stack lock (M3 Luna review) | B5, completing it on a file that must share the backend mutation domain (lead ruling 5f60b3) | | `.github/workflows/config_train.yml` (break-glass fallback) | Break-glass shares `deploy-backend-stack-<env>` with `gcp_backend.yml` (M3 Luna review) | B4/B5 (lead ruling 5f60b3) | ## Staging tree evidence Verified 23:33-23:4xZ 10-21, on tier ro-dev: - **Services:** all four `*-staging` services (`backend-staging`, `backend-sync-staging`, `backend-sync-backfill-staging`, `backend-integration-staging`) serve `8d062ad3cfacf8b7eb26dea737a2969423548e64` at 100%. - **Tree:** `OMI_RELEASE_TREE=5c398832bc4487066abbf2d49bcf8c6f9a700818` == `8d062ad3^{tree}`. - **Image:** `us-central1-docker.pkg.dev/based-hardware-dev/staging/backend@sha256:18b8cf414566743aaee20bd2559695ec7b4536a75ec609fbc139f008bbf7ecf9`. - **Batch worker:** `sha256:0954c71c87f5`, 0 replicas. Staging is plain (no warm instances or overrides). - **Deploy log:** `data/run-2026-10-19-legacy-retire/lane01/m3/deploy-final2.log` (omi-workspace). ## Product invariants affected INV-DATA-1: integration carries lane 7's (#22430) edits to `.github/workflows/gcp_*.yml`. They add the `prod-train` concurrency/lock lines (B5) and, in `gcp_diarizer.yml`, the worker-digest promotion. No Firebase or Firestore project, auth authority or serving endpoint changes. Production-family artifacts stay on `based-hardware`. ## Line-count exceptions Line-Count-Exception: backend/routers/sync.py | 3881 -> 3966 | lane 10 legacy-dark fence wiring at the legacy call sites (#22495) plus the M3 review fixes (off-loop mode read, final-pass ACK); the file shrinks with the C6/C11 deletions Line-Count-Exception: backend/database/firestore_index_registry.py | 2196 -> 2200 | the legacy-dark zero-lost census index (sync_content_ledger created_at, lost_recordings.py soak check 5) ## Failure class Integration carries fix commits, and each declares its own class. For this merge: Failure-Class: none UI-Evidence: none -- backend/CI retirement work plus sync merges; the UI changes are main PRs that carried their own evidence 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…a wall-clock race Mobile App Checks run 39680972837 (BasedHardware#23133, backend-only head 8d062ad) failed round 0 of the burst case with "A queued stop terminated the later active transfer." The service was fine. The probe activity scheduled ACTIVE at +1.5 s and its own stop() at +4.0 s on the main thread, but the 201 queued burst commands are delivered on that thread first: the failing emulator ran ~26 ms per command (the previous, passing run ran 3-13 ms and already slipped ACTIVE to +3.2 s in one round), so ACTIVE fired after the stop was due, both ran back-to-back, and the runner's dumpsys observed the intended teardown. The runner then raised before writing the case logcat, so the artifact could not show this. Reproduced on an API 36 emulator under guest CPU load: the unmodified probe fails with the same message (ACTIVE, stop and SURVIVED within 72 ms; 202 promotions before ACTIVE and one after). With this change the same load passes 25/25 cases (burst batches 4.0-9.1 s, verify latency 0.7-1.8 s) and idle passes 10/10. - ProbeActivity: in burst/restart, register an exported receiver, log ACTIVE, and stop only on the runner's com.omi.fgsprobe.VERIFIED broadcast (30 s fallback logs VERIFY_TIMEOUT). SURVIVED follows the ack-driven stop by 2 s. Other modes are unchanged. - android_fgs_probe.py: per-case flow in run_case(); on ACTIVE verify dumpsys, write <round>-<mode>-active-*.log, then broadcast; fail with a message that names the evidence; VERIFIED is required and VERIFY_TIMEOUT is fatal for those modes. - android_fgs_probe_test.py (checks-manifest android-fgs-probe-runner-contract): ack only after verification, verification latency cannot race the stop, an inactive service saves evidence and fails without an ack, the fallback marker fails the case, other modes neither verify nor ack. - SyncTransferForegroundServiceTest: 100 queued start/stop pairs plus a final start deliver in order with no stopSelfResult, foreground with the wake lock held; only the later stop ends the service.
Final main merge, round 2: main 5406315 into
integration/legacy-retirefor M3. Main moved 16 commits past 34ce402 while #23096 ran CI, and #22427 went CONFLICTING again.Conflict: only the generated
backend/docs/feature-flag-registry.md. It is re-rendered as of 2026-10-21, andcheck_feature_flag_registry.pypasses.Other checks:
check_ci_budget.py --base origin/mainand the reason-label ratchet pass.Verification: main's 14 changed test files since 34ce402 pass under
backend/test.sh.utils/enrichment/callback.py: mirrors main 4c7ccd0.lifecycle_service.rule_discard_outcomereplacesdiscard_by_relevancein the legacy copy, andtest_enrichment_callback_parityrequires the C2 copy to match. That parity test failed CI shard 2 on the first push; the other shards passed.Additional verification: all 72 test files integration touches versus main pass locally on this head.
tests/fast_unit_duration_allowlist.txt: allowlists the four heavy-pass cases of main Dream: retry reservation 429s inside the pass and shorten the 3.8 cooldown #23085'stest_dream_capacity_retry. They tripped the 1.0s CPU guard on integration CI shard 2 twice (1.16-1.28s), against 0.25s locally and green on main's CI. Under the lane 1 flake policy, the second trip means allowlist; the entry carries a removal note.CI exception (lead ruling 37d905):
app/scripts/android_fgs_probe.pyround 1, "A queued stop terminated the later active transfer". It failed at head 8d062ad in run 39680972837 and again on its rerun.app/diff vs main (git diff origin/main...8d062ad3 -- app/is empty);Failure-Class: none
Line-Count-Exception: backend/database/conversations.py | 4475 -> 4501 | growth comes from main (sync merge), not from integration code
Line-Count-Exception: backend/utils/sync/pipeline.py | 3644 -> 3647 | growth comes from main (sync merge), not from integration code
UI-Evidence: none -- sync merge; the UI changes are main PRs that carried their own evidence