Repository navigation
fix(stt): tolerate partial Parakeet fleet pressure samples - #20208
Conversation
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2d5e45c7c
ℹ️ 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".
| "canonical_prevention": "Mark live requests explicitly, schedule live work ahead of backfill with a bounded aged-backfill turn, expose per-replica live pressure independently of total batch pressure, and fail closed when any replica lacks fresh valid live telemetry. Retain a per-listen-process session cap measured against pod CPU and memory limits.", | ||
| "canonical_prevention_artifact": [ | ||
| "backend/tests/unit/test_parakeet_batch_engine.py", | ||
| "backend/tests/unit/test_parakeet_batch_pressure.py", |
There was a problem hiding this comment.
Align the failure-class contract with the new guard
Registering this test as a canonical prevention artifact makes the failure-class record internally contradictory: canonical_prevention still requires failing closed whenever any replica lacks fresh telemetry, while this suite intentionally verifies admission with partial telemetry when quorum and healthy headroom remain. Update the canonical prevention text to describe the new quorum/unknown-replica policy; otherwise future recurrence checks will treat a test enforcing the opposite behavior as the guard for this class.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
8 issues found and verified against the latest diff
Confidence score: 3/5
- In
batch_pressure.py, timing outgetaddrinfodoes not stop its resolver thread, so a prolonged DNS outage can leave new abandoned work accumulating every five seconds and exhaust the default executor. Prevent repeated abandoned lookups or use a cancellable resolver. - The live-window tests replace
allows, so they never exerciseconnect_windowrefusing a connection under pressure. Keep the real gate enabled with a healthy sample and add a refusal-path test. - The poller tests can hang the unit-test process if startup never happens, and their real timer sleeps conflict with the unit-test lane’s guidance. Bound the event wait with
asyncio.wait_forand make poll timing controllable. ARCHITECTURE.mdandlisten_pusher_pipeline.mdxpresent 50% as a fixed admission rule, though deployments can configure a different busy-share threshold. Describe 50% as the default and identify the configuration.
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/operational/windowed-live-stt.md">
<violation number="1" location="backend/docs/operational/windowed-live-stt.md:72">
P3: The loop waits five seconds after `_refresh` completes, so DNS and fetch time extend the interval between polls. Say it waits five seconds between refreshes rather than polling every five seconds.</violation>
</file>
<file name="backend/tests/unit/test_parakeet_window_live.py">
<violation number="1" location="backend/tests/unit/test_parakeet_window_live.py:69">
P2: This autouse override bypasses the pressure gate in every live-window test, leaving `connect_window`'s refusal path untested. Keep `allows` real with a healthy seeded sample and add a connection test that verifies pressure refusal.</violation>
</file>
<file name="backend/utils/stt/ARCHITECTURE.md">
<violation number="1" location="backend/utils/stt/ARCHITECTURE.md:42">
P3: This presents 50% as invariant, but `PARAKEET_BATCH_PRESSURE_BUSY_REPLICA_SHARE` can change the stand-down point. State that 50% is the default and identify the configurable threshold.</violation>
</file>
<file name="backend/docs/listen_pusher_pipeline.mdx">
<violation number="1" location="backend/docs/listen_pusher_pipeline.mdx:652">
P3: This describes the 50% default as a fixed admission rule, but deployments can configure a different busy-share threshold, which also changes whether one hot replica denies admission. State that the configured share is used and identify 50% as the default.</violation>
</file>
<file name="backend/utils/stt/batch_pressure.py">
<violation number="1" location="backend/utils/stt/batch_pressure.py:188">
P2: `asyncio.wait_for` does not stop the synchronous resolver thread behind `getaddrinfo`. During a prolonged DNS outage, this starts abandoned resolver work every five seconds and can exhaust the shared default executor, delaying unrelated backend work; use a bounded dedicated resolver pool or a truly asynchronous DNS client.</violation>
<violation number="2" location="backend/utils/stt/batch_pressure.py:213">
P3: When every fetch fails but DNS succeeds (`received == 0`), the round is still labeled `partial`, so a fleet-wide metrics outage is indistinguishable from an isolated flake in the refresh counters, and admission keeps running on cached samples. The PR describes `partial` as an outcome for tolerating isolated failures; count a zero-received round as `unavailable` (or otherwise surface it) so the gate can tell full outage apart from isolated failure.</violation>
</file>
<file name="backend/tests/unit/test_parakeet_batch_pressure.py">
<violation number="1" location="backend/tests/unit/test_parakeet_batch_pressure.py:51">
P2: This unbounded wait can hang the test process if the poller never starts; wrap it in `asyncio.wait_for` as the other event waits do.</violation>
<violation number="2" location="backend/tests/unit/test_parakeet_batch_pressure.py:67">
P3: These poller-loop tests use real `asyncio` timer sleeps in the unit-test lane, contrary to `backend/tests/README.md`. Make the poll timing controllable or move the affected tests out of the PR unit lane.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| monkeypatch.setattr(window, 'admission', window.WindowAdmission()) | ||
| monkeypatch.setattr(window, 'batch_pressure', window.BatchPressure()) | ||
| window.batch_pressure._observed_at = window.time.monotonic() | ||
| monkeypatch.setattr(window.batch_pressure, 'allows', lambda *_args: True) |
There was a problem hiding this comment.
P2: This autouse override bypasses the pressure gate in every live-window test, leaving connect_window's refusal path untested. Keep allows real with a healthy seeded sample and add a connection test that verifies pressure refusal.
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/tests/unit/test_parakeet_window_live.py, line 69:
<comment>This autouse override bypasses the pressure gate in every live-window test, leaving `connect_window`'s refusal path untested. Keep `allows` real with a healthy seeded sample and add a connection test that verifies pressure refusal.</comment>
<file context>
@@ -68,7 +66,7 @@ def runtime(monkeypatch):
monkeypatch.setattr(window, 'admission', window.WindowAdmission())
monkeypatch.setattr(window, 'batch_pressure', window.BatchPressure())
- window.batch_pressure._observed_at = window.time.monotonic()
+ monkeypatch.setattr(window.batch_pressure, 'allows', lambda *_args: True)
monkeypatch.setattr(provider_resilience, 'STT_FALLBACK_LIVENESS_GRACE_SECONDS', 0)
for provider in ('parakeet', 'modulate', 'deepgram', 'soniox'):
</file context>
| if not pool_host or min_replicas < 1: | ||
| raise ValueError('Parakeet batch pool discovery is not configured') | ||
| addresses = await asyncio.wait_for( | ||
| asyncio.get_running_loop().getaddrinfo(pool_host, 8080, family=socket.AF_INET, type=socket.SOCK_STREAM), |
There was a problem hiding this comment.
P2: asyncio.wait_for does not stop the synchronous resolver thread behind getaddrinfo. During a prolonged DNS outage, this starts abandoned resolver work every five seconds and can exhaust the shared default executor, delaying unrelated backend work; use a bounded dedicated resolver pool or a truly asynchronous DNS client.
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/stt/batch_pressure.py, line 188:
<comment>`asyncio.wait_for` does not stop the synchronous resolver thread behind `getaddrinfo`. During a prolonged DNS outage, this starts abandoned resolver work every five seconds and can exhaust the shared default executor, delaying unrelated backend work; use a bounded dedicated resolver pool or a truly asynchronous DNS client.</comment>
<file context>
@@ -0,0 +1,216 @@
+ if not pool_host or min_replicas < 1:
+ raise ValueError('Parakeet batch pool discovery is not configured')
+ addresses = await asyncio.wait_for(
+ asyncio.get_running_loop().getaddrinfo(pool_host, 8080, family=socket.AF_INET, type=socket.SOCK_STREAM),
+ timeout=self.REQUEST_TIMEOUT_SECONDS,
+ )
</file context>
| assert pressure._task is None | ||
| pressure.start('tdt-headless.invalid', 2) | ||
| try: | ||
| await began.wait() |
There was a problem hiding this comment.
P2: This unbounded wait can hang the test process if the poller never starts; wrap it in asyncio.wait_for as the other event waits do.
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/tests/unit/test_parakeet_batch_pressure.py, line 51:
<comment>This unbounded wait can hang the test process if the poller never starts; wrap it in `asyncio.wait_for` as the other event waits do.</comment>
<file context>
@@ -0,0 +1,487 @@
+ assert pressure._task is None
+ pressure.start('tdt-headless.invalid', 2)
+ try:
+ await began.wait()
+ assert not pressure.allows('tdt-headless.invalid', 2)
+ release.set()
</file context>
| Missing, stale, non-finite, negative, or mixed-revision metrics stand down. | ||
| Admission reads only the cache; it never waits on DNS or HTTP. | ||
| The headless Service selects ready Parakeet pods. `utils/stt/batch_pressure.py` | ||
| polls each replica every five seconds with its own one-second HTTP and wall-clock |
There was a problem hiding this comment.
P3: The loop waits five seconds after _refresh completes, so DNS and fetch time extend the interval between polls. Say it waits five seconds between refreshes rather than polling every five seconds.
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/operational/windowed-live-stt.md, line 72:
<comment>The loop waits five seconds after `_refresh` completes, so DNS and fetch time extend the interval between polls. Say it waits five seconds between refreshes rather than polling every five seconds.</comment>
<file context>
@@ -60,25 +60,61 @@ Deploy the Parakeet server revision and its 3–6 replica HPA first. Wait until
-Missing, stale, non-finite, negative, or mixed-revision metrics stand down.
-Admission reads only the cache; it never waits on DNS or HTTP.
+The headless Service selects ready Parakeet pods. `utils/stt/batch_pressure.py`
+polls each replica every five seconds with its own one-second HTTP and wall-clock
+deadline. A failed fetch does not discard the other responses: each replica
+keeps its last valid sample and original timestamp for **at most 15 seconds**.
</file context>
| polls each replica every five seconds with its own one-second HTTP and wall-clock | |
| waits five seconds between refreshes, with its own one-second HTTP and wall-clock |
| `batch_pressure.py` owns the off-path GPU-pool poller and cached admission: | ||
| per-replica last-good samples expire after 15 seconds, fresh quorum requires | ||
| both the configured minimum and a strict majority of DNS-ready pods, and busy | ||
| plus unknown pods reaching half the pool stands down. Individual fetch failures |
There was a problem hiding this comment.
P3: This presents 50% as invariant, but PARAKEET_BATCH_PRESSURE_BUSY_REPLICA_SHARE can change the stand-down point. State that 50% is the default and identify the configurable threshold.
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/stt/ARCHITECTURE.md, line 42:
<comment>This presents 50% as invariant, but `PARAKEET_BATCH_PRESSURE_BUSY_REPLICA_SHARE` can change the stand-down point. State that 50% is the default and identify the configurable threshold.</comment>
<file context>
@@ -36,6 +36,12 @@ one pace. The PCM buffer is two max-context windows plus two pace intervals
+`batch_pressure.py` owns the off-path GPU-pool poller and cached admission:
+per-replica last-good samples expire after 15 seconds, fresh quorum requires
+both the configured minimum and a strict majority of DNS-ready pods, and busy
+plus unknown pods reaching half the pool stands down. Individual fetch failures
+retain their timestamps; DNS failure invalidates the fleet. Its fan-out/cache
+cap is 64 pods and admission never performs I/O.
</file context>
| plus unknown pods reaching half the pool stands down. Individual fetch failures | |
| plus unknown pods reaching the configured busy-share threshold (0.5 by default) stand down. Individual fetch failures |
| busy-plus-unknown share of the ready pool. Per-replica last-good live samples | ||
| survive a failed poll for at most 15 seconds. | ||
| Admission requires the configured minimum and a strict majority of ready replicas | ||
| to report fresh telemetry; busy plus unknown replicas reaching half the pool |
There was a problem hiding this comment.
P3: This describes the 50% default as a fixed admission rule, but deployments can configure a different busy-share threshold, which also changes whether one hot replica denies admission. State that the configured share is used and identify 50% as the default.
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.mdx, line 652:
<comment>This describes the 50% default as a fixed admission rule, but deployments can configure a different busy-share threshold, which also changes whether one hot replica denies admission. State that the configured share is used and identify 50% as the default.</comment>
<file context>
@@ -644,10 +644,14 @@ before an unfinished sample can be evicted. The replacement epoch stitches
+busy-plus-unknown share of the ready pool. Per-replica last-good live samples
+survive a failed poll for at most 15 seconds.
+Admission requires the configured minimum and a strict majority of ready replicas
+to report fresh telemetry; busy plus unknown replicas reaching half the pool
+stands down. A single hot pod in a larger healthy pool does not deny the fleet.
+DNS failure and lost quorum still stand down; admission performs no I/O. The
</file context>
| @pytest.mark.asyncio | ||
| async def test_batch_pressure_keeps_sample_fresh_between_rare_admissions(monkeypatch): | ||
| pressure = pressure_module.BatchPressure() | ||
| pressure.REFRESH_SECONDS = 0.01 |
There was a problem hiding this comment.
P3: These poller-loop tests use real asyncio timer sleeps in the unit-test lane, contrary to backend/tests/README.md. Make the poll timing controllable or move the affected tests out of the PR unit lane.
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/tests/unit/test_parakeet_batch_pressure.py, line 67:
<comment>These poller-loop tests use real `asyncio` timer sleeps in the unit-test lane, contrary to `backend/tests/README.md`. Make the poll timing controllable or move the affected tests out of the PR unit lane.</comment>
<file context>
@@ -0,0 +1,487 @@
[email protected]
+async def test_batch_pressure_keeps_sample_fresh_between_rare_admissions(monkeypatch):
+ pressure = pressure_module.BatchPressure()
+ pressure.REFRESH_SECONDS = 0.01
+ clock = [100.0]
+ monkeypatch.setattr(pressure_module, 'time', SimpleNamespace(monotonic=lambda: clock[0]))
</file context>
| if reason == 'missing': | ||
| outcome = 'unavailable' | ||
| elif received < len(ips): | ||
| outcome = 'partial' |
There was a problem hiding this comment.
P3: When every fetch fails but DNS succeeds (received == 0), the round is still labeled partial, so a fleet-wide metrics outage is indistinguishable from an isolated flake in the refresh counters, and admission keeps running on cached samples. The PR describes partial as an outcome for tolerating isolated failures; count a zero-received round as unavailable (or otherwise surface it) so the gate can tell full outage apart from isolated failure.
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/stt/batch_pressure.py, line 213:
<comment>When every fetch fails but DNS succeeds (`received == 0`), the round is still labeled `partial`, so a fleet-wide metrics outage is indistinguishable from an isolated flake in the refresh counters, and admission keeps running on cached samples. The PR describes `partial` as an outcome for tolerating isolated failures; count a zero-received round as `unavailable` (or otherwise surface it) so the gate can tell full outage apart from isolated failure.</comment>
<file context>
@@ -0,0 +1,216 @@
+ if reason == 'missing':
+ outcome = 'unavailable'
+ elif received < len(ips):
+ outcome = 'partial'
+ else:
+ outcome = 'pressure' if reason else 'healthy'
</file context>
…essure-partial-samples
## What Raise `PARAKEET_WINDOW_ALLOCATION_PERCENT` in prod from 25 to 50 (config only; listen chart + runtime env overlay + flag registry note). ## Why Step three of the gated ramp to Parakeet-primary live STT (5 → 25 → 50 → 100) approved on 2026-09-29. The 25% step was held on one gate: window admission refused 7–14% of sessions at peak. #20208 fixed the cause (one failed per-pod pressure fetch voided the fleet sample). Gates over the 8 hours since #20208 went live (listen `8c8aff1`, 2026-10-01 19:00Z → 2026-10-02 03:00Z, prod Prometheus, aggregates only): | Gate | Result | | --- | --- | | Admission refusals < 2% | 0 of 3,696 admissions | | Transcript success within 2 pts of control | window 97.5% vs control 95.1% | | First-text p95 < 15 s | 12.3 s (p50 4.6 s) | | GPU busy < 60% | peak 30% per pod, mean 17%; 0 OOM, 0 fatal | | Backfill keeping up | max 4 pending requests, 0 now | | Parakeet failovers that lose transcription (`exhausted`) | 0 | Pressure refreshes: 96.6% healthy, 3.4% partial, 0 unavailable. ## Rollback Set `PARAKEET_WINDOW_ALLOCATION_PERCENT=0` and redeploy listen (chart-only; no image change). ## Deploy Listen helm only, with the current image tag. ## Product invariants affected INV-MEM-4 — the runtime env manifest is a locked path; this changes one rollout percentage and no memory behaviour. Failure-Class: none 🤖 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/20250?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="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Admission refusals went from 7-14% at peak to 0 of 3,696 after BasedHardware#20208; the remaining 25% gates hold through the busiest hours. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#20340) ## What Prod listen config only: - `PARAKEET_WINDOW_ALLOCATION_PERCENT` 50 → 100 (all eligible live sessions start on the Parakeet window path). - `PARAKEET_WINDOW_MAX_SESSIONS` 8 → 16 (per-listen-pod admission cap). ## Why Final step of the gated ramp to Parakeet-primary live STT (5 → 25 → 50 → 100) approved on 2026-09-29. 50% has been live since 2026-10-02 04:05Z. Gates over the last hour before this PR (prod Prometheus, aggregates only): | Gate | Result | | --- | --- | | Admission refusals < 2% | 0 of 450 admissions (0 since #20208) | | Transcript success within 2 pts of control | no-transcript 5.0% window vs 9.5% control | | First text within 15 s | 96% of sessions | | GPU busy < 60% | ~30% peak per pod; 0 OOM | | Parakeet failovers that lose transcription | 0 in the Parakeet leg | The per-pod cap is raised because listen pods reached 8 concurrent window sessions most hours at 50% (4–11 sessions per hour overflowed to the next provider). Listen pods average 0.19 CPU cores (peak 0.48); the cap is an admission bound, not a resource reservation. Load note: 100% at the current hour is about the load 50% carries at the evening peak. Expected GPU busy at peak with 100% is ~40% per pod on 7 pods (live was ~12% of GPU audio at 25%). ## Rollback Set `PARAKEET_WINDOW_ALLOCATION_PERCENT` back to 50 (or 0) and redeploy listen; chart-only, no image change. ## Deploy Listen helm only, with the current image tag. ## Product invariants affected INV-MEM-4 — the runtime env manifest is a locked path; this changes one rollout percentage and one admission cap, and no memory behaviour. Failure-Class: none 🤖 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/20340?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="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Keep isolated Parakeet metrics fetch failures from voiding a healthy fleet sample. Retain per-replica last-good samples, require fresh quorum and known healthy pool headroom, and expose partial refresh coverage. Admission remains entirely local with bounded memory and HTTP fan-out.
Failure-Class: none
Evidence and reproduction
Baseline: origin/main
33805b4cf2b9(the pressure gate is unchanged from1de60139bf3136c4b0dc0a56b0c2cf439edde513, where the branch started). The supplied production aggregates show 12 missing versus 2 pressure refusals and 7% unavailable refreshes despite scale-out. No customer audio/transcripts or production writes were used.A deterministic run against the original
BatchPressureuses six synthetic replicas and ten polls. Replica six times out only on polls 1, 4, 7; all 60 fetches are attempted. The original fleet refuses on exactly those three polls: 30%. The new behavioral regression runs the same sequence through the real HTTP client and pressure gate and admits 10/10, records exactly three partial refreshes, and keeps six fresh/ready samples.For independent per-replica poll timeout probability
pandNreplicas, the old fleet rejection probability is1 - (1-p)^N. Atp=2%:The new cold-cache column is the binomial probability of fewer than
max(3, floor(N/2)+1)successful samples, assuming all responding pods are healthy. Cached fresh samples further tolerate isolated subsequent failures. These are mathematical illustrations, not production predictions: DNS failures, correlated outages, real pressure and the configured minimum still stand down.Design and safety
backend/utils/stt/batch_pressure.py;parakeet_window.pystill owns its singleton and admission call. Move existing lifecycle tests into the owning pressure suite, avoiding growth of the large window module.asyncio.gather(..., return_exceptions=True)with a one-second HTTP and wall-clock timeout per fetch. DNS failure immediately invalidates the fleet. A stalled poller still expires. A failed request cannot discard the successful responses.PARAKEET_BATCH_PRESSURE_MIN_REPLICASand a strict majority of ready replicas. Quorum loss refuses as missing. Sample expiry is checked again on every admission, including between polls.(busy + unknown) / ready >= 0.5. Unknown pods cannot supply headroom. A six-pod pool therefore needs at least four pods known healthy. A two-pod pool still refuses with one hot pod; a single hot pod in a larger healthy pool no longer rejects the whole fleet.PARAKEET_BATCH_PRESSURE_MAX_LIVE_PENDING_PER_REPLICA(4),PARAKEET_BATCH_PRESSURE_MAX_LIVE_OLDEST_SECONDS(0.75), andPARAKEET_BATCH_PRESSURE_BUSY_REPLICA_SHARE(0.5). Invalid settings stand down. No runtime overlays or deployment settings are changed.unconfigured,missing,stale,pressure). Add refresh outcome partial for a usable quorum with failed fetches; this can include a pressure stand-down. Quorum loss remains unavailable. Addomi_stt_window_batch_pressure_replicas{state="fresh"|"ready"}; labels never include pod addresses or sessions.Parakeet handler and image scope
backend/parakeet/main.py:473already has an async/batch/metricshandler.batch_engine.py:295snapshots bounded waiting queues on the event loop without awaiting inference or taking its asyncio lock;_flush_batchawaits a GPU future, andgpu_worker.py:266performs inference on its dedicated thread. The worker still shares the Python GIL: its Python decoding and_maybe_gc()collections (including a full collection every configured 50 batches by default) can delay other Python work. Moving the snapshot to another thread would not eliminate that contention and would complicate event-loop ownership. The supplied metrics do not establish whether GIL/GC, networking, or another source caused a particular timeout.The new ASGI regression uses a real BatchEngine with one inference held in flight, one live request waiting, and the batch lock held. The actual
/batch/metricsroute responds with exact pending/batch counts before inference is released. It neither waits for inference nor acquires that lock. This does not rule out GIL contention or other event-loop work in production; those need profiling if timeouts remain.Listen-side changes alone resolve the reproduced admission artifact. There is no Parakeet runtime change or separate Parakeet image deploy required. If a server-side fix becomes justified later, it belongs in a separate commit/release. Existing live POST scheduling, sentence anchors, failover replay and quality behavior are unchanged.
Verification
Created the missing backend environment as requested:
cd backend uv venv .venv -p 3.11 uv pip install -p .venv/bin/python -r requirements.txtDirect focused command, with a writable worktree TMPDIR:
TMPDIR="$PWD/../.local/batch-pressure-tmp" .venv/bin/python -m pytest -q -p no:cacheprovider \ tests/unit/test_parakeet_batch_pressure.py \ tests/unit/test_parakeet_window_live.py \ tests/unit/test_parakeet_endpoints.py \ tests/unit/test_parakeet_batch_engine.py \ tests/unit/test_live_gate_replay.py \ tests/unit/test_parakeet_failover_exhausted.py1,001 passed. The final pressure-only run is 33 passed after deriving configuration defaults from the existing threshold constants. Exact assertions cover intermittent fetch failures, cold quorum loss, configured minimum, 15s expiry and between-poll expiry, true saturation, unknown-pod pressure accounting, 9/16/64/65-pod boundaries, DNS failure, malformed/old-revision samples, replica churn, a hung fetch's individual deadline, lifecycle shutdown/restart, and configurable/invalid settings. The Parakeet HTTP route is exercised through ASGI with a real paused engine.
Focused production-module type check: 0 errors, 0 warnings. Publication hooks passed full type checking (0 errors, 9,392 existing warnings) and 30 selected preflight checks. Known unrelated failures supplied with the task: test_app_client_schema_inventory, test_realtime_quota_counter, test_firestore_query_shapes, Hermetic E2E webhook DNS tests. No bypasses or workflow edits.
Review follow-up: failure-class scope
The automated reviewer correctly identified that the existing
FC-shared-batch-pressure-blocks-livedefinition still specifies all-replica freshness. Linking this new partial-sample/quorum suite as that class's canonical guard would be contradictory. This PR removes that link and usesFailure-Class: none: this incident is isolated metrics-failure aggregation, while that older record describes live/backfill scheduling with an all-replica contract. The new behavioral suite remains the guard for this admission policy. The repository failure-class protocol permits only guard-artifact updates in an instance-fix PR; changing canonical prevention requires a separate registry-only lifecycle PR, so no registry policy change is bundled here.GitHub CI on the initial code head passed the backend shards and hygiene. Hermetic Backend E2E failed only the six supplied known-main webhook cases (
testing/e2e/test_webhooks.py), all reportingHermetic e2e blocked DNS lookup for 'webhook.test'; the dependent hermetic merge gate also fails. No webhook/network-test change or bypass is included.Product invariants affected
none
Expected bake effect
Isolated metrics fetch failures and a single temporarily hot pod should stop causing fleet-wide refusals when sufficient known healthy capacity remains. True pressure, lost quorum, expired telemetry, and outright DNS failure still refuse. The <2% production gate must be verified after deployment; the supplied aggregates cannot establish that target before a bake. Use partial refresh counts and fresh/ready coverage alongside admission/refusal and live queue-wait metrics.
No merge or deploy is requested or performed.
🤖 Generated with Claude Code