Repository navigation
feat(batch): add opt-in dedicated projection drain pump #24712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+613
−22
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6108a6b
feat(batch): add opt-in dedicated projection drain pump
Git-on-my-level 85b5648
refactor(batch): narrow projector before running pump tick
Git-on-my-level 36db876
refactor(batch): resolve pump role through policy config
Git-on-my-level e1cc45d
fix(batch): schedule pump follow-ups and cap discovery load
Git-on-my-level 7c8e181
Merge remote-tracking branch 'origin/main' into lane/pipeline-pump
Git-on-my-level a3189ee
fix(batch): keep pump metrics scrapes out of reconciliation
Git-on-my-level 2226107
Merge origin/main to retain projection striping controls
Git-on-my-level facdfd9
Merge remote-tracking branch 'origin/main' into lane/pipeline-pump
Git-on-my-level File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -528,6 +528,7 @@ and an explicit empty literal renders as `''`. | |
| | `BATCH_PIPELINE_LANGUAGE_INHERITANCE_ENABLED` | Default on unless false; batch pieces inherit a known bound conversation language, else the user language, before per-piece LID | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_LEADER_LEASE_ENABLED` | Default on unless false; one batch worker or serving replica per Firestore lease runs periodic recovery, drain, cleanup and quarantine discovery | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_LONG_SPEECH_HANDOFF_ENABLED` | Default on unless false; a zero-word batch unit with >=5 s worker VAD speech whose intake STT language is unknown, multi or outside Parakeet TDT v3 skips the padded Parakeet retry and goes straight to quarantine recovery | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_MAX_OWNER_DRAINS` | Default 8; concurrent owner drains per process, clamped to 1-32 at import; malformed keeps 8 | backend | env | closed | — | — | — | — | keep | keep | — | lead2 | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The Prompt for AI agents |
||
| | `BATCH_PIPELINE_MERGE_CATCH_UP_DEPTH` | Default 16; fresh batch uploads (capture ended at most 10 min before admission) commit ahead of the owner's pending catch-up rows, and catch-up commits wait while the owner already has this many committed rows awaiting projection | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_MERGE_HEAD_WAIT_SECONDS` | Default 60; once a batch result has waited this long behind an unready earlier-captured merge head, the owner's ready results commit in capture order and the head appends later as late_capture | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_OWNER_CHAIN_PROJECTION_ENABLED` | Default on; a settled quarantine recovery walks that owner's result log from its projection watermark in chain order and runs its contents' follow-ups first | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
|
|
@@ -542,7 +543,10 @@ and an explicit empty literal renders as `''`. | |
| | `BATCH_PIPELINE_PROJECTION_PENDING_PAGE_ENABLED` | Default on; the projection sweep's assignment page holds only pending results and a separate persisted/ready page finishes synchronous-policy receipts | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_PROJECTION_PREDECESSOR_REPLAY_ENABLED` | Default on; a blocked projection successor schedules its owner's missing predecessor through the existing ordered walk | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_PROJECTION_PREFETCH` | 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 | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_PROJECTION_PUMP_ENABLED` | Default false; true selects a dedicated projection-only pump instead of the three serving loops, independently of BATCH_PIPELINE_SERVING_ENABLED | backend | env | closed | — | — | — | — | keep | keep | — | lead2 | | ||
| | `BATCH_PIPELINE_PROJECTION_SOURCE_DELETED_ENABLED` | Default on; settle deleted original sources without a tombstone or redirect as source_deleted, without content publication | backend | env | open | — | — | — | — | keep | keep | — | cl2-cost / lead2 | | ||
| | `BATCH_PIPELINE_PUMP_SWEEP_PAGES` | Default 1; projection pump sweep pages per tick, clamped to 1-10; malformed keeps 1 | backend | env | closed | — | — | — | — | keep | keep | — | lead2 | | ||
| | `BATCH_PIPELINE_PUMP_TICK_SECONDS` | Default 20 seconds; projection pump tick sleep, clamped to 1-60; malformed keeps 20 | backend | env | closed | — | — | — | — | keep | keep | — | lead2 | | ||
| | `BATCH_PIPELINE_RAMP_EXCLUDE_HEAVY_OWNERS` | Ship-on partial-ramp admission isolation; only off disables; owners over 30 open jobs or six hours pending audio use legacy | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_RECOVERED_MERGE_RELEASE_ENABLED` | Default on unless false; the post-recovery owner wake commits the recovered unit, then its content's ready siblings, at once past an unready merge head (the unit itself also past the catch-up depth hold), so the same wake's chain walk projects them | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_RECOVERY_DISPATCH_INTERVAL_SECONDS` | Default 5; batch serving dispatches quarantine recovery on its own loop at this interval, on the maintenance leader only | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
|
|
@@ -552,6 +556,7 @@ and an explicit empty literal renders as `''`. | |
| | `BATCH_PIPELINE_RECOVERY_WAKE_LEASE_SECONDS` | One outstanding quarantine-recovery delivery task per paid intent; lease before a lost wake is repaired; default 600, 0 = legacy 120s wake on every sweep | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_SECOND_MULTILINGUAL_ENABLED` | Ship-on Soniox second chance after valid-empty Modulate held recovery; false restores Modulate-only ordinary recovery; independent language-guard recovery retains its separate switch and cap | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_SERVING_METRICS_MIN_REFRESH_SECONDS` | Default 30; each batch serving instance refreshes its queue gauges at most once per interval | backend | env | closed | — | — | 60 | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_SERVING_PROJECTION_SWEEP` | Default on; only off skips Serving.reconcile projection sweep, preserving owner wakes, held drains, metrics and leader-leased maintenance | backend | env | open | — | — | — | — | keep | keep | — | lead2 | | ||
| | `BATCH_PIPELINE_SHARED_EMBEDDING_TRUNK_ENABLED` | Default on unless false; the serial batch GPU chain runs the WeSpeaker embedding trunk once per 10 s chunk of a unit and pools it per local speaker, instead of once per (chunk, speaker) pair | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_SWEEP_OWNER_CHAIN_ENABLED` | Default on; when the periodic projection sweep advances an owner's chain head it keeps walking that owner's result log in chain order instead of waiting for its cursor to wrap | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_VAD_SEGMENTATION_REUSE_ENABLED` | Default on unless false; on the serial batch GPU chain a unit diarized at full length takes the raw segmentation scores its own VAD pass computed instead of a second segmentation forward | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
|
|
@@ -1084,6 +1089,7 @@ their code default (`fail` tells you which way a missing value resolves). | |
| - `BATCH_PIPELINE_LANGUAGE_INHERITANCE_ENABLED` — Default on unless false; batch pieces inherit a known bound conversation language, else the user language, before per-piece LID (fail: open) | ||
| - `BATCH_PIPELINE_LEADER_LEASE_ENABLED` — Default on unless false; one batch worker or serving replica per Firestore lease runs periodic recovery, drain, cleanup and quarantine discovery (fail: open) | ||
| - `BATCH_PIPELINE_LONG_SPEECH_HANDOFF_ENABLED` — Default on unless false; a zero-word batch unit with >=5 s worker VAD speech whose intake STT language is unknown, multi or outside Parakeet TDT v3 skips the padded Parakeet retry and goes straight to quarantine recovery (fail: open) | ||
| - `BATCH_PIPELINE_MAX_OWNER_DRAINS` — Default 8; concurrent owner drains per process, clamped to 1-32 at import; malformed keeps 8 (fail: closed) | ||
| - `BATCH_PIPELINE_MERGE_CATCH_UP_DEPTH` — Default 16; fresh batch uploads (capture ended at most 10 min before admission) commit ahead of the owner's pending catch-up rows, and catch-up commits wait while the owner already has this many committed rows awaiting projection (fail: closed) | ||
| - `BATCH_PIPELINE_MERGE_HEAD_WAIT_SECONDS` — Default 60; once a batch result has waited this long behind an unready earlier-captured merge head, the owner's ready results commit in capture order and the head appends later as late_capture (fail: closed) | ||
| - `BATCH_PIPELINE_MODEL_BATCH_SIZE` — GPU chain maximum model window batch size; default 8; hard ceiling 32 (fail: closed) | ||
|
|
@@ -1101,8 +1107,11 @@ their code default (`fail` tells you which way a missing value resolves). | |
| - `BATCH_PIPELINE_PROJECTION_PENDING_PAGE_ENABLED` — Default on; the projection sweep's assignment page holds only pending results and a separate persisted/ready page finishes synchronous-policy receipts (fail: open) | ||
| - `BATCH_PIPELINE_PROJECTION_PREDECESSOR_REPLAY_ENABLED` — Default on; a blocked projection successor schedules its owner's missing predecessor through the existing ordered walk (fail: open) | ||
| - `BATCH_PIPELINE_PROJECTION_PREFETCH` — 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) | ||
| - `BATCH_PIPELINE_PROJECTION_PUMP_ENABLED` — Default false; true selects a dedicated projection-only pump instead of the three serving loops, independently of BATCH_PIPELINE_SERVING_ENABLED (fail: closed) | ||
| - `BATCH_PIPELINE_PROJECTION_SOURCE_DELETED_ENABLED` — Default on; settle deleted original sources without a tombstone or redirect as source_deleted, without content publication (fail: open) | ||
| - `BATCH_PIPELINE_PUBLISH_CONCURRENCY` — GPU worker post-flight publication concurrency: bounded fenced transitions and one ordered drain per owner per flight; default 4, 1 = legacy serial kill switch, max 16 (fail: closed) | ||
| - `BATCH_PIPELINE_PUMP_SWEEP_PAGES` — Default 1; projection pump sweep pages per tick, clamped to 1-10; malformed keeps 1 (fail: closed) | ||
| - `BATCH_PIPELINE_PUMP_TICK_SECONDS` — Default 20 seconds; projection pump tick sleep, clamped to 1-60; malformed keeps 20 (fail: closed) | ||
| - `BATCH_PIPELINE_RAMP_EXCLUDE_HEAVY_OWNERS` — Ship-on partial-ramp admission isolation; only off disables; owners over 30 open jobs or six hours pending audio use legacy (fail: closed) | ||
| - `BATCH_PIPELINE_RECORD_PROTOCOL_READY` — One-time native record protocol cutover; default closed retains record_pending obligations without expiry (fail: closed) | ||
| - `BATCH_PIPELINE_RECOVERED_MERGE_RELEASE_ENABLED` — Default on unless false; the post-recovery owner wake commits the recovered unit, then its content's ready siblings, at once past an unready merge head (the unit itself also past the catch-up depth hold), so the same wake's chain walk projects them (fail: open) | ||
|
|
@@ -1113,6 +1122,7 @@ their code default (`fail` tells you which way a missing value resolves). | |
| - `BATCH_PIPELINE_RECOVERY_WAKE_LEASE_SECONDS` — One outstanding quarantine-recovery delivery task per paid intent; lease before a lost wake is repaired; default 600, 0 = legacy 120s wake on every sweep (fail: closed) | ||
| - `BATCH_PIPELINE_REUSE_LIVE_ENABLED` — Default-off GPU-chain pre-STT reuse; requires existing lineage gates and full-span words-of-record quality proof (fail: closed) | ||
| - `BATCH_PIPELINE_SECOND_MULTILINGUAL_ENABLED` — Ship-on Soniox second chance after valid-empty Modulate held recovery; false restores Modulate-only ordinary recovery; independent language-guard recovery retains its separate switch and cap (fail: open) | ||
| - `BATCH_PIPELINE_SERVING_PROJECTION_SWEEP` — Default on; only off skips Serving.reconcile projection sweep, preserving owner wakes, held drains, metrics and leader-leased maintenance (fail: open) | ||
| - `BATCH_PIPELINE_SHADOW_LANGUAGE_ONLY` — Default false; classify one canonical batch unit per selected legacy upload instead of entering the idle GPU shadow; no route or publication (fail: closed) | ||
| - `BATCH_PIPELINE_SHADOW_LANGUAGE_PROBES_PER_HOUR` — Default and maximum 500 fleet-wide pair attempts per UTC hour; zero or malformed denies; minute pacing and two 120-second slots also apply (fail: closed) | ||
| - `BATCH_PIPELINE_SHADOW_RECOVERY_API_URL` — Explicit HTTPS existing record-recovery CPU role for shadow recovery; URL is also its OIDC audience; blank fails closed (fail: closed) | ||
|
|
||
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
19 changes: 19 additions & 0 deletions
19
backend/docs/listen_pusher_pipeline/changes/2026-11-05-projection-pump.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Dedicated projection discovery pump | ||
|
|
||
| The [serving projection contract](../../listen_pusher_pipeline.mdx#dedicated-projection-pump) | ||
| can select one projection-only loop without starting serving maintenance, | ||
| record admission or quarantine dispatch. Unset env preserves the existing three | ||
| serving loops, sweep cadence and eight owner drains. No deploy configuration is | ||
| changed here; service shape remains a separate decision. | ||
|
|
||
| The dedicated loop offloads each sweep to `sync_executor`, starts owed owner | ||
| drains on the event loop, and emits a heartbeat with successful sweep count, | ||
| requested owners and elapsed time on every tick, including failed ticks. Failures | ||
| log their exception type and retry on the next tick. Durable projection receipts | ||
| and advisory owner claims are unchanged. | ||
|
|
||
| Ramp owner: lead2, tonight (2026-11-05). Start with a pump service of N=3-4, | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
|
||
| verify owner_drain rows/s stays at least 70% of pre-cutover and claim_busy ratio | ||
| does not exceed pre-cutover, then disable serving sweeps only after at least | ||
| 30 minutes stable. Rollback: restore serving sweeps, disable the pump, and return | ||
| owner drain capacity to eight. This PR only adds code and unit coverage. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both
serving_projection_sweep_enabled()andprojection_pump_enabled()introduce function-local imports, violating the explicit requirement inbackend/AGENTS.md: “All imports at module top level — never inside functions.” Importkill_switchonce at module scope and reuse it in both accessors. Existing local imports elsewhere in this file do not exempt these newly added functions from the scoped convention.AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.