Fix voice agent WebSocket configuration - #50532
Mike Guo (guotuofeng) wants to merge 7 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 35 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Three moderate issues remain regarding proxy matching, cleanup safety, and retry-setting test coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Fixes voice-agent WebSocket configuration, session behavior, proxy handling, and telephony test cleanup.
Changes:
- Reuses supported builder configuration and rejects unsupported settings.
- Narrows session options and enforces single synchronous iteration.
- Updates proxy behavior, tests, documentation, and changelog.
| File | Summary |
|---|---|
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/voice/VoiceAgentWebSocketSessionTests.java |
Updates handshake and iterator tests. |
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/voice/VoiceAgentTelephonyLiveTests.java |
Adds binding cleanup tracking. Moderate issue: cleanup can fail when bindings are already absent. |
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/FoundryFeaturesHeaderVerificationTest.java |
Tests unsupported builder settings. |
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/BetaVoiceAgentWebSocketSessionClientTests.java |
Tests proxy bypass behavior. |
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/VoiceAgentWebSocketConnectionOptions.java |
Narrows options to session behavior. |
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/realtime/VoiceAgentWebSocketUtils.java |
Applies SDK-managed WebSocket settings. |
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaVoiceAgentWebSocketSessionClient.java |
Enforces iteration and proxy behavior. Moderate issue: proxy bypass matching is case-sensitive. |
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaVoiceAgentWebSocketSessionAsyncClient.java |
Uses the fixed token scope. |
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClientBuilder.java |
Validates WebSocket builder configuration. Moderate issue: retry option and policy coverage is missing for sync and async clients. |
sdk/ai/azure-ai-agents/README.md |
Documents the revised configuration model. |
sdk/ai/azure-ai-agents/CHANGELOG.md |
Records the behavioral changes. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Above is Jose's comment from the earlier PR. The unsupported settings are now documented/rejected but the parallel builder path concern remains |
createHttpPipeline is emitted by the TypeSpec Java generator and may change when the SDK is regenerated or the emitter is upgraded. Customizing its local variables would tightly couple this library to the generator’s current implementation details and could create regeneration failures or maintenance overhead. The separate WebSocket path is justified because Azure Core’s HttpClient and HttpPipeline abstractions do not expose WebSocket upgrade functionality. The synchronous and asynchronous WebSocket clients therefore require native OkHttp and Reactor Netty transports. The current implementation handles this limitation explicitly: Compatible settings such as endpoint, credential, service version, client headers, User-Agent, and proxy configuration are propagated. the source code of emitter used to generate the createHttpPipeline is |
|
Thanks for following through on the earlier feedback. Removing the public protocol/transport overrides and adding the guard against a second iterator both address the issues raised. I have two follow-ups before considering the remaining concerns closed. Test resource naming and recording modes Please replace the The replacement should respect our test modes, not simply switch to an untracked These two methods are currently gated on Shared builder configuration Rejecting unsupported settings addresses the silent-ignore bug, but does not by itself settle the shared-configuration concern. I agree that Azure Core's HTTP transport does not expose a WebSocket session API, and I am not requesting a cloned HTTP pipeline or AST patches to generated local variables. The adapter already uses |
|
Addressed the latest review follow-ups in dc79786:
Validation: 66 focused tests passed; checkstyle reports 0 violations. |

Description
Addresses follow-up feedback from #50408 and #50519 for the voice-agent WebSocket clients:
AgentsClientBuilderconfiguration and rejects unsupported HTTP pipeline settings instead of silently ignoring themVoiceAgentWebSocketConnectionOptionsto session-specific behaviorTesting