fix(voice): honor client config for streamed STT - #4532
fix(voice): honor client config for streamed STT#4532sylvesterkaczmarek wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d40f222a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Note You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
Note You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b6b1a35db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
seratch
left a comment
There was a problem hiding this comment.
Thanks for the contribution. The underlying issue is valid: streamed STT currently bypasses the supplied AsyncOpenAI client's endpoint, query, and header configuration.
Before merging, please update the existing STT connection test doubles with the URL, query, auth-header, and default-header attributes now read by this path; those tests currently fail before reaching the mocked connection. Please also incorporate the callable-key refresh and regression coverage from #4537 before materializing auth headers.
Finally, keep the client-derived WebSocket URL, query, header, and credential normalization in a shared internal helper used by both Responses WebSocket and streamed STT, while leaving each transport's endpoint suffix and fixed parameters at its call site.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcc8d57066
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def _is_openai_omitted_value(value: Any) -> bool: | ||
| return isinstance(value, Omit | NotGiven) |
There was a problem hiding this comment.
Reuse one WebSocket normalization path
This new module duplicates the omission detection, credential refresh, header merge, and base/query normalization already implemented in openai_responses.py, while the Responses transport continues using its private copies. Consequently, fixes to these client semantics can land in only one transport—the preceding revisions already needed several corrections in this exact area. Route both WebSocket transports through this helper, or adapt STT to the existing normalization, so there is one source of truth.
AGENTS.md reference: AGENTS.md:L93-L93
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 101108b502
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for key, value in source.items(): | ||
| if _is_openai_omitted_value(value): | ||
| continue |
There was a problem hiding this comment.
Remove inherited headers when defaults use Omit
When an AsyncOpenAI client uses default_headers={"Authorization": omit}—for example, to prevent an OpenAI key from being forwarded to a custom WebSocket proxy—the auth source has already inserted Authorization, and this branch merely skips the later sentinel instead of removing that inherited header. Although the sentinel is no longer stringified, the handshake still sends the credential despite the explicit omission; handle Omit in this layered source case by deleting any case-insensitive existing header, as the extra_headers path already does.
Useful? React with 👍 / 👎.
|
Addressed. I moved the callable-key refresh/regression from #4537 into this PR, updated the existing STT connection doubles with the client routing/query/header attributes, and centralized the OpenAI-client WebSocket URL/query/header/credential normalization so Responses WebSocket and streamed STT share the same helper while keeping their endpoint-specific suffixes and fixed parameters at the call sites. |
Summary
Make streamed OpenAI STT honor the supplied
AsyncOpenAIclient's endpoint, query, headers, and dynamic credentials instead of bypassing client configuration.OpenAISTTTranscriptionSessionpreviously connected directly to:and constructed its authorization header directly from
client.api_key. That bypassed client routing/query/header configuration and could also materialize an empty or stale credential when the client uses a callable API-key provider.Fix
client.default_querywith the sameOmit/NotGivensemantics as Responses WebSocketintent=transcriptionandOpenAI-Log-Session: 1as STT-specific call-site valuesTest plan
Coverage verifies:
base_urlandwebsocket_base_urlRisk
Low. With the default OpenAI client configuration, streamed STT still connects to
wss://api.openai.com/v1/realtime?intent=transcription. Behavior changes only for configured routing, headers, query parameters, or dynamic credentials.Issue number
None. Found while auditing parity between streamed and non-streamed STT client configuration.