Repository navigation
Sample the strict-VAD shadow (BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT) and split owner_wait re-leases (relet) - #24273
Conversation
…eases
BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT (default 10, pinned on the worker
chart) samples the CPU strict-VAD shadow deterministically by segment hash.
Unsampled units skip inspect_worker_vad entirely and emit no shadow counters
or stage timings; the worker outcome and payload are unchanged (parity test
kept). The 48h silence qualification reading this shadow needs 10x the
window for the same sample at a fixed cohort, or roughly its original 48h
again once batch reaches 100% intake (5-10x unit volume).
omi_batch_pipeline_owner_wait_seconds gains a bounded relet label, true when
the lease follows an admission-refusal streak or a charged attempt. defer()
refunds the attempt, so an admission-deferred re-lease is a relet only
through admission_refusals; owner_wait{relet="false"} is the fresh wait the
ramp gates needed and re-leases no longer pollute it.
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
2 issues found across 15 files
Confidence score: 3/5
backend/config/batch_pipeline.pyclamps invalid percentages to 0 or 100 instead of keeping the documented 10% default, which can change the rollout unexpectedly. Return the default for values outside[0, 100].backend/docs/feature-flag-registry.mdomits the production chart declaration, so the registry does not show where this flag is configured. Update the registry generation or rendered row to list the chart source.
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/feature-flag-registry.md">
<violation number="1" location="backend/docs/feature-flag-registry.md:629">
P2: This row hides the production chart declaration even though the worker chart now supplies `BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT=10`. Update the registry generation or rendered row so the chart source is listed; otherwise operators using this authority catalog cannot see where the live worker setting is configured.</violation>
</file>
<file name="backend/config/batch_pipeline.py">
<violation number="1" location="backend/config/batch_pipeline.py:340">
P2: Out-of-range percentages are documented as invalid and should retain the default 10, but this line clamps them to 0 or 100. Return `STRICT_VAD_SHADOW_PERCENT_DEFAULT` for values outside `[0, 100]`, or update the flag contract to explicitly document clamping.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| | `BATCH_PIPELINE_SHADOW_PAID_RECOVERY_PER_HOUR` | Default 200; combined fleet-wide Modulate shadow unit-call reservations per UTC hour (Deepgram reservations retired 2026-08-27); invalid/zero denies paid calls | backend | env | closed | {value: '200', category: ops_kill} | {value: '200', category: ops_kill} | {value: '200', category: ops_kill} | — | keep | keep | — | dazheng | | ||
| | `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 | backend | env | closed | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_STAGE_PROFILING_ENABLED` | Dedicated worker omi_batch_pipeline_stage_seconds wall-clock histograms; default on only for OMI_ENV_STAGE=dev, prod/unset off, explicit true/false overrides (local/offline opt in) | backend | env | open | — | — | — | — | keep | keep | — | dazheng | | ||
| | `BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT` | Share of units that run the CPU strict-VAD shadow, sampled deterministically by segment hash; default 10, 0 disables the shadow, 100 restores full sampling; invalid values keep 10 | backend | env | closed | — | — | — | — | keep | keep | — | flightcut / batch rollout lead | |
There was a problem hiding this comment.
P2: This row hides the production chart declaration even though the worker chart now supplies BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT=10. Update the registry generation or rendered row so the chart source is listed; otherwise operators using this authority catalog cannot see where the live worker setting is configured.
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/feature-flag-registry.md, line 629:
<comment>This row hides the production chart declaration even though the worker chart now supplies `BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT=10`. Update the registry generation or rendered row so the chart source is listed; otherwise operators using this authority catalog cannot see where the live worker setting is configured.</comment>
<file context>
@@ -626,6 +626,7 @@ and an explicit empty literal renders as `''`.
| `BATCH_PIPELINE_SHADOW_PAID_RECOVERY_PER_HOUR` | Default 200; combined fleet-wide Modulate shadow unit-call reservations per UTC hour (Deepgram reservations retired 2026-08-27); invalid/zero denies paid calls | backend | env | closed | {value: '200', category: ops_kill} | {value: '200', category: ops_kill} | {value: '200', category: ops_kill} | — | keep | keep | — | dazheng |
| `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 | backend | env | closed | — | — | — | — | keep | keep | — | dazheng |
| `BATCH_PIPELINE_STAGE_PROFILING_ENABLED` | Dedicated worker omi_batch_pipeline_stage_seconds wall-clock histograms; default on only for OMI_ENV_STAGE=dev, prod/unset off, explicit true/false overrides (local/offline opt in) | backend | env | open | — | — | — | — | keep | keep | — | dazheng |
+| `BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT` | Share of units that run the CPU strict-VAD shadow, sampled deterministically by segment hash; default 10, 0 disables the shadow, 100 restores full sampling; invalid values keep 10 | backend | env | closed | — | — | — | — | keep | keep | — | flightcut / batch rollout lead |
| `BATCH_PIPELINE_UNIT_SECONDS` | Per-pool compute-unit ceiling; dedicated batch default 7200, shared live default and hard maximum 120 seconds | backend | env | closed | 3600 | 3600 (backend-listen (chart), cloud_run/backend, cloud_run/backend-integration, cloud_run/backend-sync, cloud_run/backend-sync-backfill, gke/backend-listen) | 3600 (backend-listen (chart), cloud_run/backend, cloud_run/backend-integration, cloud_run/backend-sync, cloud_run/backend-sync-backfill, gke/backend-listen) | — | keep | keep | — | dazheng |
| `BATCH_PIPELINE_WINDOW_SECONDS` | GPU chain internal ASR core window seconds; default 30; queue units remain conversations | backend | env | closed | — | — | — | — | keep | keep | — | dazheng |
</file context>
| return STRICT_VAD_SHADOW_PERCENT_DEFAULT | ||
| if not math.isfinite(value): | ||
| return STRICT_VAD_SHADOW_PERCENT_DEFAULT | ||
| return min(100.0, max(0.0, value)) |
There was a problem hiding this comment.
P2: Out-of-range percentages are documented as invalid and should retain the default 10, but this line clamps them to 0 or 100. Return STRICT_VAD_SHADOW_PERCENT_DEFAULT for values outside [0, 100], or update the flag contract to explicitly document clamping.
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/config/batch_pipeline.py, line 340:
<comment>Out-of-range percentages are documented as invalid and should retain the default 10, but this line clamps them to 0 or 100. Return `STRICT_VAD_SHADOW_PERCENT_DEFAULT` for values outside `[0, 100]`, or update the flag contract to explicitly document clamping.</comment>
<file context>
@@ -326,6 +326,29 @@ def worker_validation_disposition_enabled() -> bool:
+ return STRICT_VAD_SHADOW_PERCENT_DEFAULT
+ if not math.isfinite(value):
+ return STRICT_VAD_SHADOW_PERCENT_DEFAULT
+ return min(100.0, max(0.0, value))
+
+
</file context>
| return min(100.0, max(0.0, value)) | |
| if not 0.0 <= value <= 100.0: | |
| return STRICT_VAD_SHADOW_PERCENT_DEFAULT | |
| return value |
…er chart Helm default treats 0 as empty, so worker.strictVadShadowPercent: 0 would render 10 and the documented 0-disable never reaches the pod. Drop the default (values.yaml already pins 10), matching the shadowPercent entry.
# Conflicts: # backend/utils/batch_pipeline/metrics.py # backend/utils/batch_pipeline/scheduler.py # config/feature-flags.yaml
# Conflicts: # config/feature-flags.yaml
ADR 0006 pipeline flag budget: new scoped env reads need a names entry; this one takes the owner + review_by path (no slot transferred).
Summary
Two batchdesign §9 worker-roll items (PR-3 + PR-4a), one themed PR. Rides the batch worker roll, no Cloud Runtime env changes, no
.github/changes.PR-3 — sample the strict-VAD shadow.
BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT(default 10; 0 off, 100 full; invalid keeps 10) samples the CPU strict-VAD shadow deterministically by segment hash (cohort_bucket(segment_id, ''), the repo's unsalted sha256 primitive, so a re-leased unit samples identically on every worker). Unsampled units skipinspect_worker_vadin_decode_contextand the comparison site emits nostrict_vadcounters; thestrict_vad_shadowstage timing and CPU histogram fire only for sampled units. Worker outcome and payload are unchanged — the existing parity test (test_shadow_cannot_change_words_speakers_clocks_or_model_calls) plus a new sampling-parity test prove it.Cost and proof. The shadow costs up to 0.6 s of the measured 2.55 s GPU-lock flight (batchdesign #7, 15:36–16:56Z window). Stage sums overstate; the saving is proven only by post-roll
rate(stage_seconds_sum{stage="worker_flight"})/rate(completed).PR-4a — honest owner wait.
record('leased', wait_seconds=…)gainsrelet: bool;omi_batch_pipeline_owner_wait_secondsgains the boundedreletlabel ('true'/'false').relet = admission_refusals > 0 or attempt > 1(post-increment):defer()refunds the attempt (scheduler.pyattempt=max(0, attempt-1)), so an admission-deferred re-lease has attempt 1 and is a relet only through its refusal streak; every compute-failure re-lease carries a charged attempt. This unblocks the batchdesign §7.2 gate: gate onowner_wait{relet="false"}, never the mixed series (at 25%, 62% of leases were re-leases of held units).The 48 h silence qualification at 10% sampling
The qualification needs
strict_silentevidence to prove strict-silent-but-pyannote-nonempty units produce no words (12.7% disagreement observed; 1,602 strict-silent/day at the 25% cohort with full shadow, batchdesign #9). At a fixed cohort, 10% sampling collects ~160 strict-silent/day, so the same evidence the planned 48 h window would collect now needs ~480 h (20 days). Batch ramps to 100% tonight (5–10× unit intake): at 100%, a 48 h window at 10% collects ~1.6k–3.2k strict-silent ≈ today's full-shadow 48 h volume, so the original window holds once the ramp lands. Re-derive the window fromomi_batch_pipeline_strict_vad_shadow_total{outcome="strict_silent"}rate at the current cohort; if the ramp stalls, raise the percent (it is live config on the worker chart) rather than waiting.Tests (local shard,
backend/test.shvia BACKEND_UNIT_TEST_FILE_LIST, omi-heavy)test_batch_pipeline_worker_bundle.py(51),test_batch_pipeline_worker.py(105),test_batch_pipeline_scheduler.py(43),test_batch_pipeline_metrics.py(15),test_reason_label_enums.py(19).relet=false; admission-deferred re-lease (attempt refunded)relet=true; attempt-charged re-lease after lease expiryrelet=true.test_worker_strict_silence_commits_or_preserves_quarantinepins sampling to 100 to keep counting its record-only inspection;owner_waitseries assertions now carry thereletlabel.Config surfaces
worker.strictVadShadowPercentdefault 10, prod pinned 10 with rollback comment (100 restores full, 0 disables). Registry row added (config_switch, terminal keep),backend/docs/feature-flag-registry.mdregenerated as-of 2026-11-01, deployment-setting classifiedconfig.feature-flag-registryanddeployment secret-boundarycheckers pass locally. No runtime_env change (no INV-MEM-4).Rollout
Worker image roll only (lead-owned). Both changes are observable immediately after the roll: shadow counter rate ÷10 at fixed cohort,
reletlabel on new series. Kill switch:worker.strictVadShadowPercent=100(or 0) on the worker chart.Failure-Class: none