Repository navigation
fix(batch): collapse projection pages and prioritize productive drains - #24697
Conversation
Failure-Class: FC-bounded-discovery-pinned-by-blocked-page
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
4 issues found across 12 files
Confidence score: 3/5
- In
projection_followup.py, a sync receipt can take an owner’s page slot and defer an async receipt until a later discovery pass. Select or rotate among async rows before collapsing by owner. - In
projection_discovery.py, partially malformed bindings can be grouped as canonical owner hints. Require the binding’s identity fields andsidmembership insegment_ids; otherwise key the row independently. - The metric example in
2026-11-05-projection-heavy-owner-drain.mduses a literalsource="sweep|followup"label, so copying it returns no series. Use a regex matcher or list both label values. - The note in
2026-11-05-projection-heavy-owner-drain.mdomits productive turns ending at a deadline or budget from the head-requeue rule. Document that these turns can also receive two consecutive head requeues.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-heavy-owner-drain.md">
<violation number="1" location="backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-heavy-owner-drain.md:16">
P3: The note omits productive budget/limit turns from the head-requeue rule. Document that productive turns ending at either a deadline or budget can receive the two consecutive head requeues, so the fairness behavior is not understated.</violation>
<violation number="2" location="backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-heavy-owner-drain.md:21">
P2: The collapsed-row metric example uses a literal `source="sweep|followup"` label, so copying it into a Prometheus query returns no series. Document the alternatives with a regex matcher or list the two label values separately.</violation>
</file>
<file name="backend/utils/batch_pipeline/projection_followup.py">
<violation number="1" location="backend/utils/batch_pipeline/projection_followup.py:208">
P2: `candidates()` collapses an owner before filtering pinned sync policy, so a sync receipt can consume the owner’s page slot and defer an async receipt until a later discovery pass. Select or rotate among async rows before applying the one-per-owner collapse, while preserving the synchronous path’s existing filtering.</violation>
</file>
<file name="backend/utils/batch_pipeline/projection_discovery.py">
<violation number="1" location="backend/utils/batch_pipeline/projection_discovery.py:20">
P2: This groups partially malformed bindings as if they were canonical owner hints. Require the binding's required identity fields and membership of `sid` in `segment_ids` before grouping; otherwise key the row independently so malformed data reaches the normal recovery path.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| on by default with no new flag. Revert this change to roll back; pending rows | ||
| remain durable. The existing owner-drain switch restores sweep walks. | ||
|
|
||
| `omi_batch_projection_page_collapsed_rows_total{source="sweep|followup"}` and |
There was a problem hiding this comment.
P2: The collapsed-row metric example uses a literal source="sweep|followup" label, so copying it into a Prometheus query returns no series. Document the alternatives with a regex matcher or list the two label values separately.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-heavy-owner-drain.md, line 21:
<comment>The collapsed-row metric example uses a literal `source="sweep|followup"` label, so copying it into a Prometheus query returns no series. Document the alternatives with a regex matcher or list the two label values separately.</comment>
<file context>
@@ -0,0 +1,25 @@
+on by default with no new flag. Revert this change to roll back; pending rows
+remain durable. The existing owner-drain switch restores sweep walks.
+
+`omi_batch_projection_page_collapsed_rows_total{source="sweep|followup"}` and
+`omi_batch_projection_drain_head_requeues_total` expose the scheduling changes
+and are retained by the serving GMP profile. Unit tests cover read/attempt counts,
</file context>
| `omi_batch_projection_page_collapsed_rows_total{source="sweep|followup"}` and | |
| `omi_batch_projection_page_collapsed_rows_total{source=~"sweep|followup"}` and |
| def candidates(self): | ||
| self.discovery.states = PROJECTION_FINISH_STATES if projection_followup_page_enabled() else None | ||
| page = [] | ||
| for owner, rows in owner_page(self.projector.store, self.discovered()): |
There was a problem hiding this comment.
P2: candidates() collapses an owner before filtering pinned sync policy, so a sync receipt can consume the owner’s page slot and defer an async receipt until a later discovery pass. Select or rotate among async rows before applying the one-per-owner collapse, while preserving the synchronous path’s existing filtering.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/batch_pipeline/projection_followup.py, line 208:
<comment>`candidates()` collapses an owner before filtering pinned sync policy, so a sync receipt can consume the owner’s page slot and defer an async receipt until a later discovery pass. Select or rotate among async rows before applying the one-per-owner collapse, while preserving the synchronous path’s existing filtering.</comment>
<file context>
@@ -198,16 +203,29 @@ def clock_now(self) -> float | None:
def candidates(self):
+ self.discovery.states = PROJECTION_FINISH_STATES if projection_followup_page_enabled() else None
+ page = []
+ for owner, rows in owner_page(self.projector.store, self.discovered()):
+ ids = [sid for sid, _ in rows]
+ key = ids[0]
</file context>
| except Exception: | ||
| job = {} | ||
| binding = job.get('projection_binding') | ||
| owner = binding.get('owner_id') if isinstance(binding, dict) else None |
There was a problem hiding this comment.
P2: This groups partially malformed bindings as if they were canonical owner hints. Require the binding's required identity fields and membership of sid in segment_ids before grouping; otherwise key the row independently so malformed data reaches the normal recovery path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/batch_pipeline/projection_discovery.py, line 20:
<comment>This groups partially malformed bindings as if they were canonical owner hints. Require the binding's required identity fields and membership of `sid` in `segment_ids` before grouping; otherwise key the row independently so malformed data reaches the normal recovery path.</comment>
<file context>
@@ -3,6 +3,26 @@
+ except Exception:
+ job = {}
+ binding = job.get('projection_binding')
+ owner = binding.get('owner_id') if isinstance(binding, dict) else None
+ owner = owner if isinstance(owner, str) and owner else None
+ groups.setdefault((owner, None if owner else sid), []).append((sid, job))
</file context>
| owner = binding.get('owner_id') if isinstance(binding, dict) else None | |
| owner = ( | |
| binding.get('owner_id') | |
| if isinstance(binding, dict) | |
| and isinstance(binding.get('owner_id'), str) | |
| and bool(binding.get('owner_id')) | |
| and isinstance(binding.get('job_id'), str) | |
| and bool(binding.get('job_id')) | |
| and isinstance(binding.get('content_id'), str) | |
| and bool(binding.get('content_id')) | |
| and isinstance(binding.get('segment_ids'), list) | |
| and sid in binding['segment_ids'] | |
| else None | |
| ) |
| their existing behavior. No authorization, predecessor, privacy, receipt or owner | ||
| claim fence changes; see [the pipeline contract](../../listen_pusher_pipeline.mdx). | ||
|
|
||
| A productive turn ending at its deadline gets up to two consecutive queue-head |
There was a problem hiding this comment.
P3: The note omits productive budget/limit turns from the head-requeue rule. Document that productive turns ending at either a deadline or budget can receive the two consecutive head requeues, so the fairness behavior is not understated.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-heavy-owner-drain.md, line 16:
<comment>The note omits productive budget/limit turns from the head-requeue rule. Document that productive turns ending at either a deadline or budget can receive the two consecutive head requeues, so the fairness behavior is not understated.</comment>
<file context>
@@ -0,0 +1,25 @@
+their existing behavior. No authorization, predecessor, privacy, receipt or owner
+claim fence changes; see [the pipeline contract](../../listen_pusher_pipeline.mdx).
+
+A productive turn ending at its deadline gets up to two consecutive queue-head
+requeues, then yields to the tail. Zero-advance turns keep FIFO behavior. This is
+on by default with no new flag. Revert this change to roll back; pending rows
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 075118aff5
ℹ️ 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".
| except Exception: | ||
| job = {} |
There was a problem hiding this comment.
Instrument the failed owner-hint fallback
When a job-hint read raises, this branch silently substitutes an empty job and continues without owner collapsing. If the subsequent normal read succeeds, the failure is never reported, so repeated hint-read failures can disable the optimization and add Firestore reads without exposing the degraded path. Call utils.observability.fallback.record_fallback here, as required for new fallbacks by backend/AGENTS.md.
AGENTS.md reference: backend/AGENTS.md:L322-L322
Useful? React with 👍 / 👎.
| if owner: | ||
| self.page_after.pop(key, None) | ||
| self.page_after[key] = sid | ||
| if len(self.page_after) > MAX_BACKOFF_ROWS: | ||
| self.page_after.pop(next(iter(self.page_after))) |
There was a problem hiding this comment.
Preserve sibling rotation when the tracking cap is exceeded
When a discovery cycle visits more than 20,000 owner slices, later slices evict the earlier slices' rotation entries before discovery returns to them—even singleton slices consume entries. If a slice's first receipt remains ready while waiting for a persisted sibling, and backoff is disabled or expires before the next cycle, every cycle selects that same first receipt and the sibling is never offered. This can permanently stall content completion despite repeated successful discovery passes. Reproducing the selection with one two-row owner followed by 20,000 singleton owners selects the first row on every cycle. Preserve progress across tracking eviction, rather than always restarting an untracked slice at its first row.
Useful? React with 👍 / 👎.
| if drain: | ||
| heads = [] | ||
| for owner, rows in owner_page(self.store, page): | ||
| heads.append(rows[0][0]) |
There was a problem hiding this comment.
Keep synchronous finish retries outside assignment-page collapse
With BATCH_PIPELINE_PROJECTION_PENDING_PAGE_ENABLED=false and owner drains enabled, this page contains persisted/ready receipts as well as pending assignments, but collapsing always retains only the first row per owner. Consider synchronous-policy siblings A and B whose assignments have advanced the watermark through B: A is ready but cannot complete until B's failed post-persist work is retried. Every sweep selects A and skips B; the requested owner drain starts after watermark B, so it cannot retry B, and async follow-up discovery filters out synchronous policies. Since _sweep_finish only runs with pending-page mode enabled, the content can remain stuck indefinitely. Restrict this collapse to assignment-only pages or separately retain finish retries in mixed-page mode.
Useful? React with 👍 / 👎.
…recovery Failure-Class: FC-bounded-discovery-pinned-by-blocked-page
…24707) ## Problem #24697 (6547604) has served on backend-integration since 2026-11-05 14:53Z (revision 01572-22x) and regressed projection drain. Owner-drain turn logs, Cloud Logging, read-only: | window | turns/s | rows advanced/s | claim_busy share | |---|---|---|---| | 14:30-14:45Z (pre-train) | 3.4 | 11.9 | 70% | | 15:30-15:33Z (post) | 30 | 8.4 | 60% (of 10x more turns) | Cause: `Projector` sweep now calls `request_drain(owner)` for every collapsed owner not in this process's `draining` set, on every sweep. The de-dupe is per process only, so across ~48 integration instances the same heavy owners are requested everywhere. Turns hit the owner claim held elsewhere (`claim_busy`) or find nothing (`end`) in ~0.8 s. `owner_page` also adds one jobs read per page row. Projection over-SLA kept rising (178.7k at 15:40Z), and rows advanced fell 30%. ## Fix Revert #24697 (`git revert -m 1 6547604`). The single conflict was the GMP keep-list in `backend/deploy/cloud_run_gmp_sync.yaml`. I kept main's version, which still lists the two now-unemitted counter names: harmless, with no keep-list churn. No later commit touched the reverted files, and nothing references the removed symbols. A forward fix (request drains only for owners without a live claim, or rate-limit requests per owner, behind a kill switch) is a follow-up. ## Tests `bin/omi-heavy run -- .venv/bin/python -m pytest -q` over the #24697 test set plus `test_attach_cloud_run_gmp_sidecar.py`: **463 passed**. ## Risk / rollback Restores the pre-#24697 projection scheduler, which served all morning. Rollback = revert this revert. 🤖 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/24707?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/24707?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24707&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. -->
…4710) ## Problem Fleet instances repeatedly request the same projection owners. Requests arriving during a losing claim-busy turn immediately re-enter the FIFO and repeat the contention. ## Fix - Read-only GET of the existing Redis owner-claim key at initial launch, off the event loop; held owners defer admission and any peek error admits as before. - Jittered 5–15 second backoff only for claim_busy turns re-requested through `again`. Productive `more=True` continuations retain immediate FIFO progress and bypass the new admission peek. - Cap retry timers and clear them on close; return overflow intent to the existing next-serving-pass handoff. - Export skipped-drain and claim-busy-backoff counters through the serving GMP keep-list. Based on merged revert #24707 (e88fb82); only L2 is included. Prefetch, capacity, page sizes, assignment fencing and the #24697 collapse remain unchanged. The optional head item was skipped: the cited code is a read-before-owner-draining skip, not a clear head-staleness skip. ## Tests - Requested stage-env/budget/owner-drain guard through `BACKEND_UNIT_TEST_FILE_LIST=/tmp/l2f.txt bash test.sh`: **97 passed** across 3 isolated files. - Original focused owner-drain/projection/simulation/sweep/metrics/GMP set: **426 passed**. - Policy suite: **73 passed**; switch semantics cover shadow and serve parser modes. - Registry generator/parser check passed; stage-env ratchet baseline is unchanged. - The switch is now read through `config.batch_pipeline` / `config.policy.kill_switch`, with an owned helper-backed flag-budget entry and generated registry documentation. Only `off` disables it in every parser mode. - Final repository gates and exact-head GitHub CI are being rerun for the follow-up commit. - Code and hermetic unit tests only; no production access or GCP tier used. ## Risk and rollback Low-risk advisory scheduling change; durable result rows remain discoverable. `PROJECTION_DRAIN_CLAIM_AWARE=off` restores previous admission, re-request and FIFO behavior. Default is on; only `off` disables it. Failure-Class: FC-immediate-retry-loses-shared-cas Line-Count-Exception: backend/config/batch_pipeline.py | 818 -> 825 | Add the requested seven-line policy kill-switch accessor to remove the raw stage env read; no stage-env ratchet baseline change.
…rain requeue Reverts 6547604 (BasedHardware#24697). In prod on backend-integration (rev 01572-22x, serving since 2026-11-05 14:53Z) every sweep re-requests drains for each collapsed owner. The only de-dupe is per process, so across ~48 instances the same heavy owners are requested everywhere. Owner-drain turns rose from 3.4/s to 30/s, about 60% ended claim_busy, and rows advanced fell from 11.9/s to 8.4/s (-30%). owner_page also adds a jobs read per page row. The GMP keep-list keeps the two counter names (harmless, now unemitted) so the conflict with later keep-list edits stays empty. Evidence: omi-workspace data/run-2026-11-05-omi-pipeline/diag-24697-1540Z.md Co-Authored-By: Claude Opus 5.5 <[email protected]>
…4943) <!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} --> _Requested by **David**_ ## What changes Retro P6 adds `batch-pipeline-tuning-disclosure` to the shared manifest in both local and CI lanes. Numeric capacity assignments and concurrency environment defaults in the batch config, pipeline source, worker/pusher charts, and `backend/utils/pusher_*.py` require numeric disclosures in one PR-body section naming a matched knob: before/after, from/to, or a nearby numeric arrow (`6 -> 4` or `6 → 4`). A knob with no removed numeric assignment may instead use `new: <num>` or `initial <num>`. Newly added literals directly assigned or compared to state-like names, or passed as state/status/phase/disposition/outcome/reason kwargs, must name an exit, terminal, dead-letter, re-entry, clear, or recovery path; literals already anywhere in the merge-base tree are exempt. `Numbers-waived: <reason>` and `State-exit-waived: <reason>` waive their respective requirement and echo the reason. HTML comments, fenced code blocks and inline code are stripped before validating disclosures, state exits or waivers. Logging arguments and literals merely near state-related words do not count as new states. The same single manifest entry runs hermetic regression tests before checking the body. Only changed lines trigger detection; flags, comment-only lines, and unchanged context do not count. The detector deliberately misses indirect/formula tuning: this is a disclosure ratchet. David approved this exact manifest and script/test change on **2026-11-08 at 16:13Z**. No workflow file changed. The change is limited to `.github/checks-manifest.yaml` and the two P6 files under `.github/scripts/`. ## Why this check The retro's #24481 HPA retune is the design precedent; the sweep below exercises HPA bounds changes such as #24742. Its from/to wording is supported, but its knob names are only in inline code, which the requested prose-only rule excludes. Existing product-invariant and failure-class checks validate different author declarations; neither detects capacity knobs or new lifecycle literals. This check reuses the manifest's existing diff/metadata plumbing without changing workflow wiring or inventing another PR orchestration layer. ## Product invariants affected none Failure-Class: none ## Merged-PR false-positive sweep (2026-11-08T20:01:42.025036+00:00) **200 merged PRs screened; 69 trigger-touching diffs checked; 16 would fail and 53 would pass.** 14 failing PRs require numeric disclosures; 2 require state declarations (3 state literals total). The prior sweep reported 18 failures; the refreshed capped corpus also advances its merge cutoff. Method: `gh pr list --repo BasedHardware/omi --state merged --search 'merged:>=2026-10-09' --limit 200 --json number,title,body,mergeCommit,mergedAt,files`, followed by `gh pr diff <number> --repo BasedHardware/omi` for matching paths. Full paginated file lists were checked whenever the initial listing reached 100 files. Each diff was checked against its PR body and reconstructed PR merge-base: merge-parent merge-base for normal merges; PR-head/merge-parent merge-base cross-checked with the recorded PR base for one-parent merges. State candidates use a whole-tree lookup at that merge-base. The capped corpus spans **2026-11-04T12:58:21Z through 2026-11-08T19:20:24Z**: a sample within the requested 30-day window, not full-month coverage. No production reads or GCP tier were used. The stricter state association passes #24743 (the prior proximity-only candidate). #24733 and #24729 now pass the expanded numeric wording. The required inline-code stripping means #24742 still fails: its from/to numbers are supported, but its matched knob names appear only in inline code. #24884 and #24725 also fail when their state names are excluded as inline code. These are explicit effects of the requested prose-only policy, not claims that those historical PRs omitted all semantic explanation. Sample of would-fail PRs: | PR | Detected change | Missing disclosure | | --- | --- | --- | | [#24889](#24889) | Tuning: `max_count` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24884](#24884) | New state: `record_barrier_aged` | State literal and exit declaration in prose, or State-exit-waived (inline code is excluded) | | [#24799](#24799) | Tuning: `MIN_STORAGE_PCM_BUDGET_MB` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24742](#24742) | Tuning: `maxReplicas`, `minReplicas` | Matched knob name in prose alongside the existing from/to numbers | | [#24736](#24736) | Tuning: `PAGE_SIZE` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24725](#24725) | New state: `marker_retry_overflow`, `marker_write_failed` | State literal and exit declaration in prose, or State-exit-waived (inline code is excluded) | | [#24716](#24716) | Tuning: `limit` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24712](#24712) | Tuning: `MAX_OWNER_DRAINS` | Numeric before/after, from/to or arrow disclosure naming a matched knob in prose, or Numbers-waived | | [#24710](#24710) | Tuning: `MAX_DELAYED_OWNERS` | Initial/new numeric value naming a matched knob in prose, before/after disclosure, or Numbers-waived | | [#24707](#24707) | Tuning: `MAX_HEAD_REQUEUES` | Numeric before/after, from/to or arrow disclosure naming a matched knob in prose, or Numbers-waived | All would-fail PRs: #24889, #24884, #24799, #24742, #24736, #24725, #24716, #24712, #24710, #24707, #24703, #24697, #24689, #24680, #24643, #24601. ## Validation - **26 focused regression tests passed** on head `1788dd10315e7a709dcaf6150838907638386ad0`, covering fenced/inline examples, direct state association (including the logging regression), from/to and arrows, and first-time versus changed numeric values. - **`make preflight` passed all 14 selected local checks**, including 26 P6 tests and 78 manifest-contract tests, with `OMI_PR_BODY_FILE` and `BACKEND_UNIT_FILE_BUDGET_SECONDS=900`. The normal bounded pre-push gate also passed all 14 checks using the final body and the same budget, with `GOOGLE_APPLICATION_CREDENTIALS` and every `CLOUDSDK_*` variable removed. - `scripts/pr-preflight --suggest` required no invariant citations; `Failure-Class: none` is declared above. - No workflow file changed; only the manifest and two P6 scripts differ from the merge base. - No production reads or GCP tier used. Full-month coverage beyond the 200-PR cap, indirect/formula tuning and product/runtime behavior are not established by this check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Problem
Heavy owners fill projection discovery pages with non-head rows. Each row repeats
full projection reads and predecessor checks even though only the chain head can
advance. Productive 120-second drain turns then rejoin behind every waiting owner.
Fix
assignment sweep attempts one page head per owner, counts collapsed rows as
waiting, and requests that owner's drain once.
page slice on later passes so ready receipts cannot pin their unfinished
siblings, including owners spanning several pages. Rotation state is bounded.
to the tail. Zero-advance turns retain FIFO behavior. Owner claim leases,
predecessor fencing and transactional ordering remain unchanged.
recovery tests verify receipt readiness over bounded owner-collapsed passes.
module and retain both metric families in the serving GMP profile.
Tests
cd backend && .venv/bin/python -m pytestwith-q --tb=shortfor these files,through
bin/omi-heavy run --: 359 passed (including the slow simulation tests).tests/unit/test_batch_pipeline_owner_drain.pytests/unit/test_batch_pipeline_projection_followup.pytests/unit/test_batch_pipeline_projection_discovery.pytests/unit/test_batch_pipeline_owner_chain_projection.pytests/unit/test_batch_pipeline_metrics.pytests/unit/test_batch_pipeline_sweep_owner_chain.pytests/unit/test_batch_pipeline_followup_desync.pytests/unit/test_batch_pipeline_projection.pytests/unit/test_batch_pipeline_projection_repair.pytests/unit/test_pipeline_sim_projection_drain.pytests/unit/test_batch_pipeline_followup_reads.pytests/unit/test_batch_pipeline_recovery_owner_only.pyThe focused follow-up/read-budget/restart/desync run also passed: 121 passed.
BACKEND_UNIT_FILE_BUDGET_SECONDS=900 OMI_PR_BODY_FILE=<this body> make preflightthrough
omi-heavy: 36 checks passed. PR metadata validation: 4 checks passed.The longer supported file budget accommodates CPU contention on the shared host.
Risk and rollback
The ID-only discovery API still requires one job hint read per page row; collapsed
non-heads avoid full projection reads and predecessor transactions. A page head
may be beyond the true chain head; the existing predecessor replay resumes from
the durable watermark. Bounded head requeues trade at most two extra turns of
latency for other queued owners against faster productive chain continuation.
No new flag. Revert this commit to roll back; obligations remain durable. The
existing owner-drain switch restores the sweep walk path. No production access,
deployment, real Firestore integration run or production throughput measurement
was performed. The operator repair script is untouched.
Failure-Class: FC-bounded-discovery-pinned-by-blocked-page
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1698 -> 1712 | Keep the small pre-attempt page collapse at the sweep boundary; shared grouping lives in projection_discovery.py.