Repository navigation
SCA-2049: fix(batch): a provider upload within a day of capture is fresh - #25226
Merged
Merged
Conversation
Since the provider backlog hold, a provider row not stamped fresh is not delivered, and the 10-minute bar shared with the GPU lane classed every late-synced provider upload as backlog (2026-11-13: 167 of 1,195 admissions, none committed). Provider admission now has its own bar, default one day. Failure-Class: FC-backlog-release-shares-lane-with-fresh-work Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review of the provider fresh bar: stamping a 6-24 h late upload fresh also moved it to the fresh side of the assignment-conflict policy, where a conflict that waits on another writer retries instead of holding. A provider row stamped fresh past the ten-minute bar now carries late_upload, and the policy treats it as backfill, as before. Failure-Class: FC-backlog-release-shares-lane-with-fresh-work Co-Authored-By: Claude Fable 5.2 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review round 2: the replay capture allowlist dropped the new job field, so a replayed late provider upload took the fresh conflict lane while production takes backfill. The capture now reads the field and labels the unit backfill. Failure-Class: FC-backlog-release-shares-lane-with-fresh-work Co-Authored-By: Claude Fable 5.2 <[email protected]>
Member
Author
|
Flake record (from the provider-STT drain owner session), not hidden: #25226 at head ac458cb is being merged past one failing check by the rollout lead's ruling (David's 2026-11-03 ruling: force-merge past flakes, fix flakes separately).
|
This was referenced Nov 13, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Nov 13, 2026
#25224 and #25226 each added a name; the merged file declared 277. Co-Authored-By: Claude Fable 5.2 <[email protected]>
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
) ## What changed and why SCA-1994: the six served-provider age-boundary cases each parsed the entire deployment YAML during their measured call. Run 43481408115 attempt 2 crossed the 1.00 s CPU cap on a slow runner even though all assertions passed. Read that immutable config once in a module-scoped fixture, then run the existing boundary assertions against its actual value. This removes five redundant parses and keeps fixture preparation outside the policy calls being measured. This is a separate, one-file test correction from quarantine PR #25221. All sweep-age tests stay in the fast lane. Product code, assertions, CPU thresholds, allowlists, and deployed settings are unchanged. The explicit `now` remains deterministic; a fake clock would not remove YAML parsing cost. ## Product invariants affected none ## How it was verified - Before: all 56 tests passed locally in 2.01 s, with the six affected call phases taking 0.24–0.28 s and exceeding the 0.10 s advisory target. - After: all 56 tests passed locally in 0.68 s with the existing 0.10 s advisory / 1.00 s hard CPU thresholds. One config fixture setup took 0.26 s; affected call phases were below 0.005 s. - All six affected cases also passed with a temporary stricter `BACKEND_FAST_UNIT_FAIL_SECONDS=0.1` and `BACKEND_FAST_UNIT_WARN_SECONDS=0.05`. No threshold configuration is changed by this PR. - `OMI_PR_BODY_FILE=../sweep-age-pr-body.md make preflight`: all 36 checks passed. - `scripts/pr-preflight --metadata-only --pr-body-file ../sweep-age-pr-body.md`: all four checks passed. ## Tests The existing six age-boundary cases and full 56-test file exercise the change. The fixture still reads the checked-in deployment manifest and enforces the unique-setting assertion; policy boundary assertions are unchanged. ## UI evidence UI-Evidence: none -- test-only correction. ## Failure class (fixes) Failure-Class: none This corrects redundant test preparation rather than production timing or policy behavior. ## Release boundary Review-ready test correction only. No production writes, deployment, or release-queue entry while SCA-1894 remains open. This PR does not grant a waiver for #25226. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25236?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/25236?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25236&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. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A provider-route upload admitted within a day of its capture is stamped fresh. Until now the bar was 10 minutes, shared with the GPU lane.
Why
Since the provider backlog hold (#25204), a provider row not stamped fresh does not commit, and it cannot commit in plain order because the owner's held rows sit in front of it. A provider recording that synced more than 10 minutes late was therefore transcribed and never delivered. #25204 stated this limit; it should have been treated as a blocker for closing the incident.
Measured in production on 2026-11-13 (job metadata and counts only), provider-route units admitted between 16:37Z and 17:13Z, after provider merge membership was switched back on:
Change
backend/config/batch_pipeline.py:provider_fresh_capture_lag_seconds(),BATCH_PIPELINE_PROVIDER_FRESH_CAPTURE_LAG_SECONDS, default 86400, clamped to 600–86400.backend/utils/batch_pipeline/provider_stt_admission.py: provider admission stampsfresh_captureagainst that setting.FRESH_CAPTURE_LAG_SECONDS(600) is untouched and the GPU lane (Scheduler.enqueue_in_transaction, GPU priority) still uses it.omi_batch_pipeline_provider_admissions_total{merge_class, lag}withmerge_classinfresh,catch_upandlaginlt10m,lt1h,lt24h,ge24h, so a bulk late sync is visible. Counted per transaction attempt: a retried admission can count twice.The merge is not changed. Rows already admitted are not reclassified: the stamp is written once, at admission.
Ships on
The code default is 86400; the environment setting is the override and the stop action. Deploy: backend-sync, where provider admission runs (image move, live settings kept).
Stop action: set
BATCH_PIPELINE_PROVIDER_FRESH_CAPTURE_LAG_SECONDS=600on backend-sync (new revision, previous one deleted so its instances stop). New admissions go back to the 10-minute bar; rows stamped meanwhile keep their stamp.Must stay clean after deploy: enrichment 200s per minute on backend-integration; share of under-1h captures unprojected at 10–20 minutes. Expected: provider admissions with lag 10 min to 24 h stamped fresh, and committing.
Other readers of the stamp
For a provider row,
fresh_captureis read by:_catch_upand_backlog_held(class), and the fresh-first probe with its query (store.fresh_pending). A late provider row within a day now commits fresh-first, ahead of the held backlog, and is no longer subject to the catch-up depth hold.projection_hold_policy.quarantines_assignment_conflict: a row stamped not-fresh is thebackfilllane, anything elsefresh, when deciding whether an assignment conflict that waits on another writer holds or keeps retrying (it matters only for captures at least six hours old). So that this does not change, a provider row stamped fresh with lag over the GPU bar (600 s) also carrieslate_upload: true, and the policy treats it asbackfill, exactly as before this change. A test pins it.testing/pipeline_sim/store.py(its fresh-pending query) andtesting/batch_replay(labels captures).No other code in
backend/reads the stamp. No reader changes vendor or compute cost: the unit is transcribed by the same provider either way. What changes is its merge class (fresh-first, no depth hold); conflict handling is kept as it was by the newlate_uploadfield. Volume: about 14% of provider admissions are late, about 9% within a day.Known limits
Tuning disclosure
No new pipeline state (no new job state value, no new collection). One new boolean field on the provider job document,
late_upload, written once at admission on late-but-fresh rows and read only by the assignment-conflict policy; the replay capture tool carries it.Product invariants affected
none
Failure class (fixes)
Failure-Class: FC-backlog-release-shares-lane-with-fresh-work
Third fix in this class: the hold that stopped the unmetered release classified new late uploads as backlog.
Tests
New in
tests/unit/test_batch_provider_merge_membership.py: a provider upload two hours late and one exactly a day late are fresh, one second over a day is not; the setting at 600 restores the old bar, and its bounds; a late provider upload commits ahead of a held backlog and the backlog stays held; the GPU constant is still 600; the counter moves once per admission in each lag bucket. Two existing tests that used a two-hour-late upload as their catch-up case now use one more than a day late.Not tested here: production behaviour, and whether the counter is scraped on backend-sync.
🤖 Generated with Claude Code