Skip to content

Emit SDK from TypeSpec and apply post-emitter fixes

464ca62
Select commit
Loading
Failed to load commit list.
Closed

[azure-ai-projects] Emit SDK from TypeSpec (routines, models, optimization) #47000

Emit SDK from TypeSpec and apply post-emitter fixes
464ca62
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python - pullrequest failed May 19, 2026 in 30m 30s

Build #20260519.80 had test failures

Details

Tests

  • Failed: 252 (1.67%)
  • Passed: 12,762 (84.81%)
  • Other: 2,034 (13.52%)
  • Total: 15,048

Annotations

Check failure on line 108 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L108

1ES PT Non-Blocking Error: Please complete the PR: https://github.com/Azure/azure-sdk-for-python/pull/46993

Check failure on line 93 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L93

1ES PT Internal Error: An exception of type InternalErrorException occurred in run_sdl_scan_optimization.py. Arguments: (FileNotFoundError(2, 'No such file or directory'),)

Check failure on line 81227 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L81227

PowerShell exited with code '1'.

Check failure on line 303 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

Build log #L303

The process '/mnt/vss/_work/1/s/venv/bin/python' failed with exit code 1

Check failure on line 1 in test_foundry_features_header_on_beta_operations[.beta.memory_stores.list_memories()]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_foundry_features_header_on_beta_operations[.beta.memory_stores.list_memories()]

UnboundLocalError: local variable 'body' referenced before assignment
Raw output
self = <test_foundry_features_header_on_beta_operations.TestFoundryFeaturesHeaderOnBetaOperations object at 0x7f046ca30d60>
client = <azure.ai.projects._patch.AIProjectClient object at 0x7f046cf991e0>
label = '.beta.memory_stores.list_memories()', subclient_name = 'memory_stores'
method_name = 'list_memories', expected_header_value = 'MemoryStores=V1Preview'

    @pytest.mark.parametrize("label,subclient_name,method_name,expected_header_value", _TEST_CASES)
    def test_foundry_features_header_on_beta_operations(
        self,
        client: AIProjectClient,
        label: str,
        subclient_name: str,
        method_name: str,
        expected_header_value: str,
    ) -> None:
        """Assert that *method_name* on .beta.<subclient_name> sends the expected Foundry-Features value."""
        sc = getattr(client.beta, subclient_name)
        method = getattr(sc, method_name)
        extra_kwargs: dict[str, Any] = {}
>       self._assert_header(label, self._make_fake_call(method, extra_kwargs=extra_kwargs), expected_header_value)

tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py:199: in _assert_header
    request = cls._capture(call)
tests/foundry_features_header/test_foundry_features_header_on_beta_operations.py:188: in _capture
    next(iter(result))
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/paging.py:136: in __next__
    return next(self._page_iterator)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/paging.py:82: in __next__
    self._response = self._get_next(self.continuation_token)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_operations.py:13248: in get_next
    _request = prepare_request(_continuation_token)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_continuation_token = None

    def prepare_request(_continuation_token=None):
>       if body is _Unset:
E       UnboundLocalError: local variable 'body' referenced before assignment

../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_operations.py:13212: UnboundLocalError

Check failure on line 1 in test_foundry_features_header_on_beta_operations_async[.beta.memory_stores.list_memories() [async]]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_foundry_features_header_on_beta_operations_async[.beta.memory_stores.list_memories() [async]]

UnboundLocalError: local variable 'body' referenced before assignment
Raw output
self = <test_foundry_features_header_on_beta_operations_async.TestFoundryFeaturesHeaderOnBetaOperationsAsync object at 0x7f046c391e40>
async_client = <azure.ai.projects.aio._patch.AIProjectClient object at 0x7f046ae06500>
label = '.beta.memory_stores.list_memories() [async]'
subclient_name = 'memory_stores', method_name = 'list_memories'
expected_header_value = 'MemoryStores=V1Preview'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("label,subclient_name,method_name,expected_header_value", _ASYNC_TEST_CASES)
    async def test_foundry_features_header_on_beta_operations_async(
        self,
        async_client: AsyncAIProjectClient,
        label: str,
        subclient_name: str,
        method_name: str,
        expected_header_value: str,
    ) -> None:
        """Assert that *method_name* on async .beta.<subclient_name> sends the expected Foundry-Features value."""
        sc = getattr(async_client.beta, subclient_name)
        method = getattr(sc, method_name)
        extra_kwargs: dict[str, Any] = {}
>       await self._assert_header_async(
            label, self._make_fake_call(method, extra_kwargs=extra_kwargs), expected_header_value
        )

tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py:239: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py:218: in _assert_header_async
    request = await cls._capture_async(call)
tests/foundry_features_header/test_foundry_features_header_on_beta_operations_async.py:207: in _capture_async
    await ai.__anext__()
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/async_paging.py:142: in __anext__
    return await self.__anext__()
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/async_paging.py:145: in __anext__
    self._page = await self._page_iterator.__anext__()
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/async_paging.py:94: in __anext__
    self._response = await self._get_next(self.continuation_token)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/aio/operations/_operations.py:9699: in get_next
    _request = prepare_request(_continuation_token)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_continuation_token = None

    def prepare_request(_continuation_token=None):
>       if body is _Unset:
E       UnboundLocalError: local variable 'body' referenced before assignment

../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/aio/operations/_operations.py:9663: UnboundLocalError

Check failure on line 1 in test_hosted_agents_samples[sample_agent_endpoint]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_hosted_agents_samples[sample_agent_endpoint]

azure.core.exceptions.ResourceNotFoundError: Playback failure -- for help resolving, see https://aka.ms/azsdk/python/test-proxy/troubleshoot. Error details:
Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1
Header differences:
    <Foundry-Features> values differ, request <HostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V1Preview>, record <HostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview>
Body differences:
Remaining Entries:
0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1
1: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name?api-version=v1
2: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/protocols/openai/responses?api-version=v1
3: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions/1d0887c37fba1efc000v7QQHIPxqYcAmEJFRYeoayqvFPGXCG2?api-version=v1
4: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/openai/v1/responses

Content: {"Message":"Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1\nHeader differences:\n    \u003CFoundry-Features\u003E values differ, request \u003CHostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V1Preview\u003E, record \u003CHostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview\u003E\nBody differences:\nRemaining Entries:\n0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1\n1
Raw output
self = <sample_executor.SyncSampleExecutor object at 0x7f046a6ba5f0>
patched_open_fn = <function patched_open_crlf_to_lf at 0x7f04701227a0>

    def execute(self, patched_open_fn=None):
        """Execute a synchronous sample with proper mocking and environment setup."""
        # Import patched_open_crlf_to_lf here to avoid circular import
        if patched_open_fn is None:
            from test_base import patched_open_crlf_to_lf
    
            patched_open_fn = patched_open_crlf_to_lf
    
        with (
            MonkeyPatch.context() as mp,
            self._get_mock_credential(),
        ):
            mp.setenv("AZURE_AI_PROJECTS_CONSOLE_LOGGING", "true")
            for var_name, var_value in self.env_vars.items():
                mp.setenv(var_name, var_value)
            if self.spec.loader is None:
                raise ImportError(f"Could not load module {self.spec.name} from {self.sample_path}")
    
            with (
                self._capture_debug_logs(),
                mock.patch("builtins.print", side_effect=self._capture_print),
                mock.patch("builtins.open", side_effect=patched_open_fn),
            ):
                try:
>                   self.spec.loader.exec_module(self.module)

tests/samples/sample_executor.py:686: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap_external>:883: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
samples/hosted_agents/sample_agent_endpoint.py:68: in <module>
    session = project_client.beta.agents.create_session(
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_patch.py:79: in _wrapped
    return attribute(*args, **kwargs)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/tracing/decorator.py:138: in wrapper_use_tracer
    return func(*args, **kwargs)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_operations.py:7159: in create_session
    map_error(status_code=response.status_code, response=response, error_map=error_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

status_code = 404
response = <HttpResponse: 404 Not Found, Content-Type: application/json;>
error_map = {304: <class 'azure.core.exceptions.ResourceNotModifiedError'>, 401: <class 'azure.core.exceptions.ClientAuthenticatio..., 404: <class 'azure.core.exceptions.ResourceNotFoundError'>, 409: <class 'azure.core.exceptions.ResourceExistsError'>}

    def map_error(
        status_code: int,
        response: _HttpResponseCommonAPI,
        error_map: Mapping[int, Type[HttpResponseError]],
    ) -> None:
        if not error_map:
            return
        error_type = error_map.get(status_code)
        if not error_type:
            return
        error = error_type(response=response)
>       raise error
E       azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'Not Found'
E       Content: {"Message":"Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1\nHeader differences:\n    \u003CFoundry-Features\u003E values differ, request \u003CHostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V1Preview\u003E, record \u003CHostedAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview\u003E\nBody differences:\nRemaining Entries:\n0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/sanitized-hosted-agent-name/endpoint/sessions?api-version=v1\n1: https://Sanitized.services.ai.azure.com/
... [The stack trace has been truncated as it exceeded the maximum allowed size. Please refer to the complete log available in the Test Run attachments for full details.]

Check failure on line 1 in test_agent_tools_samples[sample_toolboxes_with_search_preview]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python - pullrequest

test_agent_tools_samples[sample_toolboxes_with_search_preview]

azure.core.exceptions.ResourceNotFoundError: Playback failure -- for help resolving, see https://aka.ms/azsdk/python/test-proxy/troubleshoot. Error details:
Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1
Header differences:
    <Foundry-Features> values differ, request <Skills=V1Preview>, record <Toolboxes=V1Preview>
Body differences:
Remaining Entries:
0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1
1: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/MyAgent/versions?api-version=v1
2: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/openai/v1/responses
3: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/MyAgent/versions/135?api-version=v1
4: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/openai/v1/responses

Content: {"Message":"Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1\nHeader differences:\n    \u003CFoundry-Features\u003E values differ, request \u003CSkills=V1Preview\u003E, record \u003CToolboxes=V1Preview\u003E\nBody differences:\nRemaining Entries:\n0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1\n1: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/MyAgent/versions?api-version=v1\n2: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/openai/v1/responses\n3: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/MyAgent/versions/135?api-version=v1\n4: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/openai/v1/responses\n","Status":"NotFound"}
Raw output
self = <sample_executor.SyncSampleExecutor object at 0x7f046a6dfa30>
patched_open_fn = <function patched_open_crlf_to_lf at 0x7f04701227a0>

    def execute(self, patched_open_fn=None):
        """Execute a synchronous sample with proper mocking and environment setup."""
        # Import patched_open_crlf_to_lf here to avoid circular import
        if patched_open_fn is None:
            from test_base import patched_open_crlf_to_lf
    
            patched_open_fn = patched_open_crlf_to_lf
    
        with (
            MonkeyPatch.context() as mp,
            self._get_mock_credential(),
        ):
            mp.setenv("AZURE_AI_PROJECTS_CONSOLE_LOGGING", "true")
            for var_name, var_value in self.env_vars.items():
                mp.setenv(var_name, var_value)
            if self.spec.loader is None:
                raise ImportError(f"Could not load module {self.spec.name} from {self.sample_path}")
    
            with (
                self._capture_debug_logs(),
                mock.patch("builtins.print", side_effect=self._capture_print),
                mock.patch("builtins.open", side_effect=patched_open_fn),
            ):
                try:
>                   self.spec.loader.exec_module(self.module)

tests/samples/sample_executor.py:686: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap_external>:883: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
samples/agents/tools/sample_toolboxes_with_search_preview.py:75: in <module>
    toolbox_version = project_client.beta.toolboxes.create_version(
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_patch.py:79: in _wrapped
    return attribute(*args, **kwargs)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/core/tracing/decorator.py:138: in wrapper_use_tracer
    return func(*args, **kwargs)
../../../.venv/azure-ai-projects/.venv_whl/lib/python3.10/site-packages/azure/ai/projects/operations/_operations.py:16018: in create_version
    map_error(status_code=response.status_code, response=response, error_map=error_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

status_code = 404
response = <HttpResponse: 404 Not Found, Content-Type: application/json;>
error_map = {304: <class 'azure.core.exceptions.ResourceNotModifiedError'>, 401: <class 'azure.core.exceptions.ClientAuthenticatio..., 404: <class 'azure.core.exceptions.ResourceNotFoundError'>, 409: <class 'azure.core.exceptions.ResourceExistsError'>}

    def map_error(
        status_code: int,
        response: _HttpResponseCommonAPI,
        error_map: Mapping[int, Type[HttpResponseError]],
    ) -> None:
        if not error_map:
            return
        error_type = error_map.get(status_code)
        if not error_type:
            return
        error = error_type(response=response)
>       raise error
E       azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'Not Found'
E       Content: {"Message":"Unable to find a record for the request POST https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1\nHeader differences:\n    \u003CFoundry-Features\u003E values differ, request \u003CSkills=V1Preview\u003E, record \u003CToolboxes=V1Preview\u003E\nBody differences:\nRemaining Entries:\n0: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/toolboxes/toolbox_with_mcp_tool/versions?api-version=v1\n1: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-name/agents/MyAgent/versions?api-version=v1\n2: https://Sanitized.services.ai.azure.com/api/projects/sanitized-project-nam
... [The stack trace has been truncated as it exceeded the maximum allowed size. Please refer to the complete log available in the Test Run attachments for full details.]