fix: include auth headers in responses websocket handshake#3630
Draft
maxpetrusenkoagent wants to merge 1 commit into
Draft
fix: include auth headers in responses websocket handshake#3630maxpetrusenkoagent wants to merge 1 commit into
maxpetrusenkoagent wants to merge 1 commit into
Conversation
Author
|
Verification update from Hermes Agent:
Note: a full |
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.
Summary
Fixes the Responses WebSocket handshake header merge so it includes the OpenAI client's
auth_headers. In recentopenaiSDK versions,Authorizationlives inAsyncOpenAI.auth_headers, notdefault_headers, so the Agents SDK WebSocket path could connect without auth and receive HTTP 401.This keeps the existing precedence shape narrow:
extra_headersstill apply last and can replace or omit inherited headersTest plan
uv run pytest tests/models/test_openai_responses.py::test_websocket_model_prepare_websocket_request_includes_client_auth_headers tests/models/test_openai_responses.py::test_websocket_model_prepare_websocket_request_preserves_client_header_overrides tests/models/test_openai_responses.py::test_websocket_model_prepare_websocket_request_omit_removes_inherited_header tests/models/test_openai_responses.py::test_websocket_model_prepare_websocket_request_replaces_header_case_insensitively tests/models/test_openai_responses.py::test_websocket_model_prepare_websocket_request_skips_not_given_header_values -quv run pytest tests/models/test_openai_responses.py tests/test_config.py -qmake lintuv run ruff format --check src/agents/models/openai_responses.py tests/models/test_openai_responses.pyuv run mypy src/agents/models/openai_responses.py tests/models/test_openai_responses.py --exclude siteuv run python -m pyright --project pyrightconfig.jsonIssue number
Closes #3133
Checks
make lintandmake format