Bug Description
simli.AvatarSession.start() makes two POSTs (/compose/token, then /integrations/livekit/agents) with no retry, and its second error handler can crash.
The second except in livekit-plugins-simli/livekit/plugins/simli/avatar.py formats avatarConnectionRequest.status into the log message. If the request raises before a response exists (connection dropped), or json.loads(body)["session_token"] fails because the token response has no session_token, that name was never assigned and the handler itself raises UnboundLocalError, so start() crashes instead of logging and returning like the first block does. The same message interpolates body, which at that point is the token response, so a failure there can write the Simli session token to the logs.
A single transient 5xx on either request also ends the avatar for the session, since nothing is retried.
Expected Behavior
Both requests retry 5xx and network errors like the other avatar plugins (Anam after #7314). A failure is logged with its status and provider error and start() returns without replacing the audio output, as it does today for the first request.
Reproduction Steps
Point simli.AvatarSession(api_url=...) at a local server whose /compose/token returns 200 with {}, or returns a token and then drops the connection on the second request. On main both raise UnboundLocalError: cannot access local variable 'avatarConnectionRequest'. A server that returns 503 once on the token endpoint fails the avatar immediately.
Versions
livekit-agents 1.8.3, livekit-plugins-simli at main (57b3227), Python 3.13, macOS.
Bug Description
simli.AvatarSession.start()makes two POSTs (/compose/token, then/integrations/livekit/agents) with no retry, and its second error handler can crash.The second
exceptinlivekit-plugins-simli/livekit/plugins/simli/avatar.pyformatsavatarConnectionRequest.statusinto the log message. If the request raises before a response exists (connection dropped), orjson.loads(body)["session_token"]fails because the token response has nosession_token, that name was never assigned and the handler itself raisesUnboundLocalError, sostart()crashes instead of logging and returning like the first block does. The same message interpolatesbody, which at that point is the token response, so a failure there can write the Simli session token to the logs.A single transient 5xx on either request also ends the avatar for the session, since nothing is retried.
Expected Behavior
Both requests retry 5xx and network errors like the other avatar plugins (Anam after #7314). A failure is logged with its status and provider error and
start()returns without replacing the audio output, as it does today for the first request.Reproduction Steps
Point
simli.AvatarSession(api_url=...)at a local server whose/compose/tokenreturns 200 with{}, or returns a token and then drops the connection on the second request. Onmainboth raiseUnboundLocalError: cannot access local variable 'avatarConnectionRequest'. A server that returns 503 once on the token endpoint fails the avatar immediately.Versions
livekit-agents 1.8.3, livekit-plugins-simli at
main(57b3227), Python 3.13, macOS.