Repository navigation
fix(anam): retry retryable HTTP status failures when starting a session - #7314
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Devin Review found 2 potential issues.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
APIConnectOptions.max_retry counts retries after the initial request, so the loop must run max_retry + 1 attempts. It ran max_retry, dropping one configured retry on every retryable failure and making max_retry=0 issue no request at all.
theomonnom
reviewed
Sep 17, 2026
| session = self._session or aiohttp.ClientSession() | ||
| try: | ||
| for attempt in range(self._conn_options.max_retry): | ||
| for attempt in range(self._conn_options.max_retry + 1): |
Member
There was a problem hiding this comment.
we already have the retry mechanism handled inside the base class of TTS
Member
Author
There was a problem hiding this comment.
hmm i don't think there is for anam avatar API?
theomonnom
approved these changes
Sep 17, 2026
This was referenced Sep 26, 2026
simli: start() crashes with UnboundLocalError when the second request fails, and never retries
#7497
Open
Open
sidxh
added a commit
to sidxh/agents
that referenced
this pull request
Sep 26, 2026
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
added a commit
to sidxh/agents
that referenced
this pull request
Sep 26, 2026
…provider's error Re-raise non-retryable APIStatusError immediately, retry 5xx and network errors max_retry times after the first attempt, and let the final error be the provider's status (or an APIConnectionError chained to the network error) instead of a generic "after all retries". Same shape as livekit#7314 for Anam.
sidxh
added a commit
to sidxh/agents
that referenced
this pull request
Sep 26, 2026
…provider's error Re-raise non-retryable APIStatusError immediately, retry 5xx and network errors max_retry times after the first attempt, and let the final error be the provider's status (or an APIConnectionError chained to the network error) instead of a generic "after all retries". Same shape as livekit#7314 for Anam.
sidxh
added a commit
to sidxh/agents
that referenced
this pull request
Sep 26, 2026
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.
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.
AnamAPI._postraisesAPIStatusErrorfor any non-OK response from/v1/engine/session, but its retry loop only caught(aiohttp.ClientError, asyncio.TimeoutError). TheAPIStatusErrorthereforeescaped on the first attempt, so
max_retry/retry_intervalwere deadconfig for every HTTP-status failure — a single transient 5xx from Anam killed
avatar startup with no retry.
This adds an
except APIStatusErrorarm that:retryableisFalse(4xx other than 408/429/499),retry_interval, and retries withinmax_retry,APIStatusErroronce retries are exhausted, so the caller keepsstatus_code/bodyinstead of a wrappedAPIConnectionError.The transport arm is unchanged:
aiohttp.ClientErrorand timeouts still end inAPIConnectionErroras before.This matches the sibling avatar plugins (
protoface,avatario,liveavatar,lemonslice,keyframe,runway), which all consultAPIStatusError.retryable.