Skip to content

Refactor voice agent telephony API tests to remove beta references - #49898

Open
Howie Leung (howieleung) wants to merge 5 commits into
feature/azure-ai-projects/vnextfrom
howie/re-emit5
Open

Howie Leung (howieleung) wants to merge 5 commits into
feature/azure-ai-projects/vnextfrom
howie/re-emit5

Conversation

@howieleung

Copy link
Copy Markdown
Member
  • Updated test files to use the stable project_client.voice_agents.telephony.* methods instead of the deprecated project_client.beta.voice_agents.telephony.*.
  • Adjusted assertions and method calls across various test cases for telephony bindings, transfer targets, and call jobs.
  • Removed unnecessary beta flags and ensured that the Foundry-Features header is correctly handled in both synchronous and asynchronous tests.
  • Updated sample tests to reflect the new API structure and ensure proper cleanup of resources.
  • Modified the tsp-location.yaml to point to the latest commit in the Azure REST API specs repository.

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

- Updated test files to use the stable `project_client.voice_agents.telephony.*` methods instead of the deprecated `project_client.beta.voice_agents.telephony.*`.
- Adjusted assertions and method calls across various test cases for telephony bindings, transfer targets, and call jobs.
- Removed unnecessary beta flags and ensured that the Foundry-Features header is correctly handled in both synchronous and asynchronous tests.
- Updated sample tests to reflect the new API structure and ensure proper cleanup of resources.
- Modified the tsp-location.yaml to point to the latest commit in the Azure REST API specs repository.
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

Add sdk-api-review-ready when this working PR is ready for API review of azure-ai-projects. The review will compare target version 2.11.0 from this working PR against baseline version 2.10.0 (tag azure-ai-projects_2.10.0). If you need a different comparison, use the Azure SDK CLI (azsdk apireview create).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 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

This comment has been minimized.

- Updated the README and API documentation to reflect the change from `campaigns` to `telephony` in the voice agents operations.
- Refactored the `BetaVoiceAgentsCampaignsOperations` class to `BetaVoiceAgentsTelephonyOperations` and adjusted all related methods and requests accordingly.
- Modified the client initialization to replace references to campaigns with telephony.
- Updated tests to ensure proper wiring and functionality of the new telephony operations.
- Adjusted foundry features header tests to include the new telephony subclient.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

What failed

Build 7055062 ("python - pullrequest") failed across all 6 test matrix jobs (Ubuntu2404_313/314, macos311, ubuntu2404_311(+coverage), windows2022_312) plus the Build Analyze job, with three distinct, PR-introduced root causes:

1. AttributeError: 'types.SimpleNamespace' object has no attribute 'allow_preview' (macos311, Ubuntu2404_313/314, ubuntu2404_311, windows2022_312 — ~27 parametrized cases in test_realtime_transport.py)

This PR adds VoiceAgentsOperations.__init__ (azure/ai/projects/operations/_patch.py) which unconditionally reads self._config.allow_preview:

if self._config.allow_preview:
    setattr(self, "telephony", _OperationMethodHeaderProxy(...))

BetaRealtime.connect() (_realtime.py / aio/_realtime.py) was also changed to always pass allow_preview=bool(self._config.allow_preview) into the connection manager. The existing test fixture _make_realtime() in tests/agents/test_realtime_transport.py constructs a stub config object (types.SimpleNamespace) that was never updated to include an allow_preview attribute, so every call to .connect() raises AttributeError.

2. KeyError: 'foundry-features' (test_voice_agent_generated_audio.TestVoiceAgentGeneratedAudio.test_interrupted_generated_audio)

The test calls client.voice_agents.conversations (the new GA surface this PR introduced), but realtime_interruption_test_base.py's verify() still asserts response.http_request.headers["Foundry-Features"] == "VoiceAgents=V1Preview". Since GA voice_agents operations no longer attach the preview opt-in header by default, the header is absent and the lookup raises KeyError.

3. verifysdist failure (Build Analyze job)

[ERROR] azure-sdk-tools: azure-ai-projects has version 2.11.0 and is a GA release, but had development
status 'Development Status :: 4 - Beta'. Expecting a development classifier that is equal or greater
than 'Development Status :: 5 - Production/Stable'.

pyproject.toml in this PR downgraded the classifier from Development Status :: 5 - Production/Stable to Development Status :: 4 - Beta (part of a diff that also reverted the repository URL, packages.find.exclude ordering, and dropped the [tool.mypy] block). Since azure-ai-projects is version 2.11.0 (GA), the classifier must stay 5 - Production/Stable.

4. mypy failure (Build Analyze job)

samples/agents/tools/util.py: error: Duplicate module named "util" (also at
".../samples/agents/telemetry/util.py")
Found 1 error in 1 file (errors prevented further checking)
mypy check completed with exit code 2

Two same-named util.py modules under different samples/agents/* subdirectories (neither package has __init__.py) make mypy treat them as a single top-level util module, blocking sample type-checking entirely.

Relevant pipeline output
tests/agents/test_realtime_transport.py:178: in test_transport_selection_is_connection_scoped
    first = realtime.connect(agent_name="agent-test", transport=VoiceAgentTransport.WEBRTC)
...
>           allow_preview=bool(self._config.allow_preview),
E       AttributeError: 'types.SimpleNamespace' object has no attribute 'allow_preview'

tests/agents/realtime_interruption_test_base.py:174: in verify
    assert response.http_request.headers["Foundry-Features"] == "VoiceAgents=V1Preview"
E       KeyError: 'foundry-features'

[azure-ai-projects :: verifysdist] [ERROR] azure-ai-projects has version 2.11.0 and is a GA release,
but had development status 'Development Status :: 4 - Beta'. Expecting 'Development Status :: 5 -
Production/Stable'.
verifysdist check completed with exit code 1

[azure-ai-projects :: mypy] samples/agents/tools/util.py: error: Duplicate module named "util"
(also at "samples/agents/telemetry/util.py")
mypy check completed with exit code 2

Recommended next steps

  • Add allow_preview (default False) to the types.SimpleNamespace stub config built by _make_realtime() in tests/agents/test_realtime_transport.py, matching the real _config shape consumed by VoiceAgentsOperations.__init__ and BetaRealtime.connect().
  • In tests/agents/realtime_interruption_test_base.py's verify(), either opt the test client into allow_preview=True for the realtime WebSocket handshake, or update the assertion to match GA voice_agents behavior (no Foundry-Features header unless explicitly requested).
  • Revert the unintended pyproject.toml classifier change back to Development Status :: 5 - Production/Stable (and review the other reverted lines — repository URL, packages.find.exclude order, [tool.mypy] block removal — for whether they were intentional).
  • Rename or namespace one of the two colliding samples/agents/{tools,telemetry}/util.py modules (or add __init__.py files so mypy can disambiguate them) to unblock the sample mypy check.
  • See https://aka.ms/ci-fix

Automated fix: Requested

Generated by Pipeline Analysis Next Steps · copilot · sonnet50 · 219.7 AIC · ⌖ 0.646 AIC · ⊞ 9.1K · ◷

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant