Skip to content

fix(hume): don't retry 4xx errors such as an invalid API key - #8148

Open
omChauhanDev wants to merge 1 commit into
livekit:mainfrom
omChauhanDev:fix/hume-tts-4xx-retry
Open

omChauhanDev wants to merge 1 commit into
livekit:mainfrom
omChauhanDev:fix/hume-tts-4xx-retry

Conversation

@omChauhanDev

Copy link
Copy Markdown
Contributor

Problem

ChunkedStream._run turns every failure except a timeout into a retryable APIConnectionError. That includes the ClientResponseError from raise_for_status(), so when Hume rejects a request (401 for a bad API key, 400 or 422 for a request it can't process) the status is dropped and the framework sends the same request three more times. With the default connect options that's four requests and about 4 s of retries per sentence, all logged as connection errors, and the caller gets APIConnectionError('Connection error.'), marked retryable, with no status code. Hume's own in-stream error line ("type": "error") is wrapped the same way, so its message only shows up in __cause__.

Changes

_run now checks resp.status inside the async with. If the APIStatusError built by create_api_error_from_http isn't retryable, it's raised as is, so a 401 fails after one request with status_code=401. Retryable statuses (408, 429, 499, 5xx) still go through raise_for_status() and are retried as before. APIErrors raised by the plugin itself, including the in-stream error, are re-raised instead of being wrapped as connection errors.

@omChauhanDev
omChauhanDev requested a review from a team as a code owner October 26, 2026 23:38

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin 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