Skip to content

[Evaluation] Fix OpenAI 2.54 test proxy compatibility - #48862

Open
Sydney Lister (slister1001) wants to merge 2 commits into
Azure:mainfrom
slister1001:fix/evaluation-openai-httpx2-test-proxy
Open

[Evaluation] Fix OpenAI 2.54 test proxy compatibility#48862
Sydney Lister (slister1001) wants to merge 2 commits into
Azure:mainfrom
slister1001:fix/evaluation-openai-httpx2-test-proxy

Conversation

@slister1001

Copy link
Copy Markdown
Member

Summary

Fix the azure-ai-evaluation test-proxy adapter for OpenAI clients that send httpx2 request objects. This unblocks the latestdependency release check after OpenAI 2.54.0 began exercising the newer transport.

Root cause

tests/__openai_patcher.py always constructed proxy URLs with httpx.URL. OpenAI 2.54.0 can pass an httpx2.URL, and joining URL instances from different implementations raises:

TypeError: Invalid type for url. Expected str or httpx.URL, got <class 'httpx2.URL'>

After routing succeeds, the newer transport also advertises zstd in Accept-Encoding; that transport-only header should not participate in recording matching.

Changes

  • derive the proxy URL class from each request's concrete URL type
  • exclude Accept-Encoding from test-proxy recording matching
  • remove the temporary openai<3.0 test pin
  • add regression coverage for both httpx and httpx2 URL routing

Validation

  • OpenAI 2.54.0: all 30 nodes that failed in release build 6779696 pass
  • OpenAI 2.43.0: representative sync/async playback tests and both proxy unit tests pass
  • Black 24.4.0: 408 files unchanged
  • git diff --check: passed

This is test infrastructure only and does not change the published package runtime API.

Build proxy URLs with the request's concrete URL type, ignore transport-specific Accept-Encoding values in recordings, and remove the temporary OpenAI test pin now that both httpx generations are supported.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the Evaluation Issues related to the client library for Azure AI Evaluation label Sep 2, 2026
@slister1001
Sydney Lister (slister1001) requested a review from a team September 2, 2026 19:59
Patch the evaluation test-proxy wrapper directly so user-agent assertions observe requests from both httpx and httpx2 OpenAI clients.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@slister1001

Copy link
Copy Markdown
Member Author

Follow-up after public CI build 6780194: the standard matrix resolved OpenAI 3.3.1 + httpx2 and exposed seven user-agent assertions that mocked httpx.AsyncClient.send directly. Commit 164d36d8ae now mocks TestProxyAsyncHttpxClient.send instead, making the assertions transport-agnostic. Local playback results: 7/7 pass on OpenAI 2.43.0, 7/7 on 2.54.0, and 7/7 on 3.3.1; the two dedicated proxy tests also pass on 3.3.1.

@slister1001
Sydney Lister (slister1001) marked this pull request as ready for review September 2, 2026 21:18
Copilot AI balanced review requested due to automatic review settings September 2, 2026 21:18
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI 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.

🟢 Approval recommended

The compatibility fix is covered by regression tests, with no unresolved issues.

Pull request overview

Updates evaluation test infrastructure for compatibility with OpenAI clients using httpx2, without changing runtime APIs.

Changes:

  • Preserves each request’s URL implementation during proxy routing.
  • Excludes Accept-Encoding from recording matching.
  • Removes the OpenAI version cap and adds regression coverage.
File summaries
File Description
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_openai_patcher.py Tests httpx and httpx2 routing.
sdk/evaluation/azure-ai-evaluation/tests/e2etests/test_evaluate.py Mocks the proxy-aware async client.
sdk/evaluation/azure-ai-evaluation/tests/e2etests/test_builtin_evaluators.py Updates evaluator user-agent mocking.
sdk/evaluation/azure-ai-evaluation/tests/conftest.py Excludes Accept-Encoding from recording matching.
sdk/evaluation/azure-ai-evaluation/tests/__openai_patcher.py Supports proxy routing for both URL implementations.
sdk/evaluation/azure-ai-evaluation/dev_requirements.txt Removes the temporary OpenAI version cap.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@slister1001

Copy link
Copy Markdown
Member Author

kdestin Ankit Singhal (@singankit) This test-only fix is now the release blocker for azure-ai-evaluation 1.18.5. PR CI build 6780484 is fully green (19/19 checks), and the exact 30 failures from release build 6779696 pass locally under OpenAI 2.54.0; the seven additional OpenAI 3.3.1/httpx2 CI assertions also pass across 2.43/2.54/3.3. Could one of you review and merge #48862 so we can rerun the release pipeline?

from tests.__openai_patcher import TestProxyAsyncHttpxClient

with self._transparent_mock_method(AsyncClient, "send") as mock: # OpenAI requests sent with httpx
with self._transparent_mock_method(TestProxyAsyncHttpxClient, "send") as mock:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a blocking comment.

When originally written, __openai_patcher would for openai to instantiate TestProxyAsyncHttpxClient automatically as an import side effect.

Did the migration to httpx2 break this behavior?

from tests.__openai_patcher import TestProxyAsyncHttpxClient

with self._transparent_mock_method(AsyncClient, "send") as mock:
with self._transparent_mock_method(TestProxyAsyncHttpxClient, "send") as mock:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as above

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unclear what the value add is here, adding test code for test code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Evaluation Issues related to the client library for Azure AI Evaluation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants