Skip to content

fix: bound refused projection heads with recoverable quarantine - #25623

Open
Git-on-my-level wants to merge 7 commits into
mainfrom
lane/projection-head-bound
Open

Git-on-my-level wants to merge 7 commits into
mainfrom
lane/projection-head-bound

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

A refused protocol-2 projection head can block every later result for its owner indefinitely. After 15 minutes of observed missing-source-marker refusal, this change advances ordering with the existing recoverable quarantine_held disposition. It retains the immutable result/audio and lets successors project without assigning unproven text.

Eligibility is deliberately narrow: a canonical protocol-2 source-key job with an absent/v1 reuse marker, absent result markers, and no alias metadata (source_alias, source_alias_of, or alias version). All immutable binding comparisons pass before the typed refusal. Wrong versions, explicit bad markers, alias rows, binding corruption and privacy refusals keep their existing stop/alert behavior. #25597 already admits the original marker-on-job incident shape; the still-refused pre-marker residual is also covered.

The bound uses the durable first-refusal timestamp, without a replica-sensitive attempt counter. Serving/pump ticks default to 20 seconds (~45 retry opportunities); a 60-second pump tick gives ~15 opportunities. The next eligible pass at/after 900 seconds revalidates privacy, source ownership, ledger, predecessor and age in the hold transaction. It writes no transcript, usage acknowledgment or source claim. A committed hold emits omi_batch_pipeline_projection_protocol_held_total{reason="missing_source_marker"}, one structured reason/age log with no identifiers, and the shared degraded fallback event. A later transient failure starts its own ordinary retry window; protocol age cannot consume that budget. Stale/inapplicable hold hints are quiet no-ops.

Transcript ordering decision: later segments may appear while the held segment is absent. Once a compatible reader understands the original retained format, existing release resets the unit to pending with projection_redriven_at; ordinary assignment sorts merged text by original capture timestamp, inserting it at its original position. Normal conversation matching still determines whether it belongs to that conversation or a separate one. The owner watermark stays at the later tail. Administrative versions and operator=True alone do not establish reader support; an unmarked-job residual needs a later reader fix before either automatic or operator release. No result/provenance rewrite is used.

Protocol-hold release also checks the canonical source owner in the reset transaction. An existing conflicting claim keeps the row held, even after its expiry timestamp. Assignment rechecks ownership again; a new post-reset source/privacy conflict still needs reviewed resolution. The change never manufactures ownership or relaxes those fences.

BATCH_PIPELINE_PROJECTION_PROTOCOL_HEAD_BOUND_ENABLED defaults on; set false to restore indefinite blocking for newly refused heads. Disabling does not undo committed holds or rewind watermarks. #25617 owns blocked-head/outcome alerts: its projection_drain.py, projection_walk_stop.py and metrics.py lines remain untouched, the blocked stop token is preserved, and no alert is duplicated.

Validation: separate pytest processes through workspace bin/omi-heavy run --, cloud credential env unset. cd backend && .venv/bin/python -m pytest tests/unit/<file> -q --tb=short: protocol hold29, owner-chain39, exception taxonomy3, source-marker18, release240 and poison-head matrix61 passed after the final fixes. The metric export correction adds the new counter to both dev/prod Stackdriver bridge prefixes while reusing the existing Cloud Run scrape regex. Export contracts passed54 tests (1 optional promtool test skipped); protocol tests passed29 again. The telemetry exact-prefix contract passed57 under the guarded test.sh runner after adding the new counter to its explicit list. Normal pre-push contracts, typecheck and selected tests passed on final source 0b6b096960c9d259b74ac09ec466b3f0c64f178d. The real prepare/hold/assignment/release tests cover exact bound, both reader policies, retained-result late recovery, negative fences, malformed aliases, kill switch, source conflicts, stale hints and separate retry episodes.

Final-head CI is FAILED, not cleared. On 0b6b096960c9d259b74ac09ec466b3f0c64f178d, run44167123909 attempt1 passed assertions but rejected CPU time in unchanged lifecycle (1.05s>1.00s) and conversation-concurrency (1.02s>1.00s) tests. Normal guarded local backend/test.sh full-file reproductions passed252 (86 expected failures) and26 tests. One failed-jobs rerun was requested on the same SHA: attempt2 again rejected the same lifecycle CPU guard at1.06s, with all252 assertions passing; shard7 also rejected the same conversation-concurrency CPU guard at1.11s. Attempt2 is terminal failure. No further rerun, limit/allowlist change, protected-source/test change or workflow change is made. Failure history: https://github.com/BasedHardware/omi/actions/runs/44167123909/attempts/1 and https://github.com/BasedHardware/omi/actions/runs/44167123909/attempts/2 .

Earlier queue/recovery source220d finished green after two failed-job reruns for separate unchanged timing/clock-sensitive tests; those attempts remain recorded in run44155333915. That older green result does not clear the final export-corrected head.

Panels review-20261117t181920-aab8 and review-20261117t184523-af9d produced eight findings, all triaged accepted/addressed. Both had two completed independent reviews; the original third member exceeded bounded collection and was stopped without a result. The registered batch-custody/lead2 owner acknowledgment remains a before-merge gate. This PR is unmerged and undeployed; no production access, GCP tier, flag/index mutation or new workflow was used. Hermetic/CI source evidence is not serving/runtime acceptance.

Change note: backend/docs/listen_pusher_pipeline/changes/2026-11-18-projection-head-bound.md.

Failure-Class: FC-unresolved-head-blocks-projection
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1845 -> 1870 | Bounded refusal handlers and retry-episode separation reuse the existing fences; the state transaction lives in a dedicated module.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T18:19:13.294794Z
We couldn’t complete this review. Comment @codex review to try again.
ac90ec2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

kodjima33 added a commit that referenced this pull request Nov 18, 2026
…allowlist canary) (#25673)

## What changed and why

**Problem.** A pendant recording should show its transcript and summary
on Home within 60 s of the seal. In prod it takes minutes. The largest
p50 stage after the seal is not the GPU. It is the ordered merge: 80% of
recordings wait the full 60 s `BATCH_PIPELINE_MERGE_HEAD_WAIT_SECONDS`
behind a starved head. That head is a days-old `retry` job, and the
existing bypass then commits the same row 60 s late.

**Change.** Owners listed in the new
`BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLIST` (default empty) skip the
head wait when it is waiting only on starved rows. A starved row was
admitted at least 1,800 s ago and has waited that long for a lease:
`ready`/`retry` with `available_at` at least 1,800 s in the past, or
`leased` with `lease_until` at least 1,800 s in the past. Every
lease-ending path (`_defer`, admission hold, missing-input repair, held
requeue, redrive, quarantine) resets `lease_until` to 0 and stamps
`available_at`, so a row that failed seconds ago, or is due again in
seconds, is not starved. The skip commits exactly the row the expired
wait would commit (the owner's earliest ready pending row) through the
same transaction body. Inside that transaction it also requires:
- the row is a native record unit whose earlier binding units are
settled;
- every pending row captured before it is starved. A new bounded
`pending_page` read (129 rows, `first_pending`'s filters, order and
index, on every store backend) checks this; a longer backlog refuses.

A refused skip returns before the catch-up hold and the backlog-release
fallback. Without the early return, a provider-route record candidate
could set `held['backlog']` and the tx-fresh fallback would run before
60 s; with it, that fallback is unreachable from a skip. A skip logs
`event=batch_merge outcome=stale_head_skip` (head state + wait bucket)
and does not write `head_wait_bypass`, so the bypass field and log stay
real expiries only. Unchanged:
- unlisted owners
- head wait off
- non-record rows
- any unready row ahead that is in flight, recently leased, younger than
30 min, or in another state (`record_pending`, `held`)

### Stage budget, seal to Home summary (prod, read-only)

Sample: 600 random `batch_live_v1` rows with `record_sealed_at`, sealed
45 min to 8 h before 2026-11-18 07:50Z, out of 6,730 eligible. 432 had
every unit committed. Per recording, the critical path is the last unit
to commit. Units per recording: p50 1, p75 2, p90 5.

| Stage | p50 s | p75 s | p90 s | Note |
|---|---:|---:|---:|---|
| seal -> intake claimed | 8 | 396 | 732 | bimodal: 56% < 15 s, 36% wait
5-15+ min |
| claimed -> staged/admitted | 6 | 9 | 19 | |
| admitted -> GPU result (queue + compute) | 9 | 21 | 62 | GPU is not
the bottleneck |
| **GPU result -> committed (ordered merge)** | **62** | 137 | 372 |
346/432 via head-wait bypass: p50 67 s single-unit, 98 s multi-unit.
Without bypass: 0.1 s |
| committed -> persisted (projection discovery) | 21 | 33 | 43 | |
| persisted -> ledger `transcribed` (follow-up/completion) | 37 | 62 |
99 | 33 s single-unit (eager wake), 46 s multi-unit |
| `transcribed` -> `summary_completed_at` (notes) | 38 | 58 | 93 | Luna
`conv_structure` |
| seal -> `summary_completed_at`, end to end (n=235) | 452 | 708 | 1,496
| |

Sum of p50 stages on the fast-claim path: about 181 s.

**Root cause of the merge stage.** For 20 of 20 sampled bypassed owners,
the earliest pending fresh-class row is a native record job in `retry`,
captured 36-215 h ago and due long ago (`available_at` in the past).
`fresh_capture` is fixed at admission. The tx-fresh gate and
`_fresh_pick` therefore treat these rows as fresh heads, and every new
recording waits out the full 60 s. The canary account (`viUv7G...`) has
this shape: a 78.6 h-old catch-up `retry` head, with fresh-class `retry`
stock from 84 h ago behind it.

### Ranked cuts (expected p50 seconds saved for the seal -> summary
path)

1. **Stale-head skip (this PR).** Saves 45-55 s on ~80% of recordings.
All 75 of the canary owner's rows ahead are starved under this rule:
`retry`, due 10.3-90.3 h, unleased (53 at attempt 1, 22 at attempt 0, so
an `attempt == 0` rule would exclude most of them). They fit inside the
129-row page. Sampled owners had 8-134. Low risk: same rows and outcome
as today's bypass, 60 s sooner, allowlist-scoped. After a CPU roll the
commit lands on the next serving tick (10 s on prod
backend-integration). After a GPU worker roll it lands at publication,
saving about 60 s.
2. **Persisted -> `transcribed` completion.** Saves 20-35 s. Low-medium
risk, small to medium effort. `RECORD_FOLLOWUP_WAKE_ENABLED` covers only
single-unit records (`projection.py:1627`), and even single-unit takes
33 s. Extending the eager wake to multipart, and finding the single-unit
delay, comes next.
3. **Post-commit projection wake (committed -> persisted).** Saves 15-20
s. Medium effort. The GPU pump commits directly with no `on_committed`
hook, so this needs a GPU image roll.
4. **Intake-claim tail.** p50 unchanged, p75 about -380 s. Medium risk
and effort. 36% of seals wait 5-15+ min for the `record_pending` claim.
Needs diagnosis: record-drain capacity (10 rows per pass) vs ~1,200
seals/h, or barrier refusals.
5. **Starved fresh-class `retry` heads themselves.** Same seconds as cut
1, for every owner. Medium effort. This is a scheduler question: why due
FRESH `retry` rows go unleased for days. Fixing it removes the need for
cut 1's allowlist.
6. **Notes model time.** At most 5-15 s, with quality risk. Luna
one-shot; the fleet notes histogram is ~25 s model time. Needs a quality
eval before any model or prompt change. Not recommended now.
7. **Staged cuts, no gain now.**
- `RECORD_FRESH_MERGE_ENABLED` (cut 4): its blocker is unresolved. The
prod GPU worker image tag is `ef42ee8` (2026-11-14), which predates the
sibling guard `a0a8816`. It would also not help here, because the stale
heads are already fresh-class.
- `RECORD_NOTES_EAGER_ENABLED` (cut 2): superseded by #25635, which
already moves the notes obligation to due-now at completion. The
lease-off producer revision blocker is still open.
8. **Pre-seal admission of completed units.** Saves at most ~25 s
(admission + GPU = 15 + 9 s p50). Very high custody risk: the seal
barrier is the admission contract (`require_record_audio_barrier`). Not
recommended.

**What remains to reach 60 s p50.** After cut 1 (with a GPU roll), the
fast path is about 8 + 6 + 9 + ~1 + 21 + 37 + 38 ≈ 120 s. Cuts 2 and 3
bring it to about 65-75 s. The rest has to come from notes (cut 6) or
claim/staging. The intake-claim tail (cut 4) dominates p75 and must be
fixed for a p75 target.

**Related.** #25633 (120 s speech-quiet seal) and #25635 (first summary
when the sealed transcript lands) are live. #25601 and #25623 (David)
work on stuck projection chains/heads; they touch no file here. The
staged cuts and the 60 s head wait are documented in
`2026-11-14-record-post-seal-latency.md`.

## How to canary and roll back

- **Canary for one account.** Set on prod Cloud Run
`backend-integration` (the serving loop host,
`BATCH_PIPELINE_SERVING_ENABLED=true`):
`BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLIST=viUv7GtdoHXbK1UBCDlPuTDuPgJ2`.
This PR deliberately adds no runtime-env overlay entry: put it in the
`backend-integration` section of
`backend/deploy/runtime_env/prod.overlay.yaml` as part of the canary
change, so the next deploy keeps it. The backend image must contain this
PR. `config/deployment-setting-classification.json` classifies the
variable as `config`. The GPU worker needs nothing; adding the same env
there after its next image roll moves the commit to publication time.
- **Readback.** A skip leaves no durable marker, so readback relies on
the `event=batch_merge outcome=stale_head_skip` log line. On the canary
account's next recordings, `committed_at - ready_at` of the last unit
should drop from ~60-100 s to ≤ ~10 s, with no `late_capture` within a
recording.
- **Rollback.** Remove the uid or unset the env. No migration; committed
rows keep their order.

## Product invariants affected

none

## How it was verified

- Prod measurement used read-only Firestore (collection-group
`conversations` query on `record_lane_owner`/`status`/`finished_at`,
joined to `batch_pipeline_prod_jobs` and `_results` and to
`pipeline_ledger`) and read-only `kubectl`/`gcloud` describes. No prod
writes, env or flag changes.
- `pytest tests/unit/test_batch_pipeline_merge_stale_head.py`: 32
passed. Jobstore SQL safety plus protocol parity: 210 passed.
- 94 directly affected test files pass locally: merge, jobstore, parity,
scheduler, transaction-attempt, pipeline sims, all Firestore query/index
guards, `test_flag_budget.py` and `test_record_seal_latency.py`. CI runs
the full 1,260-file selection.
- Existing merge suites unchanged and passing:
  - `test_batch_pipeline_merge_head_wait.py` (177)
  - `test_batch_pipeline_merge_fresh_first.py` (59)
  - `test_batch_pipeline_merge_tx_fresh_gate.py` (24)
  - `test_record_seal_latency.py` (58)
  - `test_batch_provider_merge_membership.py` (46)
  - `test_batch_terminal_poll_skip.py` (42)
  - `test_batch_backlog_release.py` (57)
  - the recovered-release suites and the head-wait sims
- All 24 changed-file-selected unit test files pass, including
`test_flag_budget.py`, `test_pipeline_sim*`,
`test_lifecycle_invariants.py` and
`test_cross_service_deploy_contract.py`.
- `backend/scripts/typecheck.sh`: 0 errors. `make preflight`: 43 checks
passed. `scripts/check_feature_flag_registry.py`: OK.
- Not verified: a live canary. That requires the backend roll and env
change, which belong to the parent.

## Tests

`backend/tests/unit/test_batch_pipeline_merge_stale_head.py` (32 cases)
covers:
- a listed owner commits at once behind a starved head, with its own log
and no `head_wait_bypass`; an expired wait keeps the bypass marker
- **realistic heads that are not starved keep the wait:** in flight; the
reviewer's lease-expired retry due again in 10 s (`lease_until=0`,
`attempt=1`); a retry that failed 10 min ago; a row redriven a minute
ago; `record_pending`; `held`
- a prod-shaped retry due for 10 h without a lease is starved and skips
- a head deferred between the probe and the transaction keeps the wait
- **a young, leased recording captured earlier blocks the skip**; both
then commit in capture order
- **a refused skip of a backlog-held (provider) unit commits nothing,
adds no held owner and runs no early fallback transaction** before 60 s
- the 129-row page bound: 128 starved rows ahead skip, 129 refuse
- unset, empty or other-uid allowlists keep the 60 s wait
- head wait off keeps strict order
- an unready earlier unit of the same recording waits
- non-record rows keep the wait
- the prod shape (catch-up head plus fresh-class stock), with the tx
fresh gate on and off
- exact allowlist parsing

Mutation check: restoring the old `lease_until`-only rule fails 4 of
these tests, and removing the early return fails the backlog test.

`test_jobstore_sql_safety.py` adds `pending_page_in` binding and
limit-cap coverage. `test_jobstore_protocol_parity.py` checks that every
backend serves `pending_page`, and the Firestore query-shape registry
drives the new query.

## UI evidence

UI-Evidence: none -- backend merge scheduling only

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 19, 2026
## Change

Ordered merge and source-alias fallback now stamp an idempotent
projection obligation on the committed result in the same transaction.
The segment key and owner log sequence identify the revision. Serving
offers an immediate, bounded post-commit hint, and one strict lease
holder per namespace scans lost wakes in kind, due time, and document ID
order. A delivery claims the revision, runs the existing fenced
projector, then settles from the canonical result state. Predecessor,
sibling, timeout and error deferrals retain the obligation with a
bounded clock and a disposition. Multipart receipts, content ledger
completion, hourly usage, retained audio and privacy checks use the
existing authority.

This removes downstream job/policy probes and projection attempts for
covered rows from legacy assignment, finish and follow-up sweeps while
the backstop has recently succeeded and is keeping up. Legacy pages
retain their raw Firestore reads, cursor and overlap measurements. The
existing finish classifier (#25314), follow-up due-clock marker, overlap
measurement (#25596), refused-head recovery (#25623), and raw keyset
conformance (#25555) retain their separate responsibilities.

## Mixed versions and rollback

Older writers, including GPU image `ef42ee8`, leave unstamped rows
eligible for every legacy path. Older readers may consume a stamped
result through the existing receipt and accounting fences. Current
GPU-side commits rely on the elected due scan because the GPU process
has no projector. No cross-process wake transport or historical backfill
is needed for coverage. Fenced held release and privacy resume rearm a
result and invalidate its prior token. New writers with the switch off
mark a reactivated row for legacy discovery while keeping its previous
scheduling metadata. An expired or stalled backstop restores
compatibility attempts, even for stamped rows.

Set `BATCH_PROJECTION_OUTBOX=false` on the participating readers and
writers to restore the full legacy discovery paths and stop new
obligations and claims. Existing result and receipt data stay available.
Set it to true to resume after both stage-specific indexes are READY and
the due query is confirmed. Release qualification compares matched
completion, partial latency, oldest obligation, failures and read/write
telemetry across the actual serving roster.

The outbox supervisor starts on projection-serving roles when its switch
is on. A batch-serving process continues outbox discovery when the
dedicated pump and legacy projection sweep are both off. The due-page
loop has a 5-second interval, a MAX_PENDING initial 200-key bound, and a
MAX_SCAN_LAG initial 60-second coverage limit. Both follow-up queues
share the existing per-process slot budget. Its claim expires after 180
seconds. Existing serving and projection-pump cadence and page
configuration are preserved. A missed wake, process loss or leader
change returns unclaimed debt to discovery. A canonical hold parks it
until an existing release or privacy resume. Persisted and ready
receipts honor a future `projection_followup_due_at`. Unsuccessful
finish then uses the configured follow-up backoff on the outbox clock,
with a 60-second fallback if the setting is zero. Outbox delivery skips
the legacy durable deferral write.

## Expected saving

**Inferred, unmeasured in serving.** The design baseline measured
overlapping 339.56M follow-up-origin and 222.08M serving-origin reads in
the 24 hours ending 2026-11-18 13:16Z. Those totals include useful work.
The avoided share is the expensive downstream attempts of covered rows,
and the two baselines cannot be added. Embedding the metadata adds zero
document writes at merge. One claim plus one settlement at the recorded
1.516M daily commits implies about 3.03M scheduling writes/day if every
commit follows that path, before retries and lease writes. Index cost
and net read savings need a matched serving measurement.

## Panel and verification

Scope panel `scope-20261118t145338-00de` returned three answers.
Accepted its writer audit, per-row revision witness, strict lease and
post-page token check, due deferral, existing receipt/privacy fences,
three-store parity, existing age gauge, rollback and cost measurement.
Chose embedded result fields because they avoid a new merge write and
preserve the existing purge and retention lifecycle. Deferred a physical
Firestore legacy page cut, fleet backfill, additional election switch,
and cross-process wake transport. A successful per-row witness keeps old
and mixed-mode writers eligible without a fleet cutover. The scope
command emitted a dossier without F-numbered findings, so its
review-only triage CLI had no calls to record.

- `cd backend && .venv/bin/python -m pytest -q
tests/unit/test_firestore_query_shapes.py --tb=short` — 611 passed.
- `bash backend/scripts/check_runtime_env_compose.sh`, `python3
scripts/check_feature_flag_registry.py`, and `cd backend &&
.venv/bin/python scripts/generate_firestore_indexes.py` — passed.

- Focused backend pytest files for the outbox, serving, leader,
discovery and follow-up desync — 201 passed.
- `OMI_REQUIRE_STORE_BACKENDS=all .venv/bin/python -m pytest -q
tests/integration/test_store_conformance.py -k projection_outbox`
(loopback Firestore and an owned PostgreSQL 16 container) — 3 passed,
one per store.
The fixture pins scheduler elapsed time alongside its synthetic
timestamps so local load cannot expire the setup claim.

- `.venv/bin/python -m pytest -q
tests/integration/test_batch_pipeline_projection_followup_firestore.py`
(loopback Firestore) — 13 passed, including lost wake/ack, duplicate
delivery, privacy, predecessor, and multipart restart.
- `.venv/bin/python -m pytest -q tests/unit/test_flag_budget.py` — 26
passed. `.venv/bin/python -m testing.pipeline_sim projection-drain
--rows 300 --owners 12` — all three projection modes preserved ordering
and completed assignment.
- Dev and prod `backend/scripts/validate-backend-runtime-env.py` and
deployment-setting classification — passed.

- The normal pre-push PR preflight passed all 52 selected static,
metadata and Firestore guard checks. The local hook used the approved
900-second per-file wall budget after a host-load timeout.

- Whole-backend Pyright passed with zero errors in the normal push hook.
The loopback Store conformance and 13 Firestore tests were repeated
after the typed Store interface correction.
- The outbox unit and background-task ratchet rerun passed 12 tests,
including graceful worker shutdown. The runtime manifest validator
passed 295 tests, and the async blocker gate reported zero selected
findings.
- `cd backend && .venv/bin/python -m pytest -q
tests/unit/test_batch_pipeline_projection_outbox.py` — 6 passed after
adding the mixed-switch reactivation assertion. The three-store
conformance and 13-test Firestore replay rerun also passed with the
fixed scheduler test clock.

### Round 2 review and CI repairs

Review panel `review-20261118t202810-030a` (FIX-FIRST), CLI triage
`F1=accept F2=accept F3=accept`.

- F1 starts elected outbox discovery independently of the dedicated pump
and legacy sweep on a batch-serving process. Projection and
first-summary policy stamping stay on owning roles. The outbox hands off
predecessor work and index flushes after the delivery claim scope.
- F2 proves a stale oldest due row clears the coverage witness,
successful scans renew it near expiry, and scans leave a fresh witness
alone.
- F3 enforces the follow-up due time and configured backoff on outbox
delivery. The outbox is the sole durable retry-clock writer for those
deliveries.
- CI on `d1195ac4cc7` found a stale ghost-hold assertion, a stale pump
fixture and Store protocol expectations, and scheduler-only fields
leaking into the characterization and provider-STT behavior goldens. The
integration assertion now pins the ghost-hold outbox clock. The
simulator trace excludes the internal kind and retry reason, with the
outbox details checked directly by replay and conformance tests.
- Hosted unit shard 7 on `0be3b03fd7e` caught the shadow-store guard
pointing at the public wrapper. It now asserts that the cached
constructor wraps the only Firestore store. All 23 cases in
`test_jobstore_shadow_seams.py` passed locally.
- Hosted Sync Cloud Tasks `batch-happy` on `0be3b03fd7e` exposed an
admission process stamping projection policy when neither serving role
was enabled. The startup gate now preserves projection-serving role
ownership even while the outbox remains independent of legacy sweeps.
- Round 5 incorporates
[#25778](#25778), which removed
the paused jobstore retirement carrier. The migration runner requires
contiguous numbers, so the unchanged outbox index SQL occupies
`0010_projection_outbox_due.sql`. Production Postgres target bindings
remain absent and outbox projection stays on Firestore during the pause.
The main branch’s staging isolation fence stays in place.
- `08352903c14` also fences the delivery claim at canonical transaction
read and before fair-use dispatch, preserves mixed-store discovery
parity, and reserves queue space for lost wakes.

- Ran each of nine focused unit files in its own pytest process from
`backend` using `.venv/bin/python -m pytest -q tests/unit/<file>.py
--tb=short`. All 559 cases passed across outbox, serving, pump,
follow-up clock, job-store parity and migrations, provider STT,
characterization, and the background-task ratchet.
- The role-bound startup change passed the 178 focused serving, pump,
and outbox cases. The local `batch-happy` gauntlet passed against
Firestore and Redis with its original owning-role and effect assertions.
The first local full-batch attempt stopped before scenarios at the
serving startup deadline under host load. The focused rerun increased
only the local startup wait.
- Discovery, overlap, and dual-store focused unit files added 150
passes. The final typed parity adapter was exercised again with 156
protocol-parity and 78 dual-store passes.
- `make preflight` passed all 52 selected manifest checks, including the
index and collection guards, feature flags, and runtime composition. The
normal push hook also passed whole-backend Pyright with zero errors and
all 40 selected unit files.
- Loopback Firestore pytest proofs passed 16 in
`test_batch_pipeline_projection_followup_firestore.py` and 37 in
`test_batch_projection_ghost_holds_firestore.py`. One ghost-hold
throughput assertion was intentionally skipped because emulator speed
depends on host load.
- `OMI_REQUIRE_STORE_BACKENDS=all .venv/bin/python -m pytest -q
tests/integration/test_store_conformance.py -k projection_outbox` passed
all three backends. `test_jobstore_migrations_postgres.py` added three
native PostgreSQL 16 passes. A supplemental full run was interrupted at
193 passes and two skips after a Docker connection stall reproduced by a
standalone PostgreSQL connection. The targeted rerun used the native
test fixture.
- `.venv/bin/python -m testing.pipeline_sim projection-drain --rows 300
--owners 12` preserved projection and chain ordering in all three modes.

### Hosted verification at `6d2551733d9`

The full Sync Cloud Tasks and Listen Pusher gauntlets, Backend Emulator
Proofs, and unit shard 7 all passed. The backend unit suite remains red
solely on two CPU-duration guard violations. Pytest reported 39 and 297
passing tests in the two files, respectively. [Hermetic
E2E](https://github.com/BasedHardware/omi/actions/runs/44468718109),
[emulator
proofs](https://github.com/BasedHardware/omi/actions/runs/44468718162),
[backend unit
suite](https://github.com/BasedHardware/omi/actions/runs/44468718334).

-
`test_monitoring_adapter_hpa_contract.py::test_hpa_and_adapter_changes_select_this_contract`
used 1.02 s of CPU against the 1.00 s limit. It used 0.65 s in the
preceding hosted run and 0.59 s in the local rerun with the same guard.
[Hosted shard
2](https://github.com/BasedHardware/omi/actions/runs/44468718334/job/135372906740).
-
`test_backend_runtime_env_validator.py::test_control_sync_routing_validates_deployed_values_without_changing_manifest[all]`
used 1.04 s against the same limit. It used 0.92 s in the preceding
hosted run and 0.62 s in the local rerun. [Hosted shard
5](https://github.com/BasedHardware/omi/actions/runs/44468718334/job/135372906741).
- The two cases, their test selector, runtime manifest and validator are
identical to the preceding PR head, which passed both hosted shards. The
intervening diff restores projection-serving ownership and updates the
store-construction guard. [Previous unit
run](https://github.com/BasedHardware/omi/actions/runs/44461717687).

## Product invariants affected

- INV-MEM-4. The runtime manifest declares a projection scheduling
switch. Canonical memory admission and the projection receipt, ledger
and accounting authority stay on their existing paths.

Failure-Class: FC-unresolved-head-blocks-projection

Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1871
-> 1914 | Projection owns coverage-aware discovery and dispatches outbox
snapshots through its existing fenced receipt methods.




<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25724?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/25724?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25724&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. -->

Implemented by a delegated agent for the batch owner-state program.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

When this PR returns to the merge queue, please update its branch against current main and let backend CI run on the refreshed PR. Link the fresh test_pipeline_env_surface_holds_its_budget pass and the tested head or merge SHA in the merge handoff. The November 30 budget audit found overdue entries in this PR’s older GitHub merge ref, so the previous CI run does not establish coverage for the refreshed base.

Quality tracking and merge-ref audit

This branch has not been deployed

No deployments
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