Repository navigation
feat(tts): pass fetchOptions through engines.openai() to lift the 300 s limit - #61
Merged
Merged
Conversation
With openai >= 5 the SDK uses Node's built-in fetch, whose 300 s headersTimeout fails requests to slow self-hosted servers regardless of timeoutMs. fetchOptions is merged into every fetch call, so an undici Agent with a larger headersTimeout lifts the limit. No new dependency. Fixes #59 Claude-Session: https://claude.ai/code/session_01A5noi8MogUjD2mdirpzXmY
4 of 5 tasks
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.
Fixes #59, using option 1 from the issue:
engines.openai()gains afetchOptionsoption that is passed straight to the OpenAI SDK.Why
From
openaiv5 the SDK uses Node's built-infetch(undici), whose defaultheadersTimeoutis 300 s. That limit is enforced by the connection pool, independently of the SDK's owntimeout, sotimeoutMsalone can't lift it. The SDK mergesfetchOptionsinto everyfetchcall, and undici reads adispatcherfrom it, so a user-suppliedAgentreplaces the default pool:Argo gains no dependency: users who need long waits install
undicithemselves. Onopenai4 the option is ignored, which is fine since v4 has no such limit.Verification
tests/tts/openai.test.ts: new test assertingfetchOptionsreaches the client. All 223 tests intests/ttspass;tsc --noEmitis clean.openai6.49.0,undici7.30.1, Node 20), against a stub server that delays response headers, with the same client options the engine builds:fetchOptionsheadersTimeout: 1000APIConnectionTimeoutErrorafter 1.5 s (proves the dispatcher is used)headersTimeout: 0APIConnectionTimeoutErrorafter 301.6 sheadersTimeout: 0README and
skills/argo-guide/references/tts-engines.mdnow show the workaround next to the documented limit.Thanks to @lordrip for the detailed reproduction in #59, which this follows exactly.
https://claude.ai/code/session_01A5noi8MogUjD2mdirpzXmY