test(inference): pin pooled TTS socket reuse across a drained session - #2153
Closed
toubatbrian wants to merge 1 commit into
Closed
test(inference): pin pooled TTS socket reuse across a drained session#2153toubatbrian wants to merge 1 commit into
toubatbrian wants to merge 1 commit into
Conversation
|
toubatbrian
force-pushed
the
brian/fix-tts-pool-reuse-regression
branch
from
July 28, 2026 23:57
cb8fa52 to
c9af8c7
Compare
Recycling the gateway socket now depends on two rules meeting: a run ends on a quiet timeout rather than on the `done`, and the socket is only returned once that end is reached. Nothing pinned which exit sets that, so the pool would either reuse on every reply or on none with no test telling the two apart. Counts gateway handshakes instead: a conversation of clean multi-generation replies has to dial once, and a session dropped mid-synthesis has to dial again. Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
force-pushed
the
brian/fix-tts-pool-reuse-regression
branch
from
July 29, 2026 01:16
c9af8c7 to
9fb85dd
Compare
Contributor
Author
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.
Stacked on #2146.
Problem
#2146 made a run end on a quiet timeout rather than on the
done, and #2144 gates returning the socket toConnectionPoolon having reached that end. Those two rules meet in one place, so the pool either reuses its socket on every reply or on none — and nothing pinned which. A suspected collapse to a fresh gateway handshake per reply (~157ms on the voice path) was indistinguishable from correct behaviour by reading the code.Fix
Test only, no behaviour change. Counts gateway handshakes over a conversation instead of asserting on audio alone.
Testing
On this branch: 5 clean multi-generation replies dial once; a session dropped mid-synthesis dials twice, so the eviction that fixes the misattribution bug is unaffected. Deleting
sessionDrained = truefrom the quiet-timeout exit turns the first case into 5 dials for 5 replies, so the test fails closed on exactly the regression it is meant to catch.Cross-checked against the production gateway rather than only the fake one:
inworld/inworld-tts-2answers onesession.flushwith 3doneevents and then goes quiet with no trailing event, and over 5 replies bothmainand this branch dial once — reuse is intact on the stack, not near-zero.Stacked PRs get no CI, so run locally:
pnpm build,pnpm test agents(115 files, 1508 passed),pnpm format:check,pnpm lintall pass.Made with Cursor