Skip to content

fix(batch): projection reaches newly committed owners first; backlog owners yield - #25213

Merged
Git-on-my-level merged 7 commits into
mainfrom
lane/projection-fresh-slots
Nov 13, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
lane/projection-fresh-slots

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What

Two changes so a fresh result is projected promptly while a projection backlog drains:

  1. Discovery: each assignment discovery tick also reads up to half a page from the newest 120 seconds of commits, so a new result is usually seen within its first two minutes however long the backlog (an estimate, below; not a per-row guarantee).
  2. Owner drain: newly requested owners get a turn before backlog owners.

Why

On 2026-11-13 about 250,000 old results were committed in three hours (the provider backlog release, stopped by #25204). Projection drains owners from one FIFO queue, 8 at a time per process, and a turn runs up to 120 seconds. Measured in production (result metadata and log counts only):

  • Sample of 20,000 pending results at 15:34Z: 74% captured over a day earlier; 651 owners; the top 100 hold 82%.

  • Of results committed 10–20 minutes earlier, 56% were unprojected (about 0.2% before the incident); 26% of those committed 60–70 minutes earlier.

  • Half of the waiting under-1h rows (1,290 of 2,587) belong to 198 owners with no older rows of their own. They wait only for other owners' turns.

  • Projection is about 1,000 rows a minute against about 575 a minute of normal inflow at that hour, so the backlog needs hours to drain. Fresh results should not be late for all of it.

  • Discovery pages pending results oldest first, 100 rows per 20-second tick per process, and a GPU-route commit has no other wake (the worker pump has no commit callback). With 154,000 pending rows, 35 processes pass a given row about once in 15 minutes. That matches the measured delay.

  • Owner-drain turn lines, 5-minute sample at about 15:45Z: turns that ran to the 120-second deadline were 51 of 1,140 turns but 58% of slot time, and advanced about 0.43 rows a second each.

Change

Discovery (backend/utils/batch_pipeline/projection_discovery.py, assignment discovery only). Each tick also reads up to half a page from the newest BATCH_PIPELINE_PROJECTION_RECENT_DISCOVERY_SECONDS (default 120) of commits.

  • No cursor (the offer memory below is the only state): the read starts at a random point in the window each tick and reads oldest first. Replicas draw their start points independently, so they can land on different rows (nothing forces them to); a restarted process behaves like any other.
  • A process offers a row from this read once. The entry is kept for two windows, longer than the row stays in the window. A row still pending after that is left to the main cursor, which offers it only when it reaches it (see Known limits: no guarantee for a single row).
  • Rows read here count against the page, so the page holds no more rows; the main cursor gets the rest (at least half). The tick makes one more Firestore query than before (two instead of one for the pending page).
  • A main cursor that has not reached the newest row for 30 minutes (MAIN_PASS_SECONDS) starts again: one time in eight at the oldest pending row, otherwise at a uniform random point between it and now. This closes a gap review found: when rows arrive as fast as a cursor reads, no cursor wraps, and rows before every process's start point are never paged. The gap exists on main too, at twice the arrival rate.
  • Same query and index as the main cursor, with a start point. A failed recent query costs only that half page; rows read before a failed main query are not recorded as offered, so they stay eligible for a later recent read (which starts at a new random point and may not reach them on the next tick).

Expected coverage, from the numbers above and not measured: with about 170–330 rows committed per 20-second tick and 35 processes each reading 50 from a random point of a window holding six ticks of rows, one tick misses a given new row with probability about e^(-35×50/(6×rows per tick)), 18–41% today. Over the six ticks a row spends in the window that is about e^(-35×50/rows per tick), under 1% today and about 7% at twice today's commit rate. It assumes uniform arrivals and independent draws.

Owner drain (backend/utils/batch_pipeline/projection_drain.py). Per process; no new read, no new stored state, no index.

  • A newly requested owner's first turn runs BATCH_PIPELINE_OWNER_DRAIN_FIRST_TURN_SECONDS (default 15, about one step) instead of 120.
  • An owner whose productive turn ends with rows left is a backlog owner. It keeps 120-second turns but waits in its own queue; newly requested owners launch first.
  • A backlog turn ends at its next step boundary (stop=yield) when a newly requested owner is waiting and no slot is free: one backlog turn per waiting owner, and never the last backlog turn running.
  • If no backlog owner is running, one goes ahead after four rounds of new owners, so the backlog cannot be starved.

Unchanged: order inside one owner (commit order under the assignment fence and the owner claim), discovery, claim-aware admission, privacy and live-target backoff. An owner's fresh row behind that same owner's backlog still waits for it.

Details: backend/docs/listen_pusher_pipeline/changes/2026-11-13-projection-fresh-owner-turns.md.

Rollout

Ships on. Both are scheduling changes inside one process, each with an off value: BATCH_PIPELINE_OWNER_DRAIN_FIRST_TURN_SECONDS=0 restores the single FIFO queue and 120-second turns; BATCH_PIPELINE_PROJECTION_RECENT_DISCOVERY_SECONDS=0 restores the single discovery cursor and removes the 30-minute restart. Deploy: backend-integration only (the surface that runs the projection owner drain).

Must stay clean after deploy: projected rows per minute not lower than before (the backlog keeps draining); enrichment 200s per minute flat. Expected to improve: share of under-1h captures committed 10–20 minutes earlier that are unprojected.

Known limits

  • The main cursor advances at as little as half its speed while recent rows fill their half of the page, so a backlog row that depends on discovery alone (not on its owner's running drain) is found later. Owners already draining are not affected. The 30-minute restart is random: one restart in eight begins at the oldest row, the others at a uniform point, so every stretch of the log has a chance of being read in each period. That is not a guarantee for any single row, and how long a row can wait has not been measured.
  • A row is offered by the recent read once per process run, so up to 35 times fleet-wide when fewer than 50 rows are pending in the window, plus once for each process that restarts while the row is in the window. The bound assumes the commit stamp is no more than one window ahead of the process clock (entries are kept for two windows). Offers per tick stay within the page size, as before; each offer reads the row's job and result, and repeated owners are coalesced per process and by the owner claim across processes.
  • It does not help an owner whose fresh row sits behind that owner's own backlog (about half of the waiting fresh rows today).
  • A long chain's read-ahead is per turn, so a backlog turn that yields early discards it; under constant arrival of new owners, backlog turns get shorter and the backlog drains somewhat slower.
  • Classification is per process and resets on restart: after a deploy every backlog owner takes one 15-second first turn before it is known as backlog.

Tuning disclosure

  • BATCH_PIPELINE_OWNER_DRAIN_FIRST_TURN_SECONDS new: 15 (0 = off, max 120)
  • BACKLOG_OWED_TURNS new: 4
  • BATCH_PIPELINE_PROJECTION_RECENT_DISCOVERY_SECONDS new: 120 (0 = off, max 3600)
  • MAIN_PASS_SECONDS new: 1800
  • MAIN_RESTART_HEAD_SHARE new: 0.125
  • offer memory new: two windows (240 s at the default)

No new pipeline state and nothing new stored. New process memory only: in the owner drain, the backlog queue and two sets of owner ids; in discovery, the ids and offer times of rows the recent read offered (up to half a page per tick: about 150 a minute at the default 20-second tick and 100-row page, more if the tick or page settings are changed; an entry stops suppressing after two windows and is removed when the map next passes 4,096 entries, so older entries can sit in memory until then) and the time the main pass began.

Product invariants affected

none

Failure class (fixes)

Failure-Class: FC-backlog-release-shares-lane-with-fresh-work

Second fix in this class: the first (#25204) stopped the unmetered release; this one gives fresh work its own place in the projection stage the release filled.

Tests

cd backend
.venv/bin/python -m pytest tests/unit/test_batch_pipeline_projection_discovery.py tests/unit/test_batch_pipeline_owner_drain.py \
  tests/unit/test_batch_pipeline_sweep_owner_chain.py tests/unit/test_pipeline_sim_projection_drain.py tests/unit/test_flag_budget.py -q

New in tests/unit/test_batch_pipeline_owner_drain.py: a light owner queued behind three heavy owners finishes before any heavy owner gets a second turn, and every chain still projects whole and in order; new owners launch before queued backlog owners and the backlog is still owed a turn; a backlog turn yields only for a waiting new owner without a free slot, one per waiting owner, never the last one; the off value; the setting's bounds. The existing FIFO fairness test now pins the off value.

New in tests/unit/test_batch_pipeline_projection_discovery.py: a new commit is on the first page behind a 400-row backlog and the page is no larger; the main cursor visits every backlog row while a full half page of new commits arrives on every tick; a row that stays pending is offered by the recent read once in 20 minutes of ticks, and once more by a restarted process; rows already offered still count against the page (query limits 50 and 50); each tick reads from a different point; the off value keeps one cursor and no restart; a failed recent query costs only its half; rows read before a failed main query are not recorded as offered and are offered again when a later read reaches them (shown with a fixed start point, striping on and off); a main cursor that has not wrapped for 30 minutes restarts and one that wraps does not; one restart in eight begins at the oldest row; setting bounds.

tests/unit/test_batch_pipeline_sweep_owner_chain.py::test_pending_page_skips_receipts_and_follow_ups_still_run pinned one query for the pending page; it now pins two, with limits 50 and 100. That test was already failing on the first pushed heads of this branch and neither the pre-push gate nor CI ran it.

Review

Independent review (Luna). Round 1 on cc4a583: FIX, one should-fix (a failed main query moved the recent cursor); the owner drain passed checks A to G. Round 2 on 1a06b86, against the contract (SCA-1960): FIX. Blocker: with half a page, the main cursor may never wrap under sustained arrivals, so rows before every process's start point could go unread. Should-fix: a still-pending recent row could be re-offered up to 45 times per process per window. Note: one more query per tick. I also found that the round-2 design would have left every process's recent cursor at the window floor under today's load. The recent read was rewritten (no cursor, one offer per row per process run) and the 30-minute restart added.

Round 3 on 4d722a7: FIX. It confirmed the restart's gating, the page and query counts, the off value, the failed-query paths and unchanged order inside an owner. Blocker: a uniformly random restart point almost never lands on the head of the log, so the oldest rows could still go unread under unending arrivals. Should-fix: the once-per-process bound assumed aligned clocks and no restarts; several statements in this description were stale or too strong. Response: one restart in eight now begins at the oldest row; offer entries are kept for two windows; the description is corrected. The rollout owner ruled the 1-in-8 head restart acceptable as probabilistic coverage (SCA-1960); a cursor that guarantees every row is read is assigned to the metered-release PR.

Narrow confirmation on b30e6be: the code matches the ruling (head restart, gating, two-window offer memory in filter and prune, nothing recorded on a failed main query), tests prove their names, no security, privacy, custody or data-loss risk. Its verdict was FIX for two sentences in this description: the retry after a failed main query was stated as next-tick, and the memory statement ignored that pruning only runs above 4,096 entries. Both are corrected above; no code change followed, so the head is unchanged. A description-only pass on the same head confirmed both and asked for one more wording change (replicas can, not do, land on different rows), made above. That pass also faulted two sentences in the checked-in change note (the same phrase, and "a restart changes nothing") and the "150 a minute at most" figure here; the note is corrected in a docs-only commit and the figure is now tied to the default settings. A final pass on 86685d1 confirmed that commit touches only the note and asked for one more correction, in both the note and this description: a row that stays pending is not certain to be offered by the main cursor next. Corrected in a second docs-only commit. The reviewer proposed always restarting at the oldest row; that was not taken because every process would then re-read the same first rows each period and nothing past them.

Not tested here: production behaviour, the coverage estimate above, and the effect on the backlog's drain rate.

🤖 Generated with Claude Code

Git-on-my-level and others added 4 commits November 13, 2026 22:43
…klog owners

A few hundred backlog owners held every owner-drain slot for two minutes a turn
and owners with a few fresh rows waited behind them (2026-11-13: 56% of results
unprojected 10-20 minutes after commit).

Failure-Class: FC-backlog-release-shares-lane-with-fresh-work

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…commits

With a long backlog a new result waited about 15 minutes to be paged at all;
GPU-route commits have no other wake.

Failure-Class: FC-backlog-release-shares-lane-with-fresh-work

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 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-13T17:07:07.531695Z b30e6be 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.

… place

Review round 1: the newest rows were read and their cursor saved before the
main query ran, so a main-query failure skipped that half page until the
window came round again.

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@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: cc4a58344a

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

Comment on lines +87 to +88
except Exception:
return []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Instrument the recent-discovery failure fallback

When the recent-window Firestore query raises, this handler silently returns an empty page and lets discovery continue using only the main cursor. That disables the fresh-owner scheduling improvement for that tick without recording any error or degraded-mode signal; repeated failures can therefore restore the backlog-induced discovery delays while sweeps appear successful. The new-fallback rule in backend/AGENTS.md requires calling utils.observability.fallback.record_fallback; record this transition with a degraded outcome rather than swallowing it without telemetry.

AGENTS.md reference: backend/AGENTS.md:L322-L322

Useful? React with 👍 / 👎.

Comment on lines +82 to +84
if after is None or float(after[0]) < floor:
phase = 0.0 if self.recent_started else window * self.stripe / PROJECTION_DISCOVERY_STRIPES
after = (floor + phase, '')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve distributed discovery when the recent cursor falls behind

When still-pending commits are dense enough that the recent cursor advances less than 20 seconds per default tick (50 rows per recent page), the moving window floor eventually overtakes it. This reset then discards the process stripe and starts every replica at the same floor on every subsequent tick. With ten pending commits per second, a direct simulation of recent_page() settles into returning only rows approximately 895–900 seconds old, never reaching newer commits. Fresh owners then depend on the main cursor, whose page capacity this change has reduced, recreating or worsening the delay this feature is intended to fix. Retain distributed offsets when resetting a lagging cursor, or otherwise ensure the recent scan can reach newly committed rows under sustained backlog.

Useful? React with 👍 / 👎.

…or restarts if it never wraps

Review round 2 on 1a06b86:
- Blocker: with half a page, the main cursor may never reach the newest row under
  sustained arrivals, so rows before every process's start point went unread. A main
  cursor that has not wrapped for 30 minutes now restarts at a random point.
- Should-fix: a still-pending recent row was re-offered on every tick of the window.
  The recent read is now stateless (random start each tick) and offers a row once
  per process; the window default drops from 900 to 120 seconds.
- The sweep test that pins queries per tick now expects the second query.

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@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: 4d722a71ea

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

Comment on lines +69 to +71
self.stripe = self.random() * PROJECTION_DISCOVERY_STRIPES
self.after, self.seeded, self.pass_started = None, False, time.time()
return self.next(limit, due_before)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve unfinished traversal when reseeding the main cursor

When an old pending cohort takes longer than 30 minutes to scan, discarding the cursor can repeatedly revisit its prefix instead of reaching later owners. Timestamp ties make this deterministic: with 12,000 still-pending rows sharing an old committed_at, any positive random seed lands after the cohort, triggering the head fallback. A simulation using this class with 100-row pages and 20-second ticks discovers only the first 9,100 rows across 500 ticks; disabling recent discovery visits all 12,000. If the prefix remains pending because its owners are blocked, owners beyond it lose discovery indefinitely. Preserve the unfinished continuation when introducing random restarts so the main scan still eventually visits every row.

Useful? React with 👍 / 👎.

…; offers remembered for two windows

Review round 3 on 4d722a7:
- Blocker: a uniformly random restart point almost never lands on the head of the
  log, so its first rows could stay unread under unending arrivals.
- Should-fix: the once-per-process offer bound assumed the commit stamp is never
  ahead of the process clock.

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 40d7ffe into main Nov 13, 2026
74 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/projection-fresh-slots branch November 13, 2026 17:20
Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
…e reads past one page (#25243)

## What

Follow-up to #25213 and #25226. Three small things in the batch
pipeline, backend only. No store, query or index change, and no new
setting.

1. **Fresh-first pick reads the settle instant.** When an owner's
earliest pending fresh row is not ready, a later ready fresh row may
pass it after the head wait. That wait was measured only from
`ready_at`. It now uses `_ready_since`, which the head-wait path already
uses: `ready_at`, or for a provider row while provider merge membership
is on, `provider_intent.settled_at`.
2. **A full probe page with no ready row is logged.** `event=batch_merge
outcome=fresh_probe_full_no_ready`. The probe itself is unchanged (one
page of 32).
3. **Recent-discovery fallback is recorded.** The newest-commits read
added in #25213 swallowed a failed query. It now calls `record_fallback`
(`recent_discovery` to `main_cursor`). This was the valid P1 from the
automated review on #25213.

Also carries two docs-only commits for #25213's change note that were
written after it merged (wording about replicas, restarts and what the
main cursor guarantees), cherry-picked from the then-deleted branch.

## Why

Production, 2026-11-13, job metadata and counts only: 15 of 71 owners
with fresh provider units committed none of them. Each had a fresh unit
held on a rate-limited vendor at the front, and the ready fresh rows
behind it had no `ready_at` (settled while the stamp was off, or removed
by an operator script that day). The pick could never measure their
wait, so the probe returned nothing on every drain. 7,784 ready fresh
units were affected; they were released by restoring `ready_at` with a
reviewed operator script (7,375 rows written). This change removes the
dependency on that field for provider rows.

## Risk and cost

- Only fresh rows are eligible, as before: the pick returns only fresh
rows, and the transaction re-verifies that the picked row is pending,
ready and fresh behind a catch-up or held-backlog head, and that every
earlier row the probe returned is still unready. The held provider
backlog stays held (while
`BATCH_PIPELINE_PROVIDER_BACKLOG_RELEASE_ENABLED` is off, the default).
- Newly eligible: the pick takes the longest time any ready fresh row on
the probe page has been ready, and when that reaches the head wait it
commits the earliest ready row on the page (this shape is main's). The
change is which rows can supply that time: a ready fresh provider row
without `ready_at` now supplies its settle instant. So such a row can
now pass an unready earlier fresh row, and it can also make an earlier
ready fresh row on the same page eligible, including a GPU row that has
no `ready_at` of its own. That is the intent for provider rows. The
skipped unready row appends later as a late capture, as before.
- No extra reads. No new setting, index, job field, metric or pipeline
state. One warning log line per commit attempt that finds an owner's
first 32 pending fresh rows all unready. The line is not throttled:
every commit attempt that reaches the probe and finds such a page logs
it. An attempt that commits through the strict order does not reach the
probe.

## Known limits

- **Not in this PR: nothing re-offers an owner whose drain left ready
fresh rows waiting.** An owner drains when one of its units settles,
when maintenance finds one of its rows on the global ready page, or when
it carries a hold marker. Since the provider backlog hold the ready page
holds only held backlog rows and no marker is written for a held-backlog
head, so an owner that goes quiet with ready fresh rows inside the head
wait is not drained again (2026-11-13: 23 owners, about 3,400 rows). A
merge change for this was written and reviewed in this PR and then cut
by the rollout lead's ruling after repeated code findings; it goes to
its own PR. Until then an operator script re-offers such owners.

- A fresh unit held on a vendor still waits for the vendor.
- The probe still reads one page of 32. If an owner's first 32 pending
fresh rows are all unready, ready rows behind them are not seen; the new
log line reports it. An earlier version of this PR read further pages;
review found that a probe of several pages is not one consistent read,
and the rollout lead ruled to cut it. A pick that sees past one page,
made inside the transaction, is recorded as a requirement of the metered
release work.
- The probe is a hint read outside the transaction, on main and here
alike: a row it did not return that becomes ready between probe and
transaction can be passed by the picked row, and then commits on a later
drain as a late capture. Unchanged by this PR.
- A GPU row's own settle time is not read: only a provider row supplies
a settle instant. A ready GPU row without `ready_at` still cannot start
the wait by itself, but, as stated under Risk and cost, a later provider
row's settle instant can now make it the row picked.
- The settle instant is the provider intent's `settled_at`. A recovered
provider unit normally carries `ready_at` from recovery; if that were
removed, the pick could use an earlier attempt's settle instant and so
shorten the wait behind an unready row. The row must still be
`result_ready` to be picked.
- A persistent failure of the newest-commits read logs one fallback
warning per tick per instance, unthrottled.

## Deploy

backend-integration and the GPU batch worker, both of which run the
merge. Never roll either below f3902ec: older code releases the held
provider backlog through rows that carry `ready_at`. Off switch: none of
its own; `BATCH_PIPELINE_PROVIDER_MERGE_MEMBERSHIP_ENABLED=false`
removes the settle-instant fallback with the rest of membership.

Must stay clean after deploy: no non-fresh provider commits; share of
under-1h fresh captures unprojected at 10 to 20 minutes; `fallback`
events with `from_mode=recent_discovery` near zero;
`fresh_probe_full_no_ready` lines near zero.

## Tests

- `test_batch_provider_merge_membership.py`: the production shape end to
end (held backlog head, a fresh unit that never settles, ready fresh
rows without `ready_at`): nothing inside the wait, both ready rows after
it, backlog and held unit untouched. Fails without the fix. Also: a full
probe page with no ready row commits nothing and logs the line.
- `test_batch_terminal_poll_skip.py`: the pick uses the settle instant
for provider rows only and only with membership on.
- `test_batch_pipeline_projection_discovery.py`: the failed recent read
records the fallback.
- The tests added here do not sleep or read the wall clock.

Not tested here: production behaviour.

Failure-Class: FC-backlog-release-shares-lane-with-fresh-work

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

## Summary

Implements SCA-2013 (fresh-first step 2/5), test-only.

- Adds `backlog_flood_fresh_latency`: 60 steady fresh owners and a
7,920-row, already-transcribed flood across 30 owners (22x steady hourly
volume), including 396 Parakeet and 7,524 provider catch-up rows.
- Compares `held` and `unmetered` release with same-seed, same-scheduler
no-flood baselines, under both #25213 queue settings (`FIRST_TURN=15`
and `0`). Models eight owner drains, 15/120-second turns,
predecessor-ordered projection, and half-page recent discovery.
- Pins fresh capture-to-projected p50/p90 within 10% for held, own-owner
backlog depth, complete unmetered backlog drain, and a >2x p90
regression in the unmetered FIFO counterfactual.
- Reports the real closed 10–20-minute commit-window guard and pins
seed-1 outputs in a golden. Reserves `release='gated'` explicitly for
step 4.
- Integrates main through quarantine merge `5c0bd5a48031`. The simulator
transactional fresh query now filters borrowed rows before copying the
chosen row; copying hundreds of held backlog payloads per probe made the
imported adapter too slow for this flood. Query selection, ordering, and
golden values are unchanged.

## Why a scenario-specific projection model?

The existing real-`Projector` drain harness cannot drive provider
admission, `OrderedMerge`, and `Serving.reconcile` together. The new
model supplies only those scheduling seams over real merge/serving
output; it does not change production code or owner ordering.

## Incident / current-main distinction

The 2026-11-13 FIFO counterfactual reproduces the incident: seed 1 flood
p90 is 423.5s versus 200.0s baseline (2.118x). With #25213's split queue
enabled, seed 1 p90 is 1.044x baseline. The test runs both full-scale
shapes rather than weakening the 2x incident assertion. Unmetered CLI
still exits 1 under both release/order guards; held exits 0.

## Verification

At head `b66ca1f5d3312a9373375242a586dffd226386c4`, after main
integration:

- `cd backend && python -m pytest
tests/unit/test_pipeline_sim_backlog_flood.py
tests/unit/test_pipeline_sim*.py -q` — **138 passed** in 79.13s; flood
file 35.84s in the loaded suite.
- Flood file alone — **8 passed**, 20.99s wall time (19.86s pytest
time), under the 60s budget. Seed-1 golden unchanged.
- `python -m pytest -m integration
tests/integration/test_store_conformance.py -k "sim and (fresh or
transaction)" -q` — **7 passed**, 236 deselected. This checks the sim
backend only, with no emulator or database service.
- Held seed-1 CLI with `--json` repeated twice — exit 0, `GATE_PASS`,
byte-for-byte identical output.
- Unmetered seed-1 CLI with `--json` — exit 1, `GATE_FAIL
owner_backlog_depth` under the default split queue; the test also pins
FIFO p90 >2x baseline.
- Repository preflight, PR metadata validation and all normal pre-push
checks passed. Final-head hook: **36 preflight checks**, zero type-check
errors, flood file **8 passed in 18.76s** (20s file wall time), pinned
formatting passed.

The first integrated suite was stopped after 191.52s while the imported
adapter was copying backlog rows. The bounded adapter change above
removed that cost; no thresholds, workflow, or golden updates were made.

No production writes, deploys, flags, queue actions, live content, or
credentials were used.


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