fix: preserve in-flight Whisper transcripts after stop
What changed and why
Fixes #12964. If stop() is called while a full Whisper batch is still being transcribed, its result is currently discarded even though a buffered tail is delivered. Deliver results for all accepted audio in input order even when runners finish out of order, continue ignoring audio appended after stopping, and document that completion callbacks can occur after stop() returns.
This is an AI-assisted contribution. The optional US$10 bounty proposed in the issue has not been approved; this PR does not claim an existing reward.
Product invariants affected
none
How it was verified
bun test sdks/device/typescript: 15 tests passed, 33 assertions across 3 files. The two stop regressions failed before the original fix; the additional reversed-completion regression failed before the ordering fix. All pass now.- TypeScript source type-check with
tsc -p sdks/device/typescriptand isolated Node type definitions: passed. - Exercised the exported production transcriber with a controllable asynchronous runner, including repeated stops and audio arriving after stop. No live Whisper model or BLE hardware was exercised.
make setup: completed with locked backend development dependencies.- Shared manifest checks for the changed files and
git diff --check: passed.
Tests
sdks/device/typescript/src/stt/index.test.ts adds regressions for an in-flight full batch at stop and for a full batch plus a buffered tail. The existing tail-flush test remains unchanged. The SDK suite is registered in the existing shared local/CI check manifest.
Failure class (fixes)
Failure-Class: none
The failed boundary is acceptance versus completion of SDK audio: stopping closes input but should preserve completion of already accepted work, consistent with the existing tail-flush behavior. The existing proactive-evaluation and voice-owner failure classes have narrower subsystem contracts.
New guards
The manifest runs the existing SDK suite, including deterministic behavioral regressions for the reproduced incident in #12964. This is component lifecycle coverage through the production runner seam; it does not introduce a new shared runtime primitive.