Repository navigation
feat(legacy-retire): make legacy draining reachable — prod C3/C8 transport and cap-hold census - #24222
Conversation
…-STT Prod never got the M3 activation: no enrichment or provider-stt queue, no transport env, so provider_stt_live (a draining precondition) is false. - ops prod.yaml: create the enrichment queue and declare provider-stt (48 concurrent, 10/s, unlimited attempts; sized for ~205k units/day at 100%); staging mirrors. - prod overlay: ENRICHMENT_ROUTE=enrichment_queue plus ENRICHMENT_TASKS_* on backend, backend-sync, backend-sync-backfill and backend-integration; PROVIDER_STT_TASKS_* on backend-sync and backend-integration. Both handlers are served by backend-integration, matching the prod enrichment-maintenance scheduler entry. Staging gets its own provider handler so the isolation fence holds. - cross_service_contract: the provider-stt edge appends its route like create_wake does (append_route), so the bare-origin URL now validates; drop the stale prod ENRICHMENT_ROUTE known gap. - registry: ENRICHMENT_ROUTE ramp (lead expands, done by 2026-11-05). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The census counted every stt_cap_holds row (5.39M in prod, 5.30M held) as a dark blocker, so dark could never be entered. Held rows are retained audio waiting on credits; dark does not strand them (eligible holds go to batch admission, spend-started holds finish on the shared segment core). Count pending holds through the state group index as an informational field and keep soak gate 4c as the cap-hold assurance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
4 issues found across 16 files
Confidence score: 4/5
backend/docs/runbooks/legacy-dark.mdsays any unavailable read blocksZERO, but a failed cap-hold read is informational and still permits it. Qualify the instruction for that read.backend/tests/unit/test_legacy_dark.pychecks constants but does not verify thattake_censuscounts pending cap holds. Use a fake Firestore query and assert the pending states and count.backend/tests/unit/test_cross_service_deploy_contract.pycan miss route drift between the deploy contract andcreate_wake. Import the producer’sROUTEand assertedge.route == ROUTE.config/feature-flags.yamlpoints operators to the wrong directory for handler and OIDC configuration. Point them tobackend/deploy/runtime_env, and mentionbackend/deploy/opsonly for queue resource definitions.
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/tests/unit/test_legacy_dark.py">
<violation number="1" location="backend/tests/unit/test_legacy_dark.py:245">
P2: This test does not verify that the census actually counts pending cap holds; it only verifies two constants match. Exercise `take_census` with a fake Firestore query and assert the pending states are used and the count reaches `cap_holds_awaiting_legacy`, otherwise regressions in the census path remain undetected.</violation>
</file>
<file name="backend/docs/runbooks/legacy-dark.md">
<violation number="1" location="backend/docs/runbooks/legacy-dark.md:36">
P2: The “Any unavailable read blocks” instruction is false for the cap-hold read described in the next sentence. `drain_census` treats that query failure as informational and still permits `ZERO`, so qualify this as “Any unavailable gating read blocks” to prevent operators from relying on a cap-hold read that never succeeded.</violation>
</file>
<file name="backend/tests/unit/test_cross_service_deploy_contract.py">
<violation number="1" location="backend/tests/unit/test_cross_service_deploy_contract.py:369">
P2: This regression test does not verify that the contract route matches the route used by `create_wake`. Import the producer’s `ROUTE` constant and assert `edge.route == ROUTE`, otherwise route drift can pass the deployment contract.</violation>
</file>
<file name="config/feature-flags.yaml">
<violation number="1" location="config/feature-flags.yaml:105">
P3: This runbook pointer sends operators to the wrong directory for the handler and OIDC configuration. Point the note to `backend/deploy/runtime_env` (and mention `backend/deploy/ops` only for queue resource definitions).</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| from database.cap_hold_redrive import PENDING_STATES | ||
| from scripts.legacy_dark import drain_census | ||
|
|
||
| assert drain_census.CAP_HOLD_PENDING_STATES == PENDING_STATES |
There was a problem hiding this comment.
P2: This test does not verify that the census actually counts pending cap holds; it only verifies two constants match. Exercise take_census with a fake Firestore query and assert the pending states are used and the count reaches cap_holds_awaiting_legacy, otherwise regressions in the census path remain undetected.
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_legacy_dark.py, line 245:
<comment>This test does not verify that the census actually counts pending cap holds; it only verifies two constants match. Exercise `take_census` with a fake Firestore query and assert the pending states are used and the count reaches `cap_holds_awaiting_legacy`, otherwise regressions in the census path remain undetected.</comment>
<file context>
@@ -230,6 +230,21 @@ def test_informational_ledger_counts_never_gate():
+ from database.cap_hold_redrive import PENDING_STATES
+ from scripts.legacy_dark import drain_census
+
+ assert drain_census.CAP_HOLD_PENDING_STATES == PENDING_STATES
+
+
</file context>
| ``` | ||
|
|
||
| It gates on `sync_backfill_pending`, sequencer active owners, `sync_redrive_required`, `stt_cap_holds` (upper bound), the depth of `sync-jobs`, `sync-jobs-fresh`, `sync-backfill` and `sync-backfill-fresh`, and `increase(omi_legacy_sync_admissions_total[30m])`. Any unavailable read blocks. Inline (non-Cloud-Tasks) legacy jobs have no aggregate source; the 30-minute zero-admission window plus the 10-minute confirmation bounds them. A stranded `sr-` enrichment backlog on a legacy queue (C3's pre-switch rows still bound to `sync_handler`) is non-blocking for `dark` entry only when the enrichment route is switched (`ENRICHMENT_ROUTE=enrichment_queue`) AND the backlog's cause is external, as on staging, where the LLM gateway is blackholed (lead ruling 10-20). Every legacy count must still read zero, including non-`sr-` tasks (operator count of task names). Prod's gateway works, so prod's pre-switch backlog drains and the plain census applies. `--with-ledger` adds informational ledger counts where a collection-group index exists (prod has none). | ||
| It gates on `sync_backfill_pending`, sequencer active owners, `sync_redrive_required`, the depth of `sync-jobs`, `sync-jobs-fresh`, `sync-backfill` and `sync-backfill-fresh`, and `increase(omi_legacy_sync_admissions_total[30m])`. Any unavailable read blocks. Pending `stt_cap_holds` are counted but never gate: held rows are retained audio waiting on credits (5.3M in prod, 2026-11-01) and never drain to zero, and `dark` does not strand them, because eligible holds go to batch admission and spend-started holds finish on the shared segment core. Gate 4c below carries the cap-hold assurance. Inline (non-Cloud-Tasks) legacy jobs have no aggregate source; the 30-minute zero-admission window plus the 10-minute confirmation bounds them. A stranded `sr-` enrichment backlog on a legacy queue (C3's pre-switch rows still bound to `sync_handler`) is non-blocking for `dark` entry only when the enrichment route is switched (`ENRICHMENT_ROUTE=enrichment_queue`) AND the backlog's cause is external, as on staging, where the LLM gateway is blackholed (lead ruling 10-20). Every legacy count must still read zero, including non-`sr-` tasks (operator count of task names). Prod's gateway works, so prod's pre-switch backlog drains and the plain census applies. `--with-ledger` adds informational ledger counts where a collection-group index exists (prod has none). |
There was a problem hiding this comment.
P2: The “Any unavailable read blocks” instruction is false for the cap-hold read described in the next sentence. drain_census treats that query failure as informational and still permits ZERO, so qualify this as “Any unavailable gating read blocks” to prevent operators from relying on a cap-hold read that never succeeded.
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/runbooks/legacy-dark.md, line 36:
<comment>The “Any unavailable read blocks” instruction is false for the cap-hold read described in the next sentence. `drain_census` treats that query failure as informational and still permits `ZERO`, so qualify this as “Any unavailable gating read blocks” to prevent operators from relying on a cap-hold read that never succeeded.</comment>
<file context>
@@ -33,7 +33,7 @@ Any failure to read the mode serves `on`. During the soak the legacy image, queu
- It gates on
sync_backfill_pending, sequencer active owners,sync_redrive_required,stt_cap_holds(upper bound), the depth ofsync-jobs,sync-jobs-fresh,sync-backfillandsync-backfill-fresh, andincrease(omi_legacy_sync_admissions_total[30m]). Any unavailable read blocks. Inline (non-Cloud-Tasks) legacy jobs have no aggregate source; the 30-minute zero-admission window plus the 10-minute confirmation bounds them. A strandedsr-enrichment backlog on a legacy queue (C3's pre-switch rows still bound tosync_handler) is non-blocking fordarkentry only when the enrichment route is switched (ENRICHMENT_ROUTE=enrichment_queue) AND the backlog's cause is external, as on staging, where the LLM gateway is blackholed (lead ruling 10-20). Every legacy count must still read zero, including non-sr-tasks (operator count of task names). Prod's gateway works, so prod's pre-switch backlog drains and the plain census applies.--with-ledgeradds informational ledger counts where a collection-group index exists (prod has none).
- It gates on
sync_backfill_pending, sequencer active owners,sync_redrive_required, the depth ofsync-jobs,sync-jobs-fresh,sync-backfillandsync-backfill-fresh, andincrease(omi_legacy_sync_admissions_total[30m]). Any unavailable read blocks. Pendingstt_cap_holdsare counted but never gate: held rows are retained audio waiting on credits (5.3M in prod, 2026-11-01) and never drain to zero, anddarkdoes not strand them, because eligible holds go to batch admission and spend-started holds finish on the shared segment core. Gate 4c below carries the cap-hold assurance. Inline (non-Cloud-Tasks) legacy jobs have no aggregate source; the 30-minute zero-admission window plus the 10-minute confirmation bounds them. A strandedsr-enrichment backlog on a legacy queue (C3's pre-switch rows still bound tosync_handler) is non-blocking fordarkentry only when the enrichment route is switched (ENRICHMENT_ROUTE=enrichment_queue) AND the backlog's cause is external, as on staging, where the LLM gateway is blackholed (lead ruling 10-20). Every legacy count must still read zero, including non-sr-tasks (operator count of task names). Prod's gateway works, so prod's pre-switch backlog drains and the plain census applies.--with-ledgeradds informational ledger counts where a collection-group index exists (prod has none).
Transitions
</file context>
</details>
```suggestion
It gates on `sync_backfill_pending`, sequencer active owners, `sync_redrive_required`, the depth of `sync-jobs`, `sync-jobs-fresh`, `sync-backfill` and `sync-backfill-fresh`, and `increase(omi_legacy_sync_admissions_total[30m])`. Any unavailable gating read blocks. Pending `stt_cap_holds` are counted but never gate: held rows are retained audio waiting on credits (5.3M in prod, 2026-11-01) and never drain to zero, and `dark` does not strand them, because eligible holds go to batch admission and spend-started holds finish on the shared segment core. Gate 4c below carries the cap-hold assurance. Inline (non-Cloud-Tasks) legacy jobs have no aggregate source; the 30-minute zero-admission window plus the 10-minute confirmation bounds them. A stranded `sr-` enrichment backlog on a legacy queue (C3's pre-switch rows still bound to `sync_handler`) is non-blocking for `dark` entry only when the enrichment route is switched (`ENRICHMENT_ROUTE=enrichment_queue`) AND the backlog's cause is external, as on staging, where the LLM gateway is blackholed (lead ruling 10-20). Every legacy count must still read zero, including non-`sr-` tasks (operator count of task names). Prod's gateway works, so prod's pre-switch backlog drains and the plain census applies. `--with-ledger` adds informational ledger counts where a collection-group index exists (prod has none).
| # utils/provider_stt_tasks.create_wake posts to PROVIDER_STT_TASKS_HANDLER_URL + ROUTE (test_wake_task_shape), | ||
| # so the configured URL is a bare origin; without append_route the contract demanded the doubled path. | ||
| edge = next(e for e in contract.TASK_EDGES if e.id == 'provider-stt') | ||
| assert edge.append_route is True |
There was a problem hiding this comment.
P2: This regression test does not verify that the contract route matches the route used by create_wake. Import the producer’s ROUTE constant and assert edge.route == ROUTE, otherwise route drift can pass the deployment contract.
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_cross_service_deploy_contract.py, line 369:
<comment>This regression test does not verify that the contract route matches the route used by `create_wake`. Import the producer’s `ROUTE` constant and assert `edge.route == ROUTE`, otherwise route drift can pass the deployment contract.</comment>
<file context>
@@ -362,6 +362,13 @@ def test_append_route_edge_with_path_fails(results: Results) -> None:
+ # utils/provider_stt_tasks.create_wake posts to PROVIDER_STT_TASKS_HANDLER_URL + ROUTE (test_wake_task_shape),
+ # so the configured URL is a bare origin; without append_route the contract demanded the doubled path.
+ edge = next(e for e in contract.TASK_EDGES if e.id == 'provider-stt')
+ assert edge.append_route is True
+
+
</file context>
| - {"key":"BATCH_JOBSTORE_MODE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default firestore; shadow mirrors committed batch job-store writes to the staging Postgres and counts read parity (Firestore stays the only authority)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-02","decision":"pending","notes":"Plan A2, legacy-sync retirement lane 12. Takes effect only with JOBSTORE_PG_HOST/_DATABASE/_USER set (IAM database auth, no password); the batch_pipeline_prod namespace is refused in code, and every other value or a missing setting keeps plain Firestore. Ramp: staging worker plus the staging backend services that build the batch store, after the A2 PR lands; metric omi_jobstore_shadow_parity_total must stay at or above 99.99% read match over 12h (M3), with mirror write errors and timeouts near zero. Prod needs the approved Cloud SQL instance (S1-b) and Postgres coverage for the writers that bypass Store.run (purge, retention, recovery); the lead expands. postgres_primary and postgres are reserved for A7. Rollback: unset, or JOBSTORE_SHADOW_WRITES=off."} | ||
| - {"key":"JOBSTORE_SHADOW_WRITES","aliases":[],"kind":"env","terminal":"keep","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on unless 0/false/off/no; off stops the A2 Postgres shadow mirror (and its parity reads) while BATCH_JOBSTORE_MODE=shadow","fail":"open","owner":"dazheng","created":"2026-10-19","decision":"keep","notes":"Cost and load lever only: the mirror is best effort and never affects the Firestore primary. Writes skipped while off count as omi_jobstore_shadow_parity_total{op=write,outcome=skipped}. See backend/database/jobstore/dual_store.py."} | ||
| - {"key":"ENRICHMENT_ROUTE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default sync_handler; enrichment_queue binds new sr- enrichment obligations to /v2/enrichment/run on the enrichment queue (plan C3)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-02","decision":"pending","notes":"Legacy-sync retirement lane 9 (#22462). A row keeps the binding it was created with, so switching back never strands in-flight work; both bindings stay valid. Ramp: staging at M2 under replay (sr- 120s dispatch SLI clean, old bindings drain, zero 5xx), then prod after the M3 train under the C3 24h sr- dispatch SLI gate; the lead expands. Must be enrichment_queue before legacy draining (contract (h) invariant 3). Replaced by E1's enrichment_route policy field. Queue wiring (ENRICHMENT_TASKS_QUEUE, _HANDLER_URL, _OIDC_AUDIENCE, _INVOKER_SA) is deploy config in backend/deploy/ops, not a flag."} | ||
| - {"key":"ENRICHMENT_ROUTE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default sync_handler; enrichment_queue binds new sr- enrichment obligations to /v2/enrichment/run on the enrichment queue (plan C3)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-09","decision":"pending","notes":"Legacy-sync retirement lane 9 (#22462). A row keeps the binding it was created with, so switching back never strands in-flight work; both bindings stay valid. Staging has served enrichment_queue since M2. Prod activation (planc, Plan C): the prod overlay sets enrichment_queue on backend, backend-sync, backend-sync-backfill and backend-integration, with backend-integration serving /v2/enrichment/run; the config-train must create the enrichment queue before that roll. Kill switch: sync_handler. Must be enrichment_queue before legacy draining (contract (h) invariant 3). GKE listen keeps the default until its own roll; its rows bind sync_handler and still drain. Replaced by E1's enrichment_route policy field. Queue wiring (ENRICHMENT_TASKS_QUEUE, _HANDLER_URL, _OIDC_AUDIENCE, _INVOKER_SA) is deploy config, not a flag.","ramp":{"cohorts":["staging since 2026-10-20 (M2)","prod: every backend Cloud Run service at the backend train after the config-train creates the enrichment queue"],"clean_metric":"sr- first-summary dispatch within 121s of first_pending_at (fleet-gate first_summary_* tokens) flat vs the 24h before; zero 5xx/429/503 on /v2/enrichment/run; enrichment queue depth drains; old sync_handler bindings drain from sync-jobs","expander":"two-lane lead","done_by":"2026-11-05"}} |
There was a problem hiding this comment.
P3: This runbook pointer sends operators to the wrong directory for the handler and OIDC configuration. Point the note to backend/deploy/runtime_env (and mention backend/deploy/ops only for queue resource definitions).
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 105:
<comment>This runbook pointer sends operators to the wrong directory for the handler and OIDC configuration. Point the note to `backend/deploy/runtime_env` (and mention `backend/deploy/ops` only for queue resource definitions).</comment>
<file context>
@@ -102,7 +102,7 @@ flags:
- {"key":"BATCH_JOBSTORE_MODE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default firestore; shadow mirrors committed batch job-store writes to the staging Postgres and counts read parity (Firestore stays the only authority)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-02","decision":"pending","notes":"Plan A2, legacy-sync retirement lane 12. Takes effect only with JOBSTORE_PG_HOST/_DATABASE/_USER set (IAM database auth, no password); the batch_pipeline_prod namespace is refused in code, and every other value or a missing setting keeps plain Firestore. Ramp: staging worker plus the staging backend services that build the batch store, after the A2 PR lands; metric omi_jobstore_shadow_parity_total must stay at or above 99.99% read match over 12h (M3), with mirror write errors and timeouts near zero. Prod needs the approved Cloud SQL instance (S1-b) and Postgres coverage for the writers that bypass Store.run (purge, retention, recovery); the lead expands. postgres_primary and postgres are reserved for A7. Rollback: unset, or JOBSTORE_SHADOW_WRITES=off."}
- {"key":"JOBSTORE_SHADOW_WRITES","aliases":[],"kind":"env","terminal":"keep","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on unless 0/false/off/no; off stops the A2 Postgres shadow mirror (and its parity reads) while BATCH_JOBSTORE_MODE=shadow","fail":"open","owner":"dazheng","created":"2026-10-19","decision":"keep","notes":"Cost and load lever only: the mirror is best effort and never affects the Firestore primary. Writes skipped while off count as omi_jobstore_shadow_parity_total{op=write,outcome=skipped}. See backend/database/jobstore/dual_store.py."}
- - {"key":"ENRICHMENT_ROUTE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default sync_handler; enrichment_queue binds new sr- enrichment obligations to /v2/enrichment/run on the enrichment queue (plan C3)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-02","decision":"pending","notes":"Legacy-sync retirement lane 9 (#22462). A row keeps the binding it was created with, so switching back never strands in-flight work; both bindings stay valid. Ramp: staging at M2 under replay (sr- 120s dispatch SLI clean, old bindings drain, zero 5xx), then prod after the M3 train under the C3 24h sr- dispatch SLI gate; the lead expands. Must be enrichment_queue before legacy draining (contract (h) invariant 3). Replaced by E1's enrichment_route policy field. Queue wiring (ENRICHMENT_TASKS_QUEUE, _HANDLER_URL, _OIDC_AUDIENCE, _INVOKER_SA) is deploy config in backend/deploy/ops, not a flag."}
+ - {"key":"ENRICHMENT_ROUTE","aliases":[],"kind":"env","terminal":"undecided","lifecycle":"rollout","surfaces":["backend"],"summary":"Default sync_handler; enrichment_queue binds new sr- enrichment obligations to /v2/enrichment/run on the enrichment queue (plan C3)","fail":"closed","owner":"dazheng","created":"2026-10-19","review_by":"2026-11-09","decision":"pending","notes":"Legacy-sync retirement lane 9 (#22462). A row keeps the binding it was created with, so switching back never strands in-flight work; both bindings stay valid. Staging has served enrichment_queue since M2. Prod activation (planc, Plan C): the prod overlay sets enrichment_queue on backend, backend-sync, backend-sync-backfill and backend-integration, with backend-integration serving /v2/enrichment/run; the config-train must create the enrichment queue before that roll. Kill switch: sync_handler. Must be enrichment_queue before legacy draining (contract (h) invariant 3). GKE listen keeps the default until its own roll; its rows bind sync_handler and still drain. Replaced by E1's enrichment_route policy field. Queue wiring (ENRICHMENT_TASKS_QUEUE, _HANDLER_URL, _OIDC_AUDIENCE, _INVOKER_SA) is deploy config, not a flag.","ramp":{"cohorts":["staging since 2026-10-20 (M2)","prod: every backend Cloud Run service at the backend train after the config-train creates the enrichment queue"],"clean_metric":"sr- first-summary dispatch within 121s of first_pending_at (fleet-gate first_summary_* tokens) flat vs the 24h before; zero 5xx/429/503 on /v2/enrichment/run; enrichment queue depth drains; old sync_handler bindings drain from sync-jobs","expander":"two-lane lead","done_by":"2026-11-05"}}
- {"key":"BATCH_PIPELINE_PROJECTION_PREDECESSOR_REPLAY_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on; a blocked projection successor schedules its owner's missing predecessor through the existing ordered walk","fail":"open","owner":"dazheng","created":"2026-10-21","terminal":"keep","decision":"keep","ramp":{"cohorts":["all admitted batch owners at deployment"],"clean_metric":"owner_chain advanced increases for replayable predecessors; no new privacy, binding or chain-order violations","expander":"two-lane lead","done_by":"2026-10-22"},"notes":"False restores blocked-page discovery behavior. One bounded replay per owner per sweep, or the existing owner-drain queue; every assignment retains transactional predecessor, privacy, binding and replay fences. A head with an unresolved safety fence remains blocked. See backend/docs/batch-pipeline-serving.md."}
- {"key":"STT_PRERECORDED_LANGUAGE_GUARD_ENABLED","aliases":[],"kind":"env","lifecycle":"ops_kill","surfaces":["backend"],"summary":"Default on unless false; unknown/multilingual audio needs independent supported-language detection at confidence >=0.9 for probes under10s or >=0.8 for longer probes to use Parakeet; unsupported or uncertain speech uses Modulate","fail":"open","owner":"dazheng","created":"2026-10-21","terminal":"keep","decision":"keep","notes":"CPU selection/intake switch. Bounded Modulate language-only classification precedes unknown-language dispatch; confident European speech retains Parakeet. False disables new probes and restores ordinary prerecorded routing; admitted worker audio still requires supported-language proof and drains through multilingual recovery. The short-probe floor has its own default-on kill switch. No streaming change. See backend/docs/batch-language-quality.md."}
</file context>
…tt sweep) Luna r1 P1 on #24222: the job stayed lifecycle planned, so nothing re-woke a provider unit whose task create failed and provider_stt_live stayed false. Prod is active; dev stays planned and paused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Luna round 2 on #24222: two P1s, planc rebuttal (round cap reached; lead decides)Head P1 (b): provider-STT sweep rotates
|
Apply the 15% GPU floor share at every step of the queue table, size the staging ladder's audio budget and temporary queue raise, state that the provider-stt entries and staging mirror arrive with #24222, mark the sim drill cases as slice D prerequisites, and update the two worker docs that still named the floor of three. Record the F1/F2 fixes as built: a durable job-document route proof in the observer, and a provider-stage VAD measurement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#24243) Slice E of all-vendor batch routing: the standing GPU floor and the capacity plan around it. **Floor 3 → 4 on-demand L4.** David (11-01) wants GPUs kept even when a vendor is cheaper, because Modulate has outages. L4 stockouts fail scale-up but never take running on-demand nodes, so the floor must already be standing before an outage. `replicaCount` and `autoscaling.minReplicas` move together, and a chart test pins them equal. Takes effect at the lead's next worker Helm roll: about $20.5/day list above floor 3. On 11-01 the pool had 5 Ready nodes during the a/b/c stockout, so 4 fits without scale-up. Rollback: 3. The floor *share* (`gpu_floor_percent`) is slice B's route-table value; slice E has no flags. **Runbook** `backend/docs/runbooks/batch-vendor-routing-capacity.md`: - floor sizing and cost; - `provider-stt` queue sizing (dispatch ≥ 2 × peak, concurrency ≈ 2 × peak × L), with a step table. L is unmeasured, so every row is an estimate. The sync handler holds one `sync` thread (16/instance) per vendor call; - the staging rate-limit ladder (5 → 10 → 25 → 50 concurrent, stop rules, receipt); - staging/sim and 1% prod failover drills; - guard interlocks F1–F4 behind lead ruling `d914f8`; - rollout order, and the outage and stockout plays. The `provider-stt` queue resize itself is not in this PR. The queue is created by #24222 at 48/10, which covers the 1% step if L ≤ about 5s. The resize waits for #24222 and the staging L measurement, and lands as a lead-owned `deploy/ops/prod.yaml` change. Verification: `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST` = `test_batch_pipeline_chart.py` and `test_monitoring_adapter_hpa_contract.py`, through `omi-heavy`: 80 passed (Helm present). Layer: offline Helm render and unit tests only. No deploy, no flag, no queue, no prod reads. Deploy needed (lead): a worker Helm roll to carry floor 4, after confirming at least 4 Ready on-demand nodes and that the `batch-pipeline-pool` minimum is ≥ 4. 🤖 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/24243?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="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24243?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24243&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
# Conflicts: # backend/deploy/runtime_env/prod.overlay.yaml
Plan C: make legacy
draining/darkreachable without waiting on batch 100. Two independent blockers sat outside the ramp; this PR removes both. Evidence (ro-prod aggregates, 2026-11-01 06:07–06:15Z):swarm/state/refs/planc-darkready-2026-11-01.mdin the workspace.1. Prod transport for C3 enrichment and C8 provider-STT
Prod has no
enrichmentorprovider-sttCloud Tasks queue (Monitoring lists every queue with a depth series; empty queues still report 0), noenrichment-maintenancejob, and noENRICHMENT_TASKS_*/PROVIDER_STT_TASKS_*env. Soprovider_stt_live, aDRAINING_PRECONDITIONSid, is false, and at draining unsupported-language units would strand inprovider_pending. None of this depends on batch percent.deploy/ops/prod.yaml: the config-train createsenrichment(wasenabled: false) and the newprovider-sttqueue (48 concurrent, 10/s, unlimited attempts, 10–300s backoff). Sizing: at 100% about 205k units/day take the provider route (2.4/s mean); 48/10 covers a 2x peak at ~10s per vendor call. One paid call per unit is the outbox intent's job, not the queue's.staging.yamlmirrors (mirror test).deploy/runtime_env/prod.overlay.yaml(+ regeneratedruntime_env.yaml):ENRICHMENT_ROUTE=enrichment_queue,ENRICHMENT_TASKS_QUEUE,_HANDLER_URL,_OIDC_AUDIENCEon backend, backend-sync, backend-sync-backfill and backend-integration (everysr-producer).PROVIDER_STT_TASKS_QUEUE,_HANDLER_URL,_OIDC_AUDIENCEon backend-sync and backend-integration (intake, cap-hold admission, maintenance sweep).enrichment-maintenancescheduler entry already injobs.yaml, and moving this work off backend-sync, which Plan C retires. backend-integration already admits Cloud Tasks OIDC (public ingress, token verified in-app); the invoker identity is the existingSYNC_TASKS_INVOKER_SA. No IAM change.sync_handlerand still drain.scripts/cross_service_contract.py: theprovider-sttedge now hasappend_route=True.create_wakejoins the route onto the handler origin (test_wake_task_shape), so the contract was demanding a doubled path. The stale prodENRICHMENT_ROUTEknown gap is deleted. Contract: 0 new violations, 0 stale gaps.2. Retained cap holds no longer gate the dark census
drain_census --env prodcounted everystt_cap_holdsrow as a dark blocker: 5,390,555 rows (held 5,304,010, purged 86,612). Held rows are retained audio waiting on the owner's credits and never drain to zero, sodarkcould never be entered. They are not stranded by dark:cap_hold_recovery.recover_selectedadmits every eligible hold to batch once legacy is draining/dark (cap_hold_admission.enabled_for), and a hold whose legacy spend already started finishes on the shared segment core (kept by C11), not on legacy jobs, queues or the sequencer. The census now counts pending holds (thecap_hold_redrive.PENDING_STATES, through the existingstategroup index) as an informational field; soak gate 4c ("cap-hold redrives served by batch") stays the assurance. Runbook updated. This changes a dark-entry gate: lead ruling required before merge.Lead apply sequence (after merge; each step is an existing command)
jobs.yamlnow marks the prodenrichment-maintenancejob active (dev stays planned/paused), soprovider_stt_liveis satisfied in source and a full scheduler reconcile keeps it; it also sweeps the provider-stt outbox, re-waking any unit whose task create failed (Luna r1 P1).Trap:
ops_train applyapplies the whole plan. On 11-01 live backend-syncmax_instancesis 40 while source says 50 (syncquick's source change is separate), so the plan would also revert that cap. Apply only if the plan shows nothing but the two creates; otherwise create the two queues directly with the same values and leave the rest of the plan alone:gcloud tasks queues create enrichment --location us-central1 --project based-hardware --max-concurrent-dispatches=50 --max-dispatches-per-second=25 --max-attempts=unlimited --min-backoff=10s --max-backoff=300s && gcloud tasks queues create provider-stt --location us-central1 --project based-hardware --max-concurrent-dispatches=48 --max-dispatches-per-second=10 --max-attempts=unlimited --min-backoff=10s --max-backoff=300sVerify after the train: each serving revision of the four services shows the new keys (shape only),
enrichmentqueue depth drains,sr-first-summary dispatch ≤121s flat, zero 5xx/429/503 on/v2/enrichment/run;provider-sttstays idle until draining.Ramp plan (ENRICHMENT_ROUTE)
first_summary_*(no dispatch over 121s) flat vs the prior 24h; zero 5xx/429/503 on/v2/enrichment/run; enrichment depth drains; oldsync_handlerbindings drain from sync-jobs.ENRICHMENT_ROUTE=sync_handler(rows keep their binding; both handlers stay valid).Validation
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST,omi-heavy,nice -n 19: staging overlay 32, config-train 51, runtime renderer 91, drift 21, cross-service deploy contract 23 (+3 skipped), scheduler reconcile 16, runtime validator 24, manifest compat 11, provider-STT outbox 148, legacy-dark 117 + lost-recordings 61 + GMP sidecar 8: all passed.scripts/cross_service_contract.py: 0 new violations, 33 known gaps, 0 stale.scripts/check_feature_flag_registry.py: OK.Product invariants affected
runtime_env.yamlonly gains task transport env; enrichment runs the same consumer and memory consolidation route on a different queue/host, so intake and promotion behavior are unchanged.Failure-Class: none
Rollback:
ENRICHMENT_ROUTE=sync_handlerin the overlay and roll (in-flight rows keep their binding). UnsetPROVIDER_STT_TASKS_*to stop provider wakes. Queues are left in place (idle). Census: revert the commit.🤖 Generated with Claude Code