Skip to content

fix(waves): close streaming socket when initial send fails - #151

Draft
Kayvan-Zahiri wants to merge 1 commit into
smallest-inc:mainfrom
Kayvan-Zahiri:codex/close-socket-on-initial-send-error
Draft

Kayvan-Zahiri wants to merge 1 commit into
smallest-inc:mainfrom
Kayvan-Zahiri:codex/close-socket-on-initial-send-error

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

When the first ws.send() in WavesStreamingTTS.synthesize() raises after connecting, it runs outside the existing try/finally. The socket remains open and the client retains its connected state.

Move payload creation and the initial send into that existing cleanup block. Preserve the original exception and close the socket on this path, as the method already does for later streaming errors. The source and custom tests are already protected by .fernignore.

Two regression cases exercise synthesize() through its public generator with a fake WebSocket transport, raising ConnectionResetError and RuntimeError from the initial send. Both fail before the change and pass afterward; they verify the same exception propagates, the socket closes once, and connection state clears.

Validation: 266 offline custom tests passed, one skipped and three integration tests deselected (22 warnings); full Ruff lint, formatting (1,156 files), and mypy (1,101 source files) passed. No live API or real audio device was used. Tests use --noconftest to avoid the global Docker/WireMock fixture, with telemetry disabled and API credentials empty. Developed with AI assistance and verified locally.

Wheel and sdist builds passed. The static verification harness reports the existing analytics wire-coverage gap (9 tests for 18 methods), also reproduced on the original source; its live layers were skipped without credentials.

@crim-app

crim-app Bot commented Oct 19, 2026

Copy link
Copy Markdown

crim doesn't review pull requests automatically here.

Comment crim review on this pull request whenever you want a review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant