Skip to content

fix(batch-projection): desync async follow-up discovery across serving processes - #24680

Merged
Git-on-my-level merged 9 commits into
mainfrom
fix/projection-followup-desync
Nov 5, 2026
Merged

Git-on-my-level merged 9 commits into
mainfrom
fix/projection-followup-desync

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What

Async projection follow-ups (backend-integration serving) get a per-process discovery offset and a bounded per-process backoff, plus an outcome counter. Both are behind one ship-on knob:

  • BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS: default 900; 0 is the kill switch and restores today's head-first discovery with immediate retry.
  • Offset. A process's first follow-up discovery page starts at a hashed point (host, pid, start time) between the oldest persisted/ready commit and now. The page still wraps to the head at its end, and every pass also wraps once its cursor reaches commits made after that pass began. This high-water mark is re-armed on each wrap (Luna r1/r2 P1), so a tail that keeps every page full can neither starve older rows nor strand a row skipped in backoff; each cycle revisits every row committed before it began. A seed past the newest row wraps to the head in the same pass. The seed never moves a cursor that discovery already holds, and a failed seed read falls back to head-first.
  • Backoff. A row this process saw blocked, retry, timeout, incomplete (content not finishable yet) or claim_busy is skipped in this process's own discovery. The skip is 60 s, doubling to the ceiling. claim_busy never escalates, and any other outcome clears the entry. The skip is in memory only (bounded at 20k rows) and is bypassed by targeted and owed wakes. Durable rows, receipts and fences are unchanged.
  • Counter. omi_batch_pipeline_projection_followup_outcomes_total{outcome}: completed, incomplete, blocked, retry, timeout, claim_busy, coalesced, sync_owned, backoff_skipped, seeded.
  • Slots. BATCH_PIPELINE_PROJECTION_FOLLOWUP_SLOTS makes the per-process follow-up slot count tunable. The default is unchanged at 4 (range 1–16).
  • Firestore. projection_page accepts the seed cursor (committed_at, '') as start_at(committed_at). The Postgres and sim stores already compare it correctly as a tuple.

Why

Measured 2026-11-05 05:20–05:45Z, read-only (omi-workspace data/run-2026-11-04-gpueff/projection-backlog-2026-11-05.md):

  • The projection leg over the 2 h SLA rose from 9.3k to 47.4k in 6 h while commits held flat at about 25k/h.
  • By state: pending (assignment) 1.8k, persisted 30.3k, ready 15.5k. Assignment keeps up; async follow-ups do not.
  • The oldest persisted/ready rows span about 450 owners (7–82 h old), so per-owner serialization isn't the cause.
  • backend-integration runs 62–109 instances at CPU p50 about 45%. Follow-ups take about 2 s per unit, so nominal slot capacity far exceeds about 7 commits/s.
  • Every process pages the same global (projection_state, committed_at) head with its own cursor. After a roll they move in lockstep, re-trying the same unchanged blocked receipts and skipping rows a peer had just claimed, without recording it.
  • lead2 ruled GO on this fix (bus a1e1a1).

Risk

  • Coverage. No row is skipped forever. The offset only moves the first page; the keyset page wraps at its end, so one cycle visits every row (test_every_offset_covers_every_row_within_one_wrap). Backoff is per process and bounded by the knob (≤ 3600 s, default 900); other processes and targeted/owed wakes are unaffected.
  • Latency. A row blocked on an external sibling can wait up to the ceiling before this process retries it. The sibling's own follow-up still probes completion as soon as it finishes.
  • Reads. One extra 1-row read per process at start. Backoff removes per-row job reads for skipped rows.

Rollback / kill switch: BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS=0 on backend-integration (env-only). The whole existing suite passes unchanged under =0.

Post-roll checks (Cloud Run train; 1 h vs the hour before)

  1. Slope of omi_batch_timeliness_new_over_sla_units{leg="projection"} falls (pre-roll: +3k/h); persisted/ready over-SLA counts fall.
  2. omi_batch_pipeline_projected_segments_total rate not down; the completed share of followup_outcomes_total up.
  3. claim_busy and backoff_skipped rates visible (new baseline); timeout not up.
  4. backend-integration CPU and Firestore reads not up sharply.

Failure-Class: none

Tests

  • New tests/unit/test_batch_pipeline_followup_desync.py (offset, coverage, seed fail-open/skew/held cursor, backoff bound/escalation/clear/memory cap, kill switch, targeted bypass, run outcomes, slots, knob parsing).
  • Existing follow-up tests that pin head-first or immediate-retry behavior now run under the kill switch, with a comment.
  • 122 batch_pipeline/projection/flag/monitoring unit files: 3,327 passed.

Owner: cl2-gpueff. Merge and Cloud Run train: lead2.

🤖 Generated with Claude Code

…g processes

Each backend-integration process paged the same persisted/ready head in
lockstep, re-trying unchanged blocked receipts and silently skipping rows a
peer had claimed; the follow-up leg grew past 45k over SLA at ~45% CPU.

- per-process hashed discovery offset (one 1-row seed read; page still wraps)
- bounded per-process backoff for blocked/retry/timeout/incomplete/claim_busy
- omi_batch_pipeline_projection_followup_outcomes_total{outcome}
- BATCH_PIPELINE_PROJECTION_FOLLOWUP_SLOTS (default 4)

Kill switch: BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS=0 restores
head-first discovery with immediate retry.

Failure-Class: none

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

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T07:41:58.188038Z aa752c4 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.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 10 files

Confidence score: 3/5

  • The seed branch in backend/database/batch_pipeline_store.py supplies a cursor without the document-name value required by the query ordering, so Firestore rejects the query and seeding can fail. Include the ordered document-name value in the cursor.
  • The description in config/feature-flags.yaml does not match runtime backoff behavior: active rows remain filtered after cursor wraparound, incomplete also backs off, and claim_busy stays at 60 seconds. Update the description to match those rules.
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/database/batch_pipeline_store.py">

<violation number="1" location="backend/database/batch_pipeline_store.py:323">
P2: The seed branch passes an incomplete cursor to a query ordered by both `committed_at` and `__name__`, which the Firestore client rejects because the cursor lacks the ordered document-name value. `seed_offset` then fails open to head-first discovery on every process, leaving the backlog desynchronized; rebuild the seed query with only `committed_at` ordering (or provide a valid two-field cursor) and cover it with an emulator/SDK test.</violation>
</file>

<file name="config/feature-flags.yaml">

<violation number="1" location="config/feature-flags.yaml:208">
P2: This registry description misstates the backoff contract: active backoff rows are filtered even after cursor wraparound, `incomplete` also backs off, and `claim_busy` stays at 60 seconds instead of doubling. Describe the exact outcomes and say that a cycle visits every row not currently backed off, then regenerate the generated registry.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

query = collection.where('projection_state', 'in', list(states)).order_by('committed_at').order_by('__name__')
if after is not None:
if after is not None and after[1] == '':
query = query.start_at({'committed_at': after[0]})

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: The seed branch passes an incomplete cursor to a query ordered by both committed_at and __name__, which the Firestore client rejects because the cursor lacks the ordered document-name value. seed_offset then fails open to head-first discovery on every process, leaving the backlog desynchronized; rebuild the seed query with only committed_at ordering (or provide a valid two-field cursor) and cover it with an emulator/SDK test.

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/database/batch_pipeline_store.py, line 323:

<comment>The seed branch passes an incomplete cursor to a query ordered by both `committed_at` and `__name__`, which the Firestore client rejects because the cursor lacks the ordered document-name value. `seed_offset` then fails open to head-first discovery on every process, leaving the backlog desynchronized; rebuild the seed query with only `committed_at` ordering (or provide a valid two-field cursor) and cover it with an emulator/SDK test.</comment>

<file context>
@@ -312,12 +312,16 @@ def projection_page(
     query = collection.where('projection_state', 'in', list(states)).order_by('committed_at').order_by('__name__')
-    if after is not None:
+    if after is not None and after[1] == '':
+        query = query.start_at({'committed_at': after[0]})
+    elif after is not None:
         query = query.start_after({'committed_at': after[0], '__name__': collection.document(after[1])})
</file context>
Suggested change
query = query.start_at({'committed_at': after[0]})
query = collection.where('projection_state', 'in', list(states)).order_by('committed_at').start_at(
{'committed_at': after[0]}
)

Comment thread config/feature-flags.yaml
- {"key":"BATCH_PIPELINE_RECOVERY_POLICY_REFRESH_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; a quarantined held unit whose recorded recovery policy is disabled and which has no recovery intent (no paid call authorized) re-resolves the recovery setting at sweep or dispatch, and adopts it only when it is now enabled","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","ramp":{"cohorts":["all held units at deploy (default on)"],"clean_metric":"recovery sweep outcome=disabled count falls to zero and paid recovery starts stay within the per-owner allowance","expander":"dazheng (two-lane lead)","done_by":"2026-10-27"},"notes":"Spends at most the one at-most-once paid recovery the unit would have had if admitted while recovery was on; the existing allowance/cap gates and RecoveryStore.start fence still apply. An enabled snapshot is never re-resolved or downgraded. False restores the frozen snapshot (outcome=disabled forever). See backend/docs/batch-pipeline-serving.md."}
- {"key":"BATCH_PIPELINE_HELD_PARTIAL_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; publish healthy siblings and charge their speech through a partial ledger while unresolved units retain phone custody","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","ramp":{"cohorts":["all batch uploads at deploy (default on)"],"clean_metric":"batch_v1 ledgers in processing over 6 h fall to the count with a sibling still recovering, with no new projection_completed regressions and zero paid recovery calls from the scan","expander":"dazheng (two-lane lead)","done_by":"2026-10-27"},"notes":"The ledger remains partial, owned by its batch job, with failed_segments=held_segments. Status polls and duplicate uploads return processing/batch_unit_held with projected IDs and a five-minute poll hint. No provider, job, intent, merge or retention mutation from the scan. Recovery upgrades to completed and charges only remaining speech. False stops new partials; existing partials remain nonterminal and can still upgrade. See backend/docs/batch-pipeline-serving.md."}
- {"key":"BATCH_PIPELINE_PROJECTION_PREFETCH","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default 4; an owner-chain walk reads the next N rows' successor links, job bindings, result payloads and audio manifests ahead of the chain, and runs the candidate lookup beside context and build","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","notes":"0 is the kill switch (every input read on the chain as before); malformed or out-of-range values (above 8) keep 4. Only immutable inputs are read ahead; mutable receipt state is read fresh and every assignment transaction rereads its candidates. See backend/docs/batch-pipeline-serving.md."}
- {"key":"BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default 900; each serving process starts async follow-up discovery at a hashed point in the persisted/ready backlog and skips a row it saw blocked, failed, timed out or claimed elsewhere for 60 s doubling up to this many seconds","fail":"open","owner":"dazheng","created":"2026-11-05","terminal":"keep","decision":"keep","notes":"0 is the kill switch (head-first discovery, immediate retry, as before); malformed or out-of-range values (negative, NaN, above 3600) keep 900. The skip is process memory only; targeted and owed wakes bypass it, and the page still wraps to the head, so one cycle visits every row."}

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: This registry description misstates the backoff contract: active backoff rows are filtered even after cursor wraparound, incomplete also backs off, and claim_busy stays at 60 seconds instead of doubling. Describe the exact outcomes and say that a cycle visits every row not currently backed off, then regenerate the generated registry.

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 config/feature-flags.yaml, line 208:

<comment>This registry description misstates the backoff contract: active backoff rows are filtered even after cursor wraparound, `incomplete` also backs off, and `claim_busy` stays at 60 seconds instead of doubling. Describe the exact outcomes and say that a cycle visits every row not currently backed off, then regenerate the generated registry.</comment>

<file context>
@@ -205,6 +205,8 @@ flags:
   - {"key":"BATCH_PIPELINE_RECOVERY_POLICY_REFRESH_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; a quarantined held unit whose recorded recovery policy is disabled and which has no recovery intent (no paid call authorized) re-resolves the recovery setting at sweep or dispatch, and adopts it only when it is now enabled","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","ramp":{"cohorts":["all held units at deploy (default on)"],"clean_metric":"recovery sweep outcome=disabled count falls to zero and paid recovery starts stay within the per-owner allowance","expander":"dazheng (two-lane lead)","done_by":"2026-10-27"},"notes":"Spends at most the one at-most-once paid recovery the unit would have had if admitted while recovery was on; the existing allowance/cap gates and RecoveryStore.start fence still apply. An enabled snapshot is never re-resolved or downgraded. False restores the frozen snapshot (outcome=disabled forever). See backend/docs/batch-pipeline-serving.md."}
   - {"key":"BATCH_PIPELINE_HELD_PARTIAL_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; publish healthy siblings and charge their speech through a partial ledger while unresolved units retain phone custody","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","ramp":{"cohorts":["all batch uploads at deploy (default on)"],"clean_metric":"batch_v1 ledgers in processing over 6 h fall to the count with a sibling still recovering, with no new projection_completed regressions and zero paid recovery calls from the scan","expander":"dazheng (two-lane lead)","done_by":"2026-10-27"},"notes":"The ledger remains partial, owned by its batch job, with failed_segments=held_segments. Status polls and duplicate uploads return processing/batch_unit_held with projected IDs and a five-minute poll hint. No provider, job, intent, merge or retention mutation from the scan. Recovery upgrades to completed and charges only remaining speech. False stops new partials; existing partials remain nonterminal and can still upgrade. See backend/docs/batch-pipeline-serving.md."}
   - {"key":"BATCH_PIPELINE_PROJECTION_PREFETCH","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default 4; an owner-chain walk reads the next N rows' successor links, job bindings, result payloads and audio manifests ahead of the chain, and runs the candidate lookup beside context and build","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","notes":"0 is the kill switch (every input read on the chain as before); malformed or out-of-range values (above 8) keep 4. Only immutable inputs are read ahead; mutable receipt state is read fresh and every assignment transaction rereads its candidates. See backend/docs/batch-pipeline-serving.md."}
+  - {"key":"BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default 900; each serving process starts async follow-up discovery at a hashed point in the persisted/ready backlog and skips a row it saw blocked, failed, timed out or claimed elsewhere for 60 s doubling up to this many seconds","fail":"open","owner":"dazheng","created":"2026-11-05","terminal":"keep","decision":"keep","notes":"0 is the kill switch (head-first discovery, immediate retry, as before); malformed or out-of-range values (negative, NaN, above 3600) keep 900. The skip is process memory only; targeted and owed wakes bypass it, and the page still wraps to the head, so one cycle visits every row."}
+  - {"key":"BATCH_PIPELINE_PROJECTION_FOLLOWUP_SLOTS","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default 4; concurrent async projection follow-ups per serving process","fail":"open","owner":"dazheng","created":"2026-11-05","terminal":"keep","decision":"keep","notes":"Unset, malformed or out-of-range values (below 1, above 16) keep 4. Receipt transactions and per-segment claims fence every slot as before."}
   - {"key":"BATCH_PIPELINE_PROJECTION_INDEX_DEFERRED_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; owner-chain walks converge the Typesense index and people-stats cache after the chain moves on, once per touched conversation per flush, including its donor-lineage deletes","fail":"open","owner":"dazheng","created":"2026-10-20","terminal":"keep","decision":"keep","notes":"False restores the inline index step after every assignment, including the delete of every historic sync_merged_from donor. Fail-open as before: index lag is bounded by one drain step or serving tick (about 20 s) and lost on process exit, like a Typesense outage. See backend/docs/batch-pipeline-serving.md."}
</file context>

Comment thread backend/docs/batch-pipeline-serving.md Resolved

@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: 60ef233249

ℹ️ 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 +111 to +115
except Exception as error: # fail open: head-first discovery as before
logger.warning(
'event=batch_projection_followup action=seed outcome=error exception_type=%s', error_type(error)
)
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 Record seed-discovery fallback through the shared telemetry helper

If the seed query or clock conversion raises, this branch permanently falls back to head-first discovery for the coordinator because seeded has already been set. It only writes a warning and never calls utils.observability.fallback.record_fallback, contrary to the backend's explicit requirement for new fallback paths. Consequently, the degraded discovery mode is absent from shared fallback telemetry, even though it restores the synchronized discovery behavior this change is intended to prevent. Record the fallback with the shared helper before returning.

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

Useful? React with 👍 / 👎.

Git-on-my-level and others added 7 commits November 5, 2026 13:35
… mark

Luna r1 P1: a tail that keeps every 100-row page full would never let the
seeded cursor wrap, starving receipts older than the seed. The seeded pass
now wraps to the head once its cursor reaches commits made after seeding.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t the seeded one

Luna r2 P1: after the one-shot high-water wrap, a full tail could leave a
row skipped in backoff behind the cursor forever. The high-water mark is now
re-armed on every wrap, so each cycle revisits every row committed before it.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t a 10 ms real clock

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… tie group

Luna r3: (P1) a skipped or failed seed left the pass unbounded, so a full
tail could still strand a backed-off row; the first page now sets the mark.
(P1) wrapping at >= the mark could cut a same-timestamp group mid-group;
wrap only strictly past it. (P2) the regression test pins the knob.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rk each pass where it begins

Every row committed at or before a pass's mark is offered within that pass,
ties included. The mark is now set where a pass begins (head start, seed or
missing mark) instead of where the previous one ended, so a schedule()
overflow restart also starts a correctly marked pass. Adds a randomized
coverage property test (full tail, tie groups, backoff, overflow resets).

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…backs up the pass mark

Luna r4: (P1) with pagination off every page is the head, so backoff could
hide rows; desync now stays off (legacy path) unless pagination is on.
(P2) a failing projector clock left the pass unbounded; fall back to the
wall clock. Both new tests fail without their fix.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he bounded or exactly the legacy path

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[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: 790a7d8c4d

ℹ️ 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 +196 to +198
except Exception:
# The bound must not depend on the projector clock staying healthy.
return _wall()

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 Record the pass-clock fallback through shared telemetry

When the projector clock raises or returns a value that cannot be converted to a float, this branch silently substitutes the wall clock for the discovery pass boundary. Unlike the previously flagged seed-discovery fallback, this is a separate fallback executed by begin_pass(), and it emits neither shared fallback telemetry nor a log. Call utils.observability.fallback.record_fallback before returning _wall() so operators can observe the clock substitution, as required by backend/AGENTS.md.

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

Useful? React with 👍 / 👎.

…up-desync

# Conflicts:
#	backend/config/flag_budget.json
@Git-on-my-level
Git-on-my-level merged commit feffb95 into main Nov 5, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/projection-followup-desync branch November 5, 2026 07:50
Git-on-my-level added a commit that referenced this pull request Nov 8, 2026
…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)
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