Repository navigation
test(voice): judge first audio by chunks released, not a wall-clock race (#16407) - #16420
Conversation
…ace (#16407) The streaming-vs-blocking comparison put an upper bound on wall time, which a loaded runner can exceed at any moment (streaming 1.238s vs blocking 0.522s on shard 8 of #16367). The fake worker releases a chunk only when the route pulls one, so the number released when the first audio byte leaves is 1 for a streaming route and CHUNK_COUNT for the #13215 buffering defect, on any machine. A contrast test pins the buffering case.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
|
Code review of
The nits (the bare |
Refs #16407 (AC2 delivered; AC1, the CI-history question, is still open, see the issue)
Thinking Path
test_streaming_synthesize_reaches_first_audio_far_soonerfailed on shard 8 of fix(ci): let the system-package retry recover from its own timeout, and fetch before unpacking (#15515) #16367: streaming time-to-first-audio was 1.238s, against 0.522s for blocking.streaming_ttfb < blocking_ttfb / 2, a limit on wall time on a shared runner. The blocking check is a lower bound on anasyncio.sleep, and a sleep never finishes early._PacedStreamReaderreleases a chunk only when the route pulls one. When the first audio byte leaves, a streaming route has pulled exactly 1 chunk. The perf(voice): 4.7-10.1s to first audio — the voice path uses blocking /tts/synthesize while the streaming route sits unused #13215 defect, buffering the whole utterance, has pulled allCHUNK_COUNT.What Changed
Only
autobot-backend/api/voice_latency_test.py:_PacedStreamReader.released._make_worker_http_clientkeeps each stream-route reader onclient.stream_readers, read through_stream_progress(http_client)._time_to_first_bytesamples an optionalprogresscallable on each ASGI send and returns its value at the first body byte.test_streaming_synthesize_reaches_first_audio_far_soonerbecomestest_streaming_synthesize_sends_first_audio_after_the_first_chunk. It assertsreleased == 1instead of the wall-clock ratio. The blocking lower bound (>= 0.8 × SYNTH_SECONDS) stays.test_a_route_that_buffers_the_utterance_is_caught. It patchesapi.voice._framed_audio_chunkswith a version that drains the stream before yielding, and assertsreleased == CHUNK_COUNT. This shows the new signal catches the defect it guards against.Verification
synthesize_streamcallsreadexactly(4), which releases frame 0, then reads the rest from the buffer and yields.StreamingResponsesends it with progress at 1.readexactlyends the stream before the first send, so progress is 5.Deliberately out of scope
.test_durationsstill keys the old test name.test-durations.ymlregenerates that file, and pytest-split tolerates stale keys.Model Used
Claude Opus 5 (
claude-opus-5).Single-issue rationale: a test-only fix to one voice-latency test; no other open issue shares this file or the voice test scope.