Repository navigation
SCA-1972: fix(batch): skip the vendor for provider units with under 2 s of speech - #25192
Conversation
A provider-route unit is billed for its whole ~31 s span. Units with under 2 s of strict-VAD speech were 26% of billed provider audio on 2026-11-13. They now take the existing local-silence path. BATCH_VENDOR_MIN_SPEECH_SECONDS (default 2, 0 restores the no-spans-only rule) sets the threshold, and omi_batch_pipeline_vendor_short_speech_skipped_audio_seconds_total counts the unbilled audio. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and recovery tests out of the skip Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…conformance speech span Luna review r1 on the short-speech skip: the abandoned-intent silence path now counts skipped audio when the intent measured speech, and the provider conformance test supplies 2.5 s of speech so it still exercises the vendor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis 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. |
Resolve provider_stt _Call against SCA-1750 allowance_period (keep both fields, pass by keyword) and raise the flag budget count to 274. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb6163a3af
ℹ️ 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".
| HELD_STALE_GRACE_SECONDS_MAX, | ||
| ) | ||
|
|
||
|
|
There was a problem hiding this comment.
Document the changed transcription boundary in the pipeline notes
This changes the default transcription behavior from skipping only silence to discarding units containing up to two seconds of detected speech, but the commit adds no pipeline change note. backend/AGENTS.md explicitly requires a note for transcription changes. A repository search of backend/docs/listen_pusher_pipeline* also found no documentation of BATCH_VENDOR_MIN_SPEECH_SECONDS. Add the required note describing the intentional content loss, rollout, and rollback, and document the new environment/default contract in the pipeline reference. The feature-flag registry alone does not satisfy this requirement.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
| if plan.skip_vendor and plan.inspected and plan.inspected[2]: | ||
| vendor_metrics.short_speech_skip(plan.service, duration) |
There was a problem hiding this comment.
Count short-speech skips when reconciling a persisted result
If persisting a short-speech silence result succeeds but the subsequent settle fails, _finish returns a retry before incrementing this counter. On redelivery, _reconcile finds the saved URI and settles through its first branch, which records only late-result and overflow metrics; it never calls short_speech_skip. The new call in _settle_skipped_silence covers only cases with no saved result, so these successfully skipped units are permanently absent from the savings metric. Increment the counter after a successful saved-result reconciliation when the intent identifies a short-speech skip.
Useful? React with 👍 / 👎.
…he pipeline note REVIEW finding 1: add docs/listen_pusher_pipeline/changes/2026-11-13-provider-min-speech.md. backend/AGENTS.md requires a note for transcription changes, and this one intentionally discards up to 2 s of speech per unit; the flag registry alone does not record it. REVIEW finding 2: _reconcile's saved-result branch now counts the unbilled audio in omi_batch_pipeline_vendor_short_speech_skipped_audio_seconds_total when a persisted short-speech silence settles late, the third path a skip can take, with a test that fails without the increment. Also makes the _finish guard require the silence outcome explicitly (non-blocking note). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mpare stable rows Co-authored-by: multica-agent <[email protected]>
Co-authored-by: multica-agent <[email protected]>
What
A provider-route batch unit whose strict-VAD speech is under 2 s is now answered as local silence, with no vendor call. Before this change, only a unit with no speech spans at all skipped the vendor. The threshold is
BATCH_VENDOR_MIN_SPEECH_SECONDS: default2, and0restores the old no-spans-only rule.Why
David, 2026-11-13: process user recordings economically; skipping very short ones is fine.
Provider units are ~31 s capture spans, and each is billed for its full duration even when VAD found a second of speech. Production sample (2026-11-13 ~10:30Z, ro-prod, metadata only):
result_readyprovider-route units; 1,345 had no speech and were already skipped.daily-cost-current, 11-05..11-09), so this saves about $40–50/day on fresh input, plus the same share of the provider backlog still to drain.empty_asrquarantines were exactly these sub-2 s units, so vendors often return nothing for them anyway.Change
config/batch_pipeline_vendor_failover.py:min_speech_seconds()readsBATCH_VENDOR_MIN_SPEECH_SECONDS. Default 2, range 0–10; malformed or out-of-range values keep 2.utils/batch_pipeline/provider_stt.py:_skips_vendor(inspected)is decided once in_prepareand carried on_Call.skip_vendor. The health arm, the intent'svendor_skipped,_call_syncand_call_asyncall use it. The skip reuses the existing local-silence path end to end:silence_payload, outcomesilence,audio_seconds=0, normal settle and merge. No new state, and no change to the merge, projection, custody or privacy fences.measured_vad_speech_seconds > 0next tovendor_skipped: true, so a short-speech skip stays distinguishable from true silence. The abandoned-intent reconcile already settlesvendor_skippedintents as silence without billing.omi_batch_pipeline_vendor_short_speech_skipped_audio_seconds_total{provider}measures the unbilled audio (frozen-name pin 18 → 19). It counts on the direct path and on the abandoned-intent silence reconcile.flag_budget.jsonand the rendered registry doc are updated.SPEECHfixtures widened from 0.5 s to 2.5 s so existing paid-path tests keep exercising the vendor.Not in scope
_prepare, so a unit held for allowance is deferred before the skip can apply. That ordering already applies to true silence and is unchanged here; moving VAD ahead of allowance is a separate design question.Review
Luna (gpt-6-luna, read-only) on the first commit: P1 conformance test still expected a vendor call for 1 s of speech (fixed: span widened); P2 reconcile path did not count skips (fixed, with a test); P1 allowance-before-VAD (pre-existing for silence, left as noted above).
Rollout
BATCH_VENDOR_MIN_SPEECH_SECONDS=0onbackend-integration(where the provider stage serves). Units already skipped keep their silence result.omi_batch_pipeline_vendor_short_speech_skipped_audio_seconds_totalshould be about 26% of billed provider audio;omi_batch_pipeline_vendor_attempt_audio_seconds_total{outcome="ok"}should fall by that share;Landing verification
The provider merge emulator fixture now uses 2.5 seconds of strict-VAD speech so it continues to exercise the paid vendor path under the new default. The nojob emulator's repeat-sweep assertion compares selected row identities because a new sweep recomputes ages against wall time; its minimum-age assertions remain. Main's additional flags are preserved in the ledger count.
Failure-Class: none
🤖 Generated with Claude Code