Skip to content

SCA-2280: skip async receipts in the projection finish sweep - #25314

Merged
Git-on-my-level merged 25 commits into
mainfrom
agent/m1-studio-codex-sol/3e63a4885c1f
Nov 15, 2026
Merged

Git-on-my-level merged 25 commits into
mainfrom
agent/m1-studio-codex-sol/3e63a4885c1f

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Published successor 98a87f93c8dd3801eb1489bdd5e2675252354d65. SCA-2280: compose async finish skipping with main's independently stamped follow-up clock (#25402). Normal merge of main 9104ef645e3cc51224e96d551a777b365b0c5e01 into the existing author branch over f5ca1bdccc99d2cf68f8ab368d679bc13d585dc6.

The scoped Release ruling (SCA-2280 comment01a1e005-94de-78cc-8cb2-879e8998c21d) authorizes this exact composition. Async state moves retain projection_finish_due_at=-1 and stamp projection_followup_due_at in the same write. Both exclude_async and followup_due_before cross the Firestore/Postgres/simulator interfaces and query drivers. Async exclusion applies only to finish ordering; independent follow-up discovery retains negative-finish receipts. The two clock orderings remain mutually exclusive, main's mode-change cursor reset/cutoff remains intact, and finish stripes still use finite seeds with the infinite backoff-off ceiling. The follow-up-clock writer/backfill/marker rollout retains its separate admission; this PR does not activate it.

Nine integration conflicts resolved by composing the contracts, not choosing a whole side: shared state fields; Firestore, Postgres and simulator paging; query-driver domains/pins; parity tests; discovery modes/seed horizon. The two additional test-model facades retain both options. Canonical main's current-clock upload fixture repairs are included; f5's real terminal 20 assertion failures in the three expired-capture fixtures remain recorded, not retried or waived. Main's unrelated fixes are retained. All five reviewed finish/classifier/control ASTs remain unchanged. No privacy/custody/ledger, marker/writer-roster, budget/timeout/assertion/skip change or third full review.

Local qualification: 1,213 tests across 17 isolated native files, 8 loopback Firestore tests (119.54s), normal commit/push hooks and 5 metadata checks passed; exact successor receipt is on SCA-2280. Fresh terminal CI is required for this successor; historical heads' green checks do not qualify it. The same serialized author-to-Release handoff is retained, without a new operator, build hold, deploy or activation.

Async-policy persisted/ready receipts consume finish-page reads and normally two additional job/result gets before the sweep skips processing. Pinned policy ordinarily avoids another policy lookup; async rows already skip session/privacy preparation. This cut removes that page-plus-two-gets work, less migration/probe overhead; it does not remove the whole privacy caller pool. Reuse the existing projection_finish_due_at=-1 clock sentinel: new async receipts stamp it in their existing write; legacy receipts get a transactional policy/state-fenced clock-only update. No new result field or Firestore index. Privacy/custody, receipt state, sync finish processing and independent follow-up completion retain their contracts. This corrected source model is not measured production savings (cost-owner comment01a1ddc7-d5c8-7659-8ba2-259adb9b0d91).

After the existing finish stamping marker completes, finish discovery excludes negative clocks and uses a separate limit-one async probe to keep the follow-up drain scheduled. With separate finish backoff disabled and async skip enabled, clock ordering intentionally uses an infinite ceiling after marker completion. Before completion, legacy discovery remains active. Older readers still see negative clocks as due, so mixed fleet/rollback retain former behavior.

Cost lead DESIGN: OK (November14 18:33Z), amended19:24Z:

Tuning: new: BATCH_PROJECTION_FINISH_CLASSIFY_PAGE_LIMIT initial 8 attempts/page, range0–16, pause0; shared cooldown20 seconds after the last attempt. New async-only discovery probe limit: initial1 document. Existing finish/assignment page sizes are unchanged. Previously legacy classification had no separate bounded cap; the new cap bounds that work. These are the only new numeric controls.

  • BATCH_PROJECTION_FINISH_CLASSIFY_PAGE_LIMIT=8, accepted0–16; malformed/out-of-range keeps8. Zero pauses classification. Shared process budget refills20s after the last attempt, including failures; overlapping pages share the cap without sleeping.
  • BATCH_PROJECTION_FINISH_ASYNC_SKIP_ENABLED=false restores former finish discovery, without reverse backfill. Main's separate BATCH_PROJECTION_FINISH_BACKOFF_ENABLED remains default-off, false on production integration/sync and forbidden on backend/backfill.
  • Failed/contended classification is caught at the call, leaves the row eligible and increments its dedicated counter without generic sweep errors/deferral. No-op policy/state races increment neither counter.
  • Label-free omi_batch_projection_finish_classified_total and omi_batch_projection_finish_classification_failures_total are retained in GMP and both scrape tests. Keep upstream ledger/allowance metric unions.

At actual classifying process count P, cap8 gives ideal ceilings1440P classifications/hour and8P synchronized incremental writes. Ordinary writes and retries are additional; combined peak headroom is unverified. Historical42-process/518k-stock sizing gives336 burst/16.8 per second average/minimum8.6h; these are not current scope or stock measurements. No cap increase in this PR or before one complete stable serving hour and cost-owner authorization.

Binding07:38SCA2379 ruling (comment01a1de24-6151-7be1-accc-63e1abc2b3f4) says mechanical shared repair ships WITHOUT ANOTHER REVIEW. No third reviewer, selfSHIP or old-head approval carry. Existing Release SCA2283/captain owns canonical admission, current-head recheck, source-containing carrier/slot and runtime guards. Existing serialized handoff is updated rather than duplicated. No hold/rebuild of ABC or unilateral merge/deploy/cap increase. Original intervention CLOSED10:18:30; source qualification does not renew its meter/timers or establish serving/savings.

Measurement: cost owner's corrected native [03:00,04:00)UTC2026-11-15 baseline is502606 finish rows (SCA-2280 comment01a1dd90-c082-704e-ae07-8d13a34a00b3 and owning baseline.md/raw snapshots). Obtain actual pre-rollout cohort and per-service/origin scope. Historical800k/6M and92s/455s are not current gates; obtain Quality/Release's reviewed matched-cohort latency/recovery receipt with its actual metric definition. Positive-clock persisted/ready COUNT is an unclassified-async upper bound including sync; negative-clock COUNT is current marked backlog, not cumulative classifications. No full-document/policy-join scan. Require complete scrape/reset coverage, zero failures, progress/read reduction, healthy drain/age/latency/5xx and combined write/burst evidence before cost-owner-authorized acceleration. See backend/docs/runbooks/projection-finish-async-skip.md and SCA-2280 readback attachment.

Product invariants affected

none

Failure-Class: FC-query-filter-after-expensive-enrichment

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e3c557862

ℹ️ 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".

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T12:21:40.853086Z f5ca1bd New commits
ℹ️ About Codex in GitHub

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

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

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f56209d6f6

ℹ️ 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".

Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
… (SCA-2283) (#25320)

## Why
`BATCH_PROJECTION_FINISH_BACKOFF_ENABLED` was turned off in production
at 19:41Z on 2026-11-14 (revision `backend-integration-provfix-off1114`)
by the SCA-2175 owner on its 5xx-doubling trigger, and the push captain
ruled that it stays off (SCA-2173, SCA-2222, SCA-2283). Main still
declares it `'true'` for prod backend-integration and backend-sync since
#25307, so the next deploy rendered from the repo would turn it back on.
This PR makes the repo say what production runs.

The flag saved nothing while it was on (17:11Z to 19:41Z): every finish
row on backend-integration is an async-policy row, and those are never
deferred. Finish rows read stayed at 63k to 69k per five minutes and
completions stayed at 0. The real fix is #25314 (SCA-2280).

## What changed
- `backend/deploy/runtime_env/prod.overlay.yaml`: the binding is
`'false'` (category rollout) for `backend-integration` and
`backend-sync`. It stays declared, not removed, so an operator value
cannot silently differ from the repo.
- `backend/deploy/runtime_env.yaml`,
`backend/docs/feature-flag-registry.md`: regenerated.
- `config/feature-flags.yaml`: the flag's record says terminal `off`,
with a dated note. Its ramp stays in the record because the registry
check requires one on a pending rollout row; the note says it is
suspended. Whether to remove the flag is decided after the #25314
readout.
- `backend/tests/unit/test_render_backend_runtime_env.py`: the pin moves
from `'true'` to `'false'` on those two services; absent everywhere
else, as before.

- `prod.overlay.yaml` `forbidden_env` for `backend` and
`backend-sync-backfill`: the flag is on the removal list. Both services
still serve a hand-set `true` from 2026-11-13 (read from the
traffic-receiving revisions at 20:26Z). Deploy merges env, so leaving
the key undeclared would keep it. Neither service runs the finish sweep,
so the value is inert there; this makes the repo and production agree.
The test pins the removal.

## What did not change
No code path. The code default was already off. No other environment. On
backend and backend-sync-backfill the only change is removing an inert
leftover.

## Tests
`tests/unit/test_render_backend_runtime_env.py` and
`tests/unit/test_backend_runtime_env_validator.py` pass; both generator
`--check` commands pass.

## Rollout
Rides Train 2 (cut-off 01:00Z on 2026-11-15). After it serves, the cost
owner reads the value back from the revisions receiving traffic on both
services. To turn it on again: set it `'true'` here; nothing else is
needed.

## Product invariants affected

- INV-MEM-4

Named because `backend/deploy/runtime_env.yaml` changes. This PR changes
one batch-projection binding and touches no memory intake,
consolidation, promotion or privacy TTL setting; INV-MEM-4 behaviour is
unchanged.

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

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

Two slow-suite guards are red on main since #25340 and #25368 merged.
This repairs both with test and inventory changes only; no production
code changes.

Failure-Class: none

## What was wrong

-
`test_llm_gateway_coverage_guardrails.py::test_direct_provider_usage_stays_inside_approved_boundaries`
reports `DirectUse(utils/llm/summary_embeddings.py, AsyncOpenAI)`: the
file added by #25340 was not in the direct-provider inventory.
-
`test_real_clock_budget_ratchet.py::test_no_new_tiny_real_clock_budgets`
rejects two tests that set `COMPOSER_CONTEXT_TIMEOUT_SECONDS` to 0.1 s
(#25340) and 0.04 s (#25368), real-clock budgets under the 0.5 s limit.

Both guards are marked slow and are selected by path, so the two pull
requests' own CI did not run them; other pull requests (#25314, #25131)
inherited the failures.

## The repair

- Inventory: `utils/llm/summary_embeddings.py` is registered with its
policy stated beside the entry. It is the composer's single bounded
embedding request for owner-memory retrieval. It enforces the
generated-compute budget and resolves the BYOK key before any IO, and
routes through the LLM gateway whenever gateway feature mode is on,
which is the production setting on backend, backend-sync and
backend-sync-backfill (`OMI_LLM_GATEWAY_FEATURE_MODE=gateway`, read from
the serving specs). The direct client is the non-gateway branch only:
same provider, key custody and model as `clients.py` `OpenAIEmbeddings`,
with SDK retries off and the caller's absolute deadline. It lives
outside `clients.py` so the notes routing digest and paid checkpoints
stay unchanged. Both branches are exercised with the real SDK in
`test_episode_summary_provider_bounds.py`. No gateway, BYOK or quota
path is bypassed.
- Tests: both context-budget tests now inject the clock and the
completion event of `composer_context_budget`, so the caller's whole
budget elapses deterministically while the provider call is still
running. They still assert the properties the originals covered: the
caller returns at the deadline and not when the non-cooperative provider
finishes, partial context is discarded, completed sections survive, late
results are never published, and the timeout fallback is recorded once.
The ratchet and its allowlist are unchanged.

## Verification

Both guards, the ratchet's stale-entry checks, the provider-bounds tests
and the two edited test files: 89 passed locally with slow tests
selected (`-m "slow or not slow"`). No tuning value, flag, state or
schema changes.

Rollback: revert this commit; main returns to the two red guards.

Author: Claude Fable 5.2.

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


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25372?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>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
Follow-up retries fetch a projection policy even when the part is
already ready or quarantined and immediately returns. Return before that
unused fetch, removing one transaction/job read on the ordinary
pinned-policy path. Unfinished parts retain policy resolution and
refusal before side effects; the surrounding persisted-receipt and
completion transactions are unchanged.

This is a small additional cut for the Firestore intervention. It must
not delay #25314 or the admitted recovery-default restoration. Savings
are not booked before production measurement.

## Validation

- Head `813961ee1bd7e4de9925addc170e5bd04d30da91` normally merges main
`41d6ab74e7b7c6a69695bfdb47c0cea9f87f40a0`, including shared guard
repair #25372. The change-specific file blobs are unchanged from the
preceding head.
- Canonical focused fast lane: 70 passed (45 follow-up and25 gateway
tests); all11 clock-ratchet cases are marked slow and exercised by the
separate slow lane. Existing1s CPU ceiling unchanged.
- Canonical `scripts/run-slow-guardrails-ci.sh`: 2,051 passed, 1,471
deselected. This is the repository's distinct slow guardrail recipe.
- Normal successor pre-push gate passed. GitHub CI remains the full
required authority and is pending.
- Refreshed independent Luna source review: SHIP for exact
successor813961ee1bd7e4de9925addc170e5bd04d30da91 against41d6ab74. No
actionable defects in the two scoped files. No CI or serving approval is
inferred from a source verdict.

## Product invariants affected

none

Failure-Class: none

## Batch pipeline tuning

No capacity, concurrency, cadence, retry interval, state, retention,
allowance or policy values change. The existing ready/quarantined no-op
guard moves ahead of an unused policy fetch. No new state or queue is
introduced.

## Rollback

Revert this commit through the normal source/release path. No migration,
flag or production change is included.
@Git-on-my-level
Git-on-my-level merged commit 2665e80 into main Nov 15, 2026
69 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-codex-sol/3e63a4885c1f branch November 15, 2026 17:10
Git-on-my-level added a commit that referenced this pull request Nov 16, 2026
Async results re-entered the positive finish-clock population after
held-ready settlement, sibling completion, privacy resume, or ghost
settlement, keeping the finish sweep expensive after #25314. Pass the
immutable projection policy through those writers so async results
retain finish_due=-1 while independent follow-up discovery stays due
now. Each sibling uses its own pinned job policy; missing/synchronous
policies remain classifiable.

Follow-up to SCA-2280 and #25314. No additional document reads, write
operations, indexes or rollout settings. Existing classification cap8,
rollback and privacy/custody/usage fences remain. Expected behavior:
remove replenishment from these writers and let bounded classification
drain existing positive-clock stock. The corrected production baseline
is 502,606 finish rows/hour; ~14,400/hour remains an empty-page
estimate, not a measured saving. Production caller counters, follow-up
completion and matched transcript p50/p90 still require the existing
owners.

## Product invariants affected

none

## Verification

- Four affected suites: 493 passed, exercising real transaction code
with StrictFirestore.
- Tests cover async/sync clock stamping, mixed-policy siblings, privacy
replay, ghost-settle read counts and no-double-charge completion replay.
- `make preflight`: 38 checks passed; typecheck: zero errors; normal
bounded pre-push gate passed.
- Loopback Firestore ghost-hold/follow-up suite: 37 passed, one skipped.
- Full CI-size local run stopped after typechecking; broader selection
belongs to CI. Independent read-only Luna delta review: **SHIP**, no
substantive defects. Reviewed pinned sibling policies, all four writer
paths, follow-up clocks and read-before-write transaction ordering; test
execution belongs to the author.

UI-Evidence: none -- backend discovery hints only

Failure-Class: none


## Lifecycle note amendment

Documentation-only successor `829e2a55458241f796a3fe42346056615b7366a4`
adds
`backend/docs/listen_pusher_pipeline/changes/2026-11-16-async-finish-ready-writers.md`,
addressing connector finding
[discussion_r4582401778](#25458 (comment)).
Runtime code and tests are identical to reviewed `fcc51c54fb`. Normal
pre-push gates passed for the amendment. The prior runtime SHIP is not
relabeled to the successor: an exact-head Multica review of record must
explicitly disposition this finding before Release admission.
Git-on-my-level added a commit that referenced this pull request Nov 16, 2026
…shadow config (#25359)

The original #25285 owner memo could enforce on first serve when
existing configuration had shadow=0. This guarded SCA-2190 re-land
restores its reviewed implementation while requiring a new explicit
`bpp_owner_memo_enforce` admission lever, default 0. Comparison
candidates remain available; old, absent, invalid or empty config cannot
admit the new owner memo. A nonzero shadow percentage still suppresses
owner enforcement even with admission enabled.

The comparison packet travels with this candidate: shadow=10,
negative-cache=0, TTL60=0 and owner-enforce=0 for the four Cloud Run
batch callers and the existing next-train worker chart. Other levers
remain unchanged, including the worker's monthly-reader exception.
Listen, pusher, desktop, jobs and other consumers keep default-off owner
admission regardless of their existing shadow settings. This is source
preparation only; no live mutation, worker image roll, migration, or
enforcement GO.

Fresh transactional token/server-revision/generation certification,
never caching denial decisions, dry-run no-mint, the prepare-wide 256
fence including redirect chains, and the fail-closed privacy kill switch
are retained. Original exact-head review receipt: SCA-2291 at
aa2fb59. Independent review requested
for the new admission/config/telemetry delta, not a full third review of
unchanged restored code.

Positive comparison evidence is now measurable by closed
attempt/no_attempt/snapshots labels in `privacy_owner_comparison_total`.
Both this and the existing decision-comparison counter are retained
through the Cloud Run keep-lists, isolated sync-worker fold, and batch
worker registry. No identifiers appear in metric labels.

The complete prerequisite, surface, expiry, rollback, economics and
qualification packet is `backend/docs/sca-2190-reland-packet.md`.
SCA-2190 remains open through serving and independent production
verification.

## Validation

- Nov 16 bounded main merge at
`39c263a6e66aab7c67b04c108c1fdc848e33c298` (main `f6d69aefb5`): preserve
both privacy comparison counters plus main’s new WAL scrape series;
capture-source guard, prepare-wide fence and default-off
comparison/admission settings remain intact. Eleven affected files pass
**557 tests** through the Studio `omi-heavy` runner. Normal pre-push
passes **47 preflight checks**, type checking with **zero errors**, and
**1,508 tests across 40 selected backend files**. Exact-head CI is
green: **42 successful checks, 24 skipped, zero failures or pending
checks**; GitHub reports **MERGEABLE/CLEAN**. Release admission and
production gates remain separate.

- Earlier conflict repair at commit 579fa67 (main 9136bb5):
preserve main's capture-source conversation privacy guard in the
decision-only path, union both comparison counters with the added
finish/review-config scrape series, and regenerate the flag inventory.
Added synthetic allow/deletion/prepare-budget regressions. Nine affected
files pass **808 tests** (including the updated 75-test projection
suite); compose and generated read-lever manifest checks pass.
Admission, comparison packet, 14-day qualification and separate
production/enforcement gates remain unchanged. Normal pre-push passes
all 47 preflight checks, backend type checking with zero errors, and
1508 tests across 40 selected backend files. No hook bypass. Successor
CI is running; its result remains required for Release admission.

- Bounded integration repair at
`2e74612f73f517d62c4f19460c219d4f9c2cf12b`: refresh the exact keep-list
expectation for both comparison counters, eight exact lever-map hashes
(four callers in source/composed manifests), and the unapplied six-value
monthly proposal patch. No production code/config, monthly
scope/epoch/TTL, or budget ceiling changes. The four focused files pass
**345 tests**, in separate processes.
- Same-main receipts: on `65f46cce8306794cc7f2a5eff6cda7c285f4fe8b`, the
original three failing files pass **248 tests**. CI's old merge base
`9cc1565d383de4565b8bc492479b9d917731370b` independently reproduces the
exact flag count mismatch **289 != 291**. That mismatch does not
reproduce on the candidate or current main; the new push must acquire a
fresh merge result and CI. No budget guard was relaxed. New-head CI
remains required.

- SCA-2365 ruling: correct only the stale prod runtime contract
expectation without another review. Successor
`0d70f0c199ff1baa93f553096511f86257f5406c` changes that test and its
explanatory comments only; the complete file passes **97 tests**. All
monthly-reader, non-Cloud-Run and other service pins remain asserted.
Fresh successor CI must establish its own result.

- Cost-owner disposition, Nov 15: this is source preparation/future
savings only. No enforcement or comparison-configuration GO; shadow
deployment is neither a prerequisite nor a co-change for #25314.
Production HOLD remains through 10:18:30Z with existing privacy/release
gates.

- Python 3.11, `backend/test.sh`, one process per file: 640 passed
across nine focused privacy, repair, projection, runtime-manifest and
child-metric suites (552 in the eight-file pass, then 88 repair tests
after installing local test dependencies).
- New regressions warm actual owner candidates before testing
image-before-config and malformed admission; all three transactional
shapes emit positive owner_hit comparisons while admission stays off.
Existing token rotation, revision/schema failure, kill-switch, dry-run
no-mint and redirect-fence regressions remain.
- Runtime source compose, generated read-lever manifest check, prod
runtime validator, generated flag inventory and diff hygiene pass.
- Initial preflight found generated flag-inventory drift; the generated
document was refreshed. Final preflight passes 47 checks. The normal
bounded pre-push gate passes backend type checking with zero errors and
715 tests across 12 selected files. CI remains the full-suite authority
and must be green before release admission.
- All tests are synthetic/hermetic. No production read or write by this
change's author run.

## Ramp and rollback

Default-off admission is intentional under cost-lead source-preparation
GO (2026-11-15 04:24Z). Release owns canonical admission after SCA-2225
parser/protected-environment correction and installed source binding. It
must verify effective shadow >0 on every one of the four batch callers
before serving this candidate, even with the new defense-in-depth code
gate.

Preserve the checked-in runbook's at least **14 days of all-plane
shadow**, zero unexplained mismatches, positive owner_hit comparisons on
all three shapes, no shadow errors/scrape gaps, writer-matrix/privacy
proofs, and explicit cost-lead GO. The earlier one-day staging proposal
and a clean first hour do not shorten that longer qualification
requirement. The six-hour push can deliver comparison-only preparation
and review, not qualification or booked savings. Cost lead owns
acceptance; a newer explicit window ruling must be recorded before
changing this requirement.

Partial-value source expiry is **2026-11-17 UTC**; renew its dated
metadata through review before then to continue the required window.
Expiry is not an automatic live reset and must not enable enforcement.
Keep owner-enforce=0 throughout. A later separately reviewed config may
enable it only after qualification and cost-lead GO; neither clearing
shadow nor the arrival of this image grants that GO.

Rollback: Release keeps owner-enforce=0 and uses
`ops_kill_switches/privacy_decision_cache.disabled=true` (30-second
fail-closed poll), restores prior source/image, or restores the recorded
per-surface comparison settings while retaining owner-enforce=0 and
TTL60=0. No data migration is involved. Worker chart uptake belongs to
its existing next train; this PR does not request a worker roll.

## Tuning disclosure

OWNER_ID_CAP is restored at initial 256, preserving the existing
per-walk and prepare-wide distinct-conversation bound. No worker/process
capacity is retuned. New comparison shapes are bounded telemetry states
and exit with each check; they do not create a durable pipeline state.

Why isn't this a shared primitive instead? The admission fence is inside
the shared batch-privacy entry and inner memo path, covering every
consumer rather than adding service-specific rollout checks. Regression
incident: #25285 and its #25338 revert after shadow=0 first-serve
admission was identified.

## Product invariants affected

- INV-MEM-4

Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path

Related to SCA-2190. This source preparation does not complete the
production outcome.
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.
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