Repository navigation
Conversation
sidxh
force-pushed
the
fix/simli-start-retry
branch
from
September 26, 2026 19:19
f8df0d9 to
e1c8dc4
Compare
Send both session-start requests through a retry helper with the same shape as livekit#7314 for Anam (4xx fails fast, 5xx and network errors retry), add a conn_options argument, and log failures by status and provider error. The old second handler referenced the response even when the request raised, so a dropped connection or a token response without session_token ended in UnboundLocalError, and on error it could log the Simli session token.
sidxh
force-pushed
the
fix/simli-start-retry
branch
from
September 26, 2026 19:27
e1c8dc4 to
ec3f152
Compare
This branch has not been deployed
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.
simli.AvatarSession.start()makes two POSTs with no retry, and its second error handler referencesavatarConnectionRequesteven when the request raised before a response existed. A dropped connection on that request, or a token response withoutsession_token, ends inUnboundLocalErrorinstead of the log-and-return the first block does. The same handler interpolatesbody, which is the token response at that point, so it can log the Simli session token. And one transient 5xx on either request ends the avatar for the session.Both requests now go through
_post_with_retry, with the same shape #7314 gave Anam: a non-retryableAPIStatusErroris raised immediately, 5xx and network errors are retriedmax_retrytimes after the first attempt, and the final error is the provider's status or anAPIConnectionErrorchained to the network error.start()catches those per request, logs the status and provider error (never the request or the token body), and returns without replacing the audio output, which keeps the existing behaviour when the avatar can't start.AvatarSessiongains aconn_optionsargument defaulting toDEFAULT_API_CONNECT_OPTIONS, like Bey and Tavus; its timeout bounds the connect, and the session's total limit (300s by default) still bounds each request. The"... in dir()"checks are gone.Against a local server with default connect options, on
main: a token response withoutsession_tokenand a dropped second request both raiseUnboundLocalError; a 503 once on the token endpoint fails the avatar in 0.00s. With this change those two cases log and return, 503, 503, 200 starts the avatar after 4.01s, and a 401 still fails on the first attempt. Five tests added in a newtests/test_plugin_simli.py, including one for the crash and one for the timeout; all fail onmain.Closes #7497.