Skip to content

fix(sync): stop routing all offline recordings through the bounded backfill lane - #10400

Merged
mdmohsin7 merged 3 commits into
mainfrom
fix/sync-route-main-queue
Jul 23, 2026
Merged

mdmohsin7 merged 3 commits into
mainfrom
fix/sync-route-main-queue

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Offline recordings uploaded successfully and then sat unprocessed for many
hours. The queue backing the historical-recovery lane had built up ~14.7k
tasks, some scheduled almost a day after they were created, while the workers
behind it were idle.

What was happening

classify_sync_lane marks an upload fresh only when the server can
corroborate its capture time against a conversation it already knows about. An
offline recording has no such conversation — the server was not in the loop
when it was captured — so every offline upload classifies as backfill,
regardless of age. Production shows recordings thirty seconds old admitted as
lane=backfill trust=legacy reason=unbound_capture_time.

That sent the entire offline workload to a lane provisioned for occasional
historical recovery: a worker capped at four instances at one request each,
behind a queue offering four dispatches at a time.

The failure was not throughput, it was compounding retry delay:

  1. dispatch exceeds what four instances can admit
  2. Cloud Run rejects the surplus with "no available instance"
  3. Cloud Tasks retries each rejection with exponential backoff, up to an hour
  4. tasks end up scheduled hours out, so few are eligible at any moment
  5. the queue looks enormous while the workers have nothing to run

Raising the worker to thirty barely moved throughput, because the backlog was
waiting on backoff rather than capacity. Bounding the backoff took completions
from roughly eight per minute to fifty, with rejections falling to zero.

Changes

Route every sync job to the main queue. The main queue has no dispatch cap,
which is what offline sync ran on before the lane split. The lane label stays on
the payload for metering and reporting; it no longer selects the queue.

Size the lane so dispatch cannot outrun the worker. Dispatch concurrency now
equals the worker's instance ceiling — offering more than the worker admits is
what produced the rejections. A warm instance keeps a scale-from-zero poke from
being rejected outright, and retry backoff is bounded so one transient rejection
cannot strand a recording for hours.

The deploy action previously hardcoded the old four-and-four sizing on every
run, so any manual tuning was silently reverted by the next deploy.

Tests

test_backfill_lane_still_uses_the_main_queue asserts a payload carrying the
backfill lane enqueues to the main queue and handler, with the label preserved.
The lifecycle contract test asserts the matched sizing and the bounded backoff.

tests/unit/test_sync_two_lane.py and tests/unit/test_sync_v2.py — 199 passed.
Nine failures in test_sync_cloud_tasks.py reproduce identically on an
unmodified checkout; they are a fakeredis artifact in this environment and are
unrelated to this change.

Failure-Class: none

Review in cubic

An offline recording can never carry server capture proof, because the server
was not in the loop when it was captured. Every offline upload therefore
classifies as backfill, which routed the entire offline workload to a lane
provisioned for occasional historical recovery: a worker admitting four jobs at
once behind a queue offering four at a time.

Cloud Run rejected the surplus with no available instance, and Cloud Tasks
retried each rejection with exponential backoff up to an hour, so a recording
could sit scheduled almost a day out while the workers were idle. Recordings
uploaded fine and then never became conversations.

The lane label stays on the payload for metering and reporting; it no longer
selects the queue.
Dispatch concurrency now matches the worker's instance ceiling, a warm instance
keeps a scale-from-zero poke from being rejected outright, and retry backoff is
bounded so one transient rejection cannot strand a recording for hours.
kodjima33 added a commit that referenced this pull request Jul 23, 2026
## What changed and why

Parakeet could keep a replica Ready after a fatal CUDA stream-capture
error, so one poisoned process served only HTTP 500s indefinitely. This
disables CUDA graph decoding when batch and streaming inference share
the GPU, makes fatal accelerator errors poison the authoritative GPU
worker state, and lets health probes recycle the replica.

It also adds per-pod black-hole and fatal-CUDA alerts and fixes the
dashboard to use Parakeet's `success`/`error` status labels.

## Product invariants affected

none

## How it was verified

- Recycled the original poisoned production pod and observed its
replacement become Ready and serve successful transcriptions with no
CUDA/HTTP 500 errors.
- The live Prometheus form of the new black-hole query then detected the
same failure recurring on that replacement. Production logs confirmed
the exact `cudaErrorStreamCaptureUnsupported` failure.
- Completed a rolling Parakeet-only configuration change to
`PARAKEET_CUDA_GRAPHS=false` while the healthy sibling continued
serving. Both replacement replicas became Ready with healthy `/health`
responses and served 211 real transcriptions immediately after rollout
(209 + 2), with zero HTTP 500s and zero fatal-CUDA signatures.
- `backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_parakeet_gpu_worker.py
backend/tests/unit/test_parakeet_endpoints.py
backend/tests/unit/test_parakeet_stream_session.py
backend/tests/unit/test_parakeet_helm_contract.py
backend/tests/unit/test_monitoring_alert_rule_contract.py` — 149 passed.
- `make runtime-image-source-closure` — all 10 registered runtime-image
contracts passed.
- `PYTHON=.venv/bin/python bash test-preflight.sh` — 18 checks passed, 0
failed.
- `OMI_PR_BODY_FILE=/tmp/parakeet-pr-body.md make preflight` — all 20
diff-scoped checks passed; the bounded pre-push typecheck, unit-test,
OpenAPI, and formatting gate also passed.
- The repository-wide `PYTHON=.venv/bin/python bash test.sh` run reached
and passed every Parakeet test, but was not green due unrelated
current-tree failures in desktop release contracts and fast-unit timing
guards; one unrelated memory-adapter process was interrupted after
remaining idle on a live Google connection for more than eight minutes.
- GitHub's backend unit, image-smoke, source-closure, API-contract,
sync-gauntlet, and listen-gauntlet checks passed. The broad hermetic E2E
job twice reproduced the current unrelated
`TestSurfaceDefaultAccessMatrix...[agent_tools]` failure (113 passed, 3
skipped); the identical failure is present on PR #10400, whose diff only
touches sync cloud-task files.

The real CUDA concurrency trigger was not reproduced on a development
GPU. Its production recurrence and removal by the live configuration
rollout provide the runtime evidence.

## Tests

-
`test_exact_incident_error_transitions_real_worker_health_to_unhealthy`
covers the incident error flowing through the real worker state into
HTTP 503 health.
- `TestGPUWorkerFatalCUDA` covers fatal classification, fail-closed
admission, callback idempotency, thread shutdown, ordinary error
recovery, and OOM separation.
- RNNT tests cover fatal startup/decode propagation and the nonfatal
fallback path.
- Helm tests require CUDA graphs off plus HTTP readiness/liveness
probes.
- Monitoring contract tests require both per-pod alerts and application
status labels.

## Failure class (fixes)

Failure-Class: new

## Failure-class transition narrative (only when needed)

This adds `FC-poisoned-accelerator-readiness`. Violated contract: a
serving GPU process whose CUDA context is unsafe must not remain Ready
or accept more inference. The canonical guard is the GPU worker's fatal
state, surfaced through `/health` to Kubernetes readiness/liveness, with
CUDA graphs prohibited when batch and streaming inference share a
process. Evidence is the 2026-07-23 production incident, its recurrence
on replacement pod `prod-omi-parakeet-6cf8b5ccbf-d5786`, and the
enabling configuration from PR #7938.

## New guards (only when adding a check or ratchet)

The Helm and monitoring contract checks would have caught the 2026-07-23
Parakeet incident configuration and observability gaps. This is not a
shared primitive because CUDA-context validity and Parakeet's mixed
batch/streaming decoder configuration are specific to this GPU service.

## Scoped cleanups (optional)

The Parakeet dashboard's HTTP-style `status=~"[45].."` filters were
changed to the application's actual `status="error"` label.
@mdmohsin7
mdmohsin7 merged commit 202da53 into main Jul 23, 2026
34 of 40 checks passed
@mdmohsin7
mdmohsin7 deleted the fix/sync-route-main-queue branch July 23, 2026 18:15
Git-on-my-level added a commit that referenced this pull request Aug 21, 2026
…f flag (#11966)

The always-on worker is paying for ~95% backfill traffic the idle
backend-sync-backfill service was provisioned to take; keep #10400's
main-queue default until the 30-wide worker is proven in production.
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
## What changed and why

Parakeet could keep a replica Ready after a fatal CUDA stream-capture
error, so one poisoned process served only HTTP 500s indefinitely. This
disables CUDA graph decoding when batch and streaming inference share
the GPU, makes fatal accelerator errors poison the authoritative GPU
worker state, and lets health probes recycle the replica.

It also adds per-pod black-hole and fatal-CUDA alerts and fixes the
dashboard to use Parakeet's `success`/`error` status labels.

## Product invariants affected

none

## How it was verified

- Recycled the original poisoned production pod and observed its
replacement become Ready and serve successful transcriptions with no
CUDA/HTTP 500 errors.
- The live Prometheus form of the new black-hole query then detected the
same failure recurring on that replacement. Production logs confirmed
the exact `cudaErrorStreamCaptureUnsupported` failure.
- Completed a rolling Parakeet-only configuration change to
`PARAKEET_CUDA_GRAPHS=false` while the healthy sibling continued
serving. Both replacement replicas became Ready with healthy `/health`
responses and served 211 real transcriptions immediately after rollout
(209 + 2), with zero HTTP 500s and zero fatal-CUDA signatures.
- `backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_parakeet_gpu_worker.py
backend/tests/unit/test_parakeet_endpoints.py
backend/tests/unit/test_parakeet_stream_session.py
backend/tests/unit/test_parakeet_helm_contract.py
backend/tests/unit/test_monitoring_alert_rule_contract.py` — 149 passed.
- `make runtime-image-source-closure` — all 10 registered runtime-image
contracts passed.
- `PYTHON=.venv/bin/python bash test-preflight.sh` — 18 checks passed, 0
failed.
- `OMI_PR_BODY_FILE=/tmp/parakeet-pr-body.md make preflight` — all 20
diff-scoped checks passed; the bounded pre-push typecheck, unit-test,
OpenAPI, and formatting gate also passed.
- The repository-wide `PYTHON=.venv/bin/python bash test.sh` run reached
and passed every Parakeet test, but was not green due unrelated
current-tree failures in desktop release contracts and fast-unit timing
guards; one unrelated memory-adapter process was interrupted after
remaining idle on a live Google connection for more than eight minutes.
- GitHub's backend unit, image-smoke, source-closure, API-contract,
sync-gauntlet, and listen-gauntlet checks passed. The broad hermetic E2E
job twice reproduced the current unrelated
`TestSurfaceDefaultAccessMatrix...[agent_tools]` failure (113 passed, 3
skipped); the identical failure is present on PR BasedHardware#10400, whose diff only
touches sync cloud-task files.

The real CUDA concurrency trigger was not reproduced on a development
GPU. Its production recurrence and removal by the live configuration
rollout provide the runtime evidence.

## Tests

-
`test_exact_incident_error_transitions_real_worker_health_to_unhealthy`
covers the incident error flowing through the real worker state into
HTTP 503 health.
- `TestGPUWorkerFatalCUDA` covers fatal classification, fail-closed
admission, callback idempotency, thread shutdown, ordinary error
recovery, and OOM separation.
- RNNT tests cover fatal startup/decode propagation and the nonfatal
fallback path.
- Helm tests require CUDA graphs off plus HTTP readiness/liveness
probes.
- Monitoring contract tests require both per-pod alerts and application
status labels.

## Failure class (fixes)

Failure-Class: new

## Failure-class transition narrative (only when needed)

This adds `FC-poisoned-accelerator-readiness`. Violated contract: a
serving GPU process whose CUDA context is unsafe must not remain Ready
or accept more inference. The canonical guard is the GPU worker's fatal
state, surfaced through `/health` to Kubernetes readiness/liveness, with
CUDA graphs prohibited when batch and streaming inference share a
process. Evidence is the 2026-07-23 production incident, its recurrence
on replacement pod `prod-omi-parakeet-6cf8b5ccbf-d5786`, and the
enabling configuration from PR BasedHardware#7938.

## New guards (only when adding a check or ratchet)

The Helm and monitoring contract checks would have caught the 2026-07-23
Parakeet incident configuration and observability gaps. This is not a
shared primitive because CUDA-context validity and Parakeet's mixed
batch/streaming decoder configuration are specific to this GPU service.

## Scoped cleanups (optional)

The Parakeet dashboard's HTTP-style `status=~"[45].."` filters were
changed to the application's actual `status="error"` label.
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