Skip to content

Guard listen source identity and preserve operator-owned deployment inputs - #23850

Closed
Git-on-my-level wants to merge 4 commits into
mainfrom
accel3/listen-guard-pusher-env-ramp
Closed

Git-on-my-level wants to merge 4 commits into
mainfrom
accel3/listen-guard-pusher-env-ramp

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Queued listen deployments can check out a later main commit than the operator reviewed, pusher cannot carry the private MEDIA_NOISE digest, and Cloud Run deployments overwrite the operator-owned batch percentage with zero.

  • Add optional full expected_source_sha admission, checked against both runtime checkout and workflow commit before mutation. Blank preserves current dispatch behavior.
  • Give the pusher canary and release the same validated, masked private-values file. The chart permits only MEDIA_NOISE_MODE_SERVE_UID_SHA256S, preventing private overlays from shadowing shared runtime controls; dependency installer children do not inherit the private YAML variable.
  • Omit the prod Cloud Run batch percentage when no explicit deploy override is supplied. Dev retains zero and new services retain the code default zero. Align staging composition and checks with optional-input omission while preserving explicit-literal precedence and drift detection.

DRAFT / rollout hold: merge only after the active paired25 window is explicitly RELEASED. The rollout lead owns merge and deployment. Do not include these workflow changes in that window. Secret content and access changes are separate from this source PR.

Validation at 93e74f6fbaf4c5f2408b279a56b62b2de94e3b88: 233 changed-file unit tests, 20 additional cross-service contract tests (three historical replay cases keep their existing opt-in skip), and 13 hermetic listen-STT tests. Tests include real Helm rejection of private cohort overrides, executable installer-environment red/green checks, actual admit-step Bash, and staging omission/override behavior. Normal pre-push gates pass. Independent read-only Luna delta review is SHIP; the reviewer ran no tests. GitHub checks own current CI state; deployed behavior is unmeasured.

The CI-budget inventory records the new optional input and one conservative minute of forecast headroom per existing listen job. It adds no event, job, runner, automatic run, or expected run frequency; this allowance is not a measured duration.

Rollback source changes before deployment; a runtime rollback requires a separate lead-approved rollout that preserves the operator-owned percent.

Product invariants affected:

  • INV-DATA-1: source admission is strengthened; no data-plane routing change.
  • INV-MEM-4: no memory intake, promotion, or content mutation change.

Failure-Class: FC-deploy-literal-reverts-operator-value

The existing class covers the batch-percent overwrite. Its artifact list includes the reusable rendering guard; the private-overlay restriction preserves the same operator ownership boundary.

Git-on-my-level and others added 4 commits October 28, 2026 10:30
…rod BATCH_PIPELINE_PERCENT

David-approved 2026-10-28 (lead 9d8819), one PR:

(a) gcp_backend_listen_helm.yml: optional expected_source_sha input. The
admit step (before any mutation) refuses a run whose checked-out source
or workflow commit is not exactly that sha; blank keeps today's
behaviour. Closes the queued-run checkout-of-later-main race.

(b) pusher privateEnv, mirroring backend-listen: the chart renders each
privateEnv name once (replacing a same-named literal); the prod
workflow materializes PUSHER_PRIVATE_VALUES_YAML once, validates and
masks it, and passes the SAME file to the isolated canary and the
release; always() cleanup. For the MEDIA_NOISE serve digest.

(c) runtime_env: prod Cloud Run BATCH_PIPELINE_PERCENT becomes a
provisional deploy input with no literal, so deploys stop writing 0
over the ramp controller's serving value (env merge keeps it); dev keeps
an explicit 0; code default when absent is 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record the optional input in the workflow rationale and allocate one
conservative minute of forecast headroom per existing listen job.
No event, job, runner, automatic run or expected frequency is added.
Allow only the requested MEDIA_NOISE digest in privateEnv, preventing
private overlays from shadowing ConfigMap-owned rollout settings.
Remove the private YAML variable from dependency installer children.
Cover both paths with Helm and executable child-environment regressions.

Failure-Class: FC-deploy-literal-reverts-operator-value
Compare the same omission that the staging composer produces for an
unset optional input, while retaining literal and required-input checks.
Give explicit staging literals precedence over inherited env_var metadata,
matching the runtime renderer, so real override drift remains detectable.

Failure-Class: FC-deploy-literal-reverts-operator-value
Git-on-my-level added a commit that referenced this pull request Nov 5, 2026
## Problem

Pusher drops its in-memory playback projection close obligation when the
bounded close rebuild retries are exhausted or the socket is evicted.
The retained audio remains safe, but no durable owner retries the stale
playback metadata after the socket disappears.

## What changes

- Persist coalesced `record_projection_rebuild_due` markers in
`record_projection_rebuild_jobs`, keyed by user/conversation, on
exhausted retries and socket cleanup. No conversation marker and no
additional ordinary-flush reads or writes.
- Queue terminal handoffs in one bounded metadata-only background task.
Preserve a separate bounded overflow retry inventory, batch writes with
one-second RPC deadlines, and cap all socket-cleanup marker work at
three seconds. Marker failures never change recording completion.
- Retire confirmed empty-inventory markers after seven days from
Firestore creation, or under the 10,000-marker maintenance ceiling.
Limit collection scans to 10,001 and rebuilds to 128; expose bounded
count, observed oldest age, capacity state and `retired_no_objects`.
Retirement rereads the marker version and the conversation producer map
in one Firestore transaction. Only an explicit empty map permits
deletion; live, unknown or malformed producer fences retain and rotate
debt, including under collection pressure. The pressure-blocked gauge
and aggregate fenced count surface passes that cannot evict empty
markers. No audio is deleted.
- Extract shared full metadata discovery and a socket-independent
rebuild. A bounded pass in the existing record-seal-repair CronJob
consumes at most 128 markers in 60 seconds, rotates work before
discovery, and clears only the version it attempted. Failed,
interrupted, invalid, or concurrently replaced work remains due;
confirmed empty inventory follows the age/capacity policy above. A
rebuild may update metadata while existing producers remain pending, but
keeps its marker until those fences clear through their existing owner.
- Refuse deleted owners before discovery and recheck deletion intent,
privacy, and the prior audio-files revision transactionally before
updating only `audio_files`. Keep preview read-only and retain debt on a
broken raw-pack index.

The runtime kill-switch parser lives in
`config/batch_pipeline_projection_rebuild.py`; metadata rebuild stages
do not read process policy from the environment.

Flag: `PUSHER_PROJECTION_DEBT_DURABLE_ENABLED`, **default ON**. `0`,
`false`, or `off` disables marker handoff and consumption. Rollback: set
`recordSealRepair.projectionDebtDurableEnabled=false` in the repair
runtime first, then disable pusher's flag; existing markers remain inert
and can resume when reenabled. This PR does not unsuspend or activate a
CronJob.

## Custody and privacy

Playback metadata only. No seal authority, producer-token mutation,
heartbeat, entry clock, dead-letter, conversation status, PCM read, or
audio-object creation/rewriting/deletion. Tombstones, hard/soft
deletion, account deletion, privacy changes, sync opt-out, peer
projection updates, and marker replacement are fenced. Scope is redesign
phase 5C only. #24712/#24716 and #23850 were checked before editing;
#24712 and #24716 merged during verification and their flag metadata is
preserved in the feature branch; shared overlap is flag metadata, not
projection-drain behavior or deployment configuration. No `.github`
changes.

A persistent Firestore outage or process death before a marker is
committed can still prevent handoff; this marker is not a WAL. Failed
marker writes retain metadata-only retry inventory and emit sanitized
`marker_write_failed` outcomes; bounded inventory saturation emits
`marker_retry_overflow`. Cached close debt remains retryable even when
overflow inventory is full.

## Verification

- All tests/build checks ran through `~/workspace/omi/bin/omi-heavy`
with the requested GCP credential/project variables unset.
- Focused per-file backend runner: **314 passed** (projection
producer/consumer, flag budget, rendered independent rollback, CLI
output isolation, batch-stage environment ratchet and outbox fault
injection).
- State table/invariants/writer inventory plus other deployment
contracts: **1,917 passed, 75 baseline xfailed**.
- Lifecycle simulator plus lifecycle properties under the existing
isolated stack environment and a disposable loopback Firestore emulator:
**23 passed, 3 existing strict xfailed**. The shared-collection fixture
includes a clear peer and verifies per-owner transactional outcomes. The
exhaustion/eviction/deletion/marker-race cases and six empty-retirement
cases passed: aged live/clear fences, pressure with fenced markers,
post-discovery producer registration, marker replacement and late-tail
repair.
- One local composed full-stack attempt stopped at an HTTP read timeout
in the existing REST-restart scenario before reaching lifecycle tests;
CI passed that scenario on the same production source. The final
exact-head CI gauntlet is linked below.
- Runtime image dependency closure: **19 registered images passed**; no
image/dependency changes needed.
- Required Grok review via `agentctl`: Luna R1 and R2 findings fixed.
The same required Grok reviewer rechecked transactional empty
retirement, producer and marker races, pressure telemetry and regression
coverage: **no blockers**. No additional reviewer agents.
- `make preflight`: **44 checks passed**, including the registered
Firestore guard. `scripts/pr-preflight` metadata contracts passed with
the documented six-line router exception; the final frozen run passed
all 44 checks; the normal hook repeated them successfully on the
published head.
- **Normal pre-push passed** on
`95a9ea47ae98eb03843909459a6604523534a98e`: full backend type checking,
selected backend units, registered Firestore guards, OpenAPI and pinned
formatting. No bypass, cap override or force push; Firestore guard
passed in 172.30 seconds without timeout or retry.

Exact published head: `95a9ea47ae98eb03843909459a6604523534a98e`. CI
results: [checks for this exact
commit](https://github.com/BasedHardware/omi/commit/95a9ea47ae98eb03843909459a6604523534a98e/checks).

## Product invariants affected

none

## Not measured

No GCP/prod access or tier used; no live IAM/permission test,
deployment, CronJob activation, production backlog/cost/latency
measurement, device playback acceptance, or A/B worker-death/dead-letter
simulator changes. Existing strict xfails remain existing
simulator/state-table debt.

Line-Count-Exception: backend/routers/pusher.py | 1851 -> 1857 | Phase
5C adds exact-owner terminal projection-debt and socket-cleanup handoffs
at the existing boundaries; full discovery is extracted into a shared
module, and splitting adjacent custody code would exceed this lane's
named scope.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing as part of a stale-PR cleanup David asked for on 2026-11-26 (Shipping lead agent): it is a draft with no activity for days. Nothing is lost: the branch stays, and anyone can reopen this PR if the work is still wanted. If it still matters, reopen it and refresh it against main.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant