Repository navigation
Python: Isolate OpenAI metadata defaults from Azure routes - #8969
Eduard van Valkenburg (eavanvalkenburg) merged 5 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is focused, compatibility-tested, and no blocking correctness issues were found.
Review effort: Balanced
Findings: None
What changed in this PR
Isolates Azure OpenAI requests from ambient OpenAI metadata while preserving explicit headers and existing OpenAI behavior.
Changes:
- Omits OpenAI organization/project headers from Azure routes.
- Suppresses SDK-generated bearer authorization for native Azure API-key requests.
- Adds regression coverage across authentication and routing scenarios.
| File | Description |
|---|---|
python/packages/openai/agent_framework_openai/_shared.py |
Normalizes and suppresses Azure-route headers. |
python/packages/openai/tests/openai/test_openai_shared.py |
Tests metadata and authentication behavior. |
python/packages/openai/tests/openai/conftest.py |
Isolates project-ID environment state in tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Python Python / code-coverage/pythonThe overall line coverage in commit 21f5a61 in the Show a line coverage summary of the most covered files.
Updated |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 28006a1d259a
Model: gpt-5.6-sol
Overview
The PR isolates framework-created Azure clients from ambient OpenAI organization and project metadata while preserving explicit headers, token authentication, /openai/v1 bridge behavior, generic OpenAI routing, and preconfigured clients. Case-insensitive normalization, route-specific suppression, and focused request-building tests provide concrete guardrails. No publishable Critical, High, or Medium issue was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation & Context
Framework-created Azure OpenAI clients can inherit OpenAI-specific organization and project defaults from the OpenAI SDK when
OPENAI_ORG_IDorOPENAI_PROJECT_IDare present in the process environment. Azure-routed clients should use Azure configuration without implicitly forwarding those OpenAI metadata values.This change also keeps Azure API-key authentication isolated from the base client's bearer header behavior across supported OpenAI SDK versions.
Description & Review Guide
/openai/v1bridge, explicit headers, generic OpenAI environment fallback, and preconfigured clients.api-keyheader across supported OpenAI SDK versions. Generic OpenAI clients, explicit caller headers, token credentials, and preconfigured client instances retain their existing behavior./openai/v1compatibility bridge.Related Issue
No public issue is associated with this change.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.