Drop out-of-span chunk speech metadata instead of aborting the run - #301
Merged
0xShug0 merged 1 commit intoAug 24, 2026
Merged
Conversation
`append_chunk_speech_metadata`'s `merge_span` throws when a speech segment or speaker turn lands outside the chunk span, which aborts the whole run. The sibling `append_chunk_word_timestamps` path computes the identical guard and, since 0xShug0#252, warns and drops the offending entry instead. This applies the same decision to the metadata path so both merge paths behave consistently. `merge_span` already returns `std::optional<TimeSpan>`, and both call sites already `continue` on `std::nullopt`, so the throw becomes a warning plus `return std::nullopt` with no signature or call-site change. The warning carries the same diagnostic fields as the word path. Adds `test_chunk_speech_metadata_merge_drops_outside_spans`, mirroring 0xShug0#252's `test_chunk_word_timestamp_merge_drops_outside_words`. The out-of-span behaviour on this path previously had no test coverage.
Owner
|
Thanks @bjhengen! PR merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while investigating #249.
src/framework/audio/chunking.cpphas two sibling merge paths that compute the identical out-of-span guard and then disagree about what it means:append_chunk_word_timestampscontinue(since #252)qwen3_asrforced alignerappend_chunk_speech_metadata→merge_spanthrow, aborting the whole runvibevoice_asr#252 chose warn-and-drop for the word path. This PR applies that same decision to the metadata path, which still aborts. It is not proposing a new policy — it is finishing the one already merged.
merge_spancovers bothspeech_segmentsandspeaker_turns, so either can abort a run.The change
merge_spanalready returnsstd::optional<TimeSpan>, and both call sites alreadycontinueonstd::nullopt. So the throw becomes a warning plusreturn std::nullopt— the "not applicable" signal the function was already built around. No signature change, no call-site change. The warning carries the same diagnostic fields the word path emits (local_start,local_end,source_samples, the source/keep spans, both sample rates).Test
Adds
test_chunk_speech_metadata_merge_drops_outside_spans, mirroring #252'stest_chunk_word_timestamp_merge_drops_outside_words: one kept span and one outside span for bothspeech_segmentsandspeaker_turns, asserting the outside ones are dropped and the valid ones survive with correct global spans.Only
test_chunk_speech_metadata_merge_rescales_chunk_domainexisted before, so the out-of-span behaviour on this path had no coverage at all.Scope: which routes were checked
Shared framework code, so to be explicit about blast radius:
vibevoice_asrchunked path (speech_segmentsandspeaker_turns). Behaviour change: a run that previously aborted now completes, with the out-of-span entry dropped and a warning logged.qwen3_asrword-timestamp path — untouched; it has behaved this way since Avoid aborting ASR word merge on out-of-span timestamps #252.append_chunk_speech_metadatacallsappend_chunk_word_timestampsat the end, so today a vibevoice user gets the lenient behaviour for words and the fatal one for segments within the same call.Verification
Verified on this PR's base,
main@288a271, CPU-only:cmake -S . -B build-cpu -DENGINE_ENABLE_CUDA=OFF -DENGINE_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release cmake --build build-cpu --target audio_chunking_test -j8 ./build-cpu/bin/audio_chunking_testchunking.cppaudio_chunking_test failed: Audio chunker speech metadata merge received a speech segment outside the chunk span(exit 1)audio_chunking_test passed(exit 0)So it is a real regression test: it fails without the change and passes with it, on the exact commit this PR targets.
Earlier I ran the same pair at
release-0.6.1in both configurations — CPU-only and CUDA (-DENGINE_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120, sm_120 / RTX 5090) — with identical results. I did not repeat the CUDA build onmain;src/framework/audio/chunking.cppis byte-identical betweenrelease-0.6.1and288a271(unchanged since #252), and this path has no backend-dependent code.Known limitation, stated plainly
Reachability of the metadata case is unproven. I have not observed an out-of-span segment or turn in the wild — my own trigger (#249) is on the word path. The argument for this change is the inconsistency itself: the same guard on the same arithmetic in the same file should not abort in one place and drop in the other.
The supporting evidence that it is not theoretical:
local_start=272640vssource_samples=272000, 40 ms past the end of the chunk's audio).vibevoice_asrchunked-timestamp handling already has a third-party report against it: VibeVoice-ASR: chunked (VAD/fixed) timestamps are in the input sample rate, not the 24 kHz single-pass domain — inconsistent #167.If you would rather see a reproduction on the metadata path before changing behaviour there, that is a fair ask and I am happy to keep digging instead.