feat(voice): in a game, partial transcription waits while an answer is written
- the app's ready message says whether the game stage runs (llm ready game=true); the worker then holds partial passes while a reply is being written and runs them again, the newest audio per speaker, when no answer is; finals never wait; without a game nothing changes - M0 gamemode_tune decision: the game placement answered 1.7 times faster with partials held (64.9 against 37.5 tok/s with a partial pass every 2 s) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -251,3 +251,32 @@ def test_partial_batches_are_kept_small_so_finals_can_cut_in():
|
||||
|
||||
run(body)
|
||||
assert t.calls == [[10, 11], [99], [12, 13], [14]]
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_held_partials_wait_while_finals_still_go_and_run_once_released():
|
||||
"""voice_worker.spec.md, "Scheduling": in a game, partial passes wait while an answer is being
|
||||
written; finals never wait."""
|
||||
t = FakeTranscriber()
|
||||
held = {"on": True}
|
||||
|
||||
async def body():
|
||||
s = SttScheduler(t, partials_held=lambda: held["on"])
|
||||
s.start()
|
||||
got = []
|
||||
s.submit_partial("a", clip(10), PARTIAL, lambda r: got.append(("partial", r.text)))
|
||||
s.submit_final("b", clip(20), FINAL, lambda r: got.append(("final", r.text)))
|
||||
await asyncio.sleep(0.2)
|
||||
before = list(got)
|
||||
held["on"] = False
|
||||
s.wake()
|
||||
for _ in range(100):
|
||||
if len(got) == 2:
|
||||
break
|
||||
await asyncio.sleep(0.01)
|
||||
await s.stop()
|
||||
return before, got
|
||||
|
||||
before, got = run(body)
|
||||
assert before == [("final", "n20")], "the final went; the partial waited"
|
||||
assert got == [("final", "n20"), ("partial", "n10")]
|
||||
|
||||
Reference in New Issue
Block a user