Skip to content

Python: Clarify MCP annotation override scope - #22

Closed
eavanvalkenburg wants to merge 87 commits into
mainfrom
mcp-override-scope-assessment
Closed

eavanvalkenburg wants to merge 87 commits into
mainfrom
mcp-override-scope-assessment

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Owner

Motivation & Context

Clarify how applications should scope annotation_overrides when configuring multiple MCP connections.

Description & Review Guide

  • What are the major changes? Clarify the apply_mcp_security_labels and SecureMCPToolProxy parameter docstrings and add matching guidance to the FIDES developer guide. Overrides apply to the supplied connection, while the mapping itself is not bound to a server identity. Reusing it requires independently authorizing the policy for the other server's tools.
  • What is the impact of these changes? Documentation only. Runtime behavior, API signatures, and defaults remain unchanged.
  • What do you want reviewers to focus on? Clarity and consistency of the connection-scoping and policy-reuse guidance.

Related Issue

N/A — small documentation clarification; the contribution guidelines permit trivial changes without an issue. No matching open PR was found.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Build and unit-test checks are not marked complete for this documentation-only change. The local Poe workspace hook could not resolve packages excluded by the sparse checkout; only that hook was skipped. Other applicable commit hooks passed.

dependabot Bot and others added 30 commits September 10, 2026 11:20
…8213)

* Build(deps): bump astral-sh/setup-uv from 9.0.0 to 10.0.1

Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 9.0.0 to 10.0.1.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](astral-sh/setup-uv@v9.0.0...20cfd1b)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Change cache setting to auto in devflow PR review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Change cache enable option to auto in workflow

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… the run's kwargs (microsoft#8225)

* Added failing test

* seeding run header value for auth to mcp connect

* WIP: added connection_kwargs and tests

* Python: fix(core): seed run kwargs into MCP connection-header resolution

Constructor-supplied MCP tools now seed the run's function_invocation_kwargs before connecting, matching the run-supplied path. Adds coverage for the connect-time credential matrix and fixes the API-key sample to close over a construction-time credential.

* Python: fix(core): fail the MCP handshake when seeded kwargs miss the provider's key

Ambient header resolution previously swallowed every KeyError from header_provider, so a run whose kwargs did not carry the key the provider reads would silently send the initialize handshake unauthenticated and surface as a 401. Only tolerate the KeyError when no connection kwargs were seeded at all, which is the case a caller cannot avoid; a key missing from seeded kwargs is a misconfiguration and now propagates.

* Python: fix(core): distinguish unseeded MCP connections and release kwargs on failed connect

Addresses review on microsoft#8225. An empty mapping could not express the difference between a run that seeded no kwargs and a connection no run ever seeded, so a lazy run with empty kwargs still swallowed the provider's KeyError and sent an unauthenticated handshake. _connection_kwargs is now None until a run seeds it. The seeded kwargs were also only released through close(); a rejected handshake unwinds via _close_and_check_cancelled instead, leaving the failed run's credential for a later unseeded reconnect, so the release now happens there. Documents the connection-lifetime semantics on the public header_provider parameter.

* Python: fix(core): make the MCP connection kwargs seed a first-writer claim

Addresses review on microsoft#8225. is_connected only turns true after initialize returns, so two concurrent runs could both pass the guard and the second would swap the credential out from under the first run's in-flight handshake, authenticating a shared tool as the wrong caller. The seed is now a first-writer claim, released when the connection closes or its setup fails.

* Update python/samples/02-agents/mcp/mcp_api_key_auth.py

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Harden LocalCodeAct OS validation

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

* Address LocalCodeAct review feedback

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* chore: upgrades xunit dependencies
chore: upgrades  bcl dependencies
chore: upgrades additional system dependencies
chore: upgrades dotnetenv
chore: upgrades mcp dependencies
chore: upgrades microsoft agents object model dependencies

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* ci: updates to the new switch

* fix: adds missing method implementations

* Add InvokeMcpToolAction unsupported-action test

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

* Update xUnit JUnit artifact upload pattern

Retain the existing .junit glob and include xUnit 4's .junit.xml output so non-PR integration test reports are uploaded for trend aggregation.

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

* tests: Add VoiceAuthenticate.Builder to test cases

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* tests: disables parallelization for integration tests to avoid swamping the service

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* ci: removes promote script and replaces by dedicated action

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* ci: fixes the path

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* ci: upgrades task to version that pins dependencies

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* ci: upgrades to latest action version

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…ions (microsoft#8206)

* Python: reset $LASTEXITCODE per command in persistent PowerShell sessions

$LASTEXITCODE is a session-wide automatic variable that only native
(external) processes update, so in a long-lived session it stays set
after such a command. Every later cmdlet-only command then took the
$LASTEXITCODE branch in the sentinel script and reported that stale
value instead of 0.

Clear it in the global scope before invoking the user command so a
non-null value can only have come from this command. The global scope
qualifier matters: assigning the unqualified name inside the script
block shadows the global the engine writes to, which would hide real
native exit codes.

* Python: snapshot $LASTEXITCODE instead of clearing it

Review feedback: clearing $global:LASTEXITCODE before the user's command
destroys state persistent mode exists to carry. After `cmd /c exit 3`, a
following `Write-Output $LASTEXITCODE` printed nothing instead of 3.

Snapshot the value before the command and compare afterwards instead. The
variable is never assigned, so the user's own commands still read it, and a
value that differs can only have been written by this command. $? is read on
the statement right after Invoke-Expression, since anything else clobbers it.

The regression test now also asserts the readback prints 3 while its own
exit code is 0, which fails against the previous approach.
* fix: do not forward headers on redirect

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* tests: use mocked handlers instead of simulated endpoints for reliability

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* docs: Clarify redirect handling in DefaultHttpRequestHandler

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* chore: Improve exception handling for invalid request URI

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* docs: fixes xml doc structure

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* tests: linting

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* perf: only read headers for redirect responses

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: aggregate timeout across redirects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: prevent https to http redirects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: do not reject provider clients on initial request

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* tests: refactor to avoid missing disposals

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: do not rely on specific headers names

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: address redirect review feedback

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

* tests: ensure responses are disposed

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* chore: suppression of linting rule

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: reject redirect with body to different origin

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: timeout in dotnet fx as well

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: return the redirect response instead of throwing

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* Apply batched suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding 'Missing Dispose call on local IDisposable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* chore: linting

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* chore: updates open telemetry dependencies
chore: updates trimmer dependency
chore: updates copilot sdk dependency

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* ci: adds an open telemetry group

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* Update explicit OpenTelemetry sample pins

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
…l sessions (microsoft#8259)

* Dotnet: reset $LASTEXITCODE per command in persistent PowerShell sessions

* .NET: reset LASTEXITCODE before each PowerShell command

Clear the persistent automatic variable before invoking each command so repeated native failures with the same exit code are reported correctly. Update the Windows regression test to cover repeated failures and reset readback semantics.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lt (microsoft#8283)

* docs(python): clarify context.result shape contract

FunctionInvocationContext.result documents one contract but carries two:
middleware observe FunctionTool.invoke's parsed output and may write back a
value of any type, so a type check written from the docs silently never fires.
The shared-state sample modeled the wrong side and sent a Python repr of the
Content list to the model instead of the tool's text.

* docs(python): note the approval-request passthrough

A bare Content of type function_approval_request is returned unchanged by the
invocation layer on both the normal and termination paths, so the override rule
as written misdirects middleware that drive approval flows.
…8269)

Co-authored-by: WhaleTech <304937387+ryo-whaletech@users.noreply.github.com>
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
…) (microsoft#8162)

* Python: Update Monty bridge for pydantic-monty pool API (microsoft#8152)

* Python: Refresh uv.lock for pydantic-monty>=0.0.23 (microsoft#8152)

* Python: drop obsolete pydantic-monty version migration comment (microsoft#8152)

Floor is already >=0.0.23; no need to document the old API transition.

* Python: add uv.lock platform markers for monty deps (microsoft#8152)

* Revert "Python: add uv.lock platform markers for monty deps (microsoft#8152)"

This reverts commit 14a48a2.

* Python: refresh uv.lock for pydantic-monty 0.0.23 (microsoft#8152)

Keep main's prerelease-mode and platform-marker lock format so CI
uv-lock stays clean while resolving pydantic-monty>=0.0.23.

---------

Co-authored-by: minelhi <3417378192@qq.com>
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
* Python: count async tool invocation exceptions

* Python: track direct async tool failures
* .NET: Add Foundry hosted session client samples

* .NET: Handle closed input in hosted clients

* .NET: Clarify user isolation sample trust boundary

* .NET: Keep preview flag on direct Toolbox MCP calls
* chore: upgrades MSAI extensions packages
chore: upgrade OpenAI package

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: upgrades azure blobs
chore: upgrades AGUI
chore: upgrades hyperlight

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: upgrades cosmos
chore: upgrades copilot studio
chore: upgrades microsoft agents

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Aspire.Azure.AI.Inference and Azure.AI.AgentServer.Core versions

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update DotNetEnv package version to 3.2.0 across multiple projects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Anthropic package version to 12.45.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Azure.AI.Projects package version to 3.0.0-beta.2 across multiple projects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update AgentFrameworkVersion to 1.20.0-preview.260831.1 across multiple projects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update ModelContextProtocol package version to 2.2.0 across multiple projects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update ResponsibleAI.AgentHooks package version to 0.1.0-alpha.5

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: updated sample mapping to the wrong property

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Extensions.AI.OpenAI to version 10.10.0 and OpenAI to version 2.13.0 in multiple projects

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update OllamaSharp package version to 5.4.30

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: remove central package transitive pinning and version overrides for Microsoft.Extensions packages

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update AGUIJsonSerializerOptions usage in session persistence tests

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update AGUIJsonSerializerOptions usage in FakeTestAgentHost and SessionPersistenceTests

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update CommunityToolkit.Aspire.OllamaSharp package version to 13.5.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Identity.Client.Extensions.Msal package version to 4.88.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: Update Microsoft.Agents.AI.Mcp package version in non CPM project

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* chore: add ModelContextProtocol.Extensions.Tasks package reference

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* tests: updates integration tests following dependency upgrade

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…icrosoft#8290)

* Limit MCP skill archives to the ZIP format

Skill archives served over MCP are restricted to ZIP in both .NET and Python.
Payloads detected as any other container format are reported as unsupported
and skipped during discovery instead of being unpacked.

- .NET: drop `ArchiveFormat.Tar`/`TarGz` and the TAR extraction path from
  `AgentMcpSkillArchiveExtractor`; an unsupported format now throws before the
  target directory is created.
- Python: drop `_ArchiveFormat.TAR`/`TAR_GZ` and `_extract_tar_to_memory` from
  `_skills.py`; an unsupported format raises.
- Update the affected unit tests and documentation to match.

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

* Address review feedback

- Drop redundant `@pytest.mark.asyncio` decorators: `packages/core` configures
  `asyncio_mode = "auto"`, so pytest-asyncio collects the async tests without
  them.
- Update the `FoundryToolbox.as_skills_provider()` docstring to describe archive
  entries as ZIP, matching the source it forwards options to.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Simplify CODEOWNERS rules

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

Copilot-Session: 6f2020a7-d92e-4a6b-8a5d-1b05cdbabda6

* Clarify CODEOWNERS rule scope

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

Copilot-Session: 6f2020a7-d92e-4a6b-8a5d-1b05cdbabda6

---------

Copilot-Session: 6f2020a7-d92e-4a6b-8a5d-1b05cdbabda6
* Python: Isolate Anthropic request parsing state

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

* Python: Cover concurrent Anthropic responses

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Python: Scope Redis history storage keys

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

* Python: Address Redis history review feedback

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

---------

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

Copilot-Session: b9da797e-a9ff-492f-b5c1-8e9c7af1d8dc
* Python: scope Secure MCP URL headers to origin

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: bf1fc8c4-eff7-42e7-9342-d385036223be

* Python: preserve concurrent Secure MCP calls

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: bf1fc8c4-eff7-42e7-9342-d385036223be
* fix: race concdition in workflow formula state

* fix: build issue with key
* chore: update Microsoft.Testing.Extensions.CodeCoverage to version 18.11.2

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Identity.Client.Extensions.Msal to version 4.89.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Agents.AI.Foundry to version 1.5.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Google.GenAI to version 1.21.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.ML.OnnxRuntimeGenAI to version 0.15.2

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Agents.CopilotStudio.Client and related packages to version 1.9.35-beta

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.Agents.AI to version 1.20.0 and Microsoft.Extensions.Hosting to version 10.0.12

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update AgentFrameworkVersion to 1.20.0-preview.260831.1

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update AgentFrameworkVersion to 1.20.0 and Azure.AI.AgentServer.Invocations to version 1.0.0-beta.7

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Aspire.Azure.AI.OpenAI to version 13.5.3-preview.1.26425.3

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Mscc.GenerativeAI.Microsoft to version 3.1.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Microsoft.CodeAnalysis.Analyzers and Microsoft.CodeAnalysis.CSharp to version 5.9.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update Neo4j.Driver to version 6.3.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: update System.CommandLine to version 2.0.12

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: downgrade Neo4j.Driver to version 5.28.0

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* chore: Downgrade Microsoft.Agents.AI package version to maintain alignment

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ft#8301)

* fix: inspect for delemiter value before adding headers

* chore: Simplify error message for invalid HTTP header name

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* test: Cover invalid body content type rejection

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

* fix: address CRLF test build issue

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

Copilot-Session: 241dc909-4fc9-4e7c-8f7c-fb969e4ce2e9

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Copilot-Session: 241dc909-4fc9-4e7c-8f7c-fb969e4ce2e9
Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
fzfzzfzzzfzzzz and others added 24 commits September 15, 2026 03:06
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
…ct (microsoft#8381)

* Python: handle Qdrant readiness race after collection creation conflict

* Python: retry Qdrant gRPC readiness errors after creation conflicts
* Python: document keyed web search with Serply MCP

Add a README section to the MCP samples showing MCPStreamableHTTPTool
against the Serply MCP server with header_provider supplying the
X-Api-Key header, calling google_search and google_news_search directly.
Adds the SERPLY_API_KEY line under Prerequisites.

* Python: use static_headers for the Serply MCP key

The key is fixed for the process, so static_headers is the right API. A
header_provider holds _call_headers_lock for the whole call_tool, which
would serialize concurrent Serply searches; static_headers keeps the same
origin scoping and cross-origin redirect stripping without that lock.
* Python: Bind MCP HTTP sessions to request identity

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Reconcile MCP identity before tool discovery

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Recheck MCP identity after lazy connect

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Preserve caller-owned MCP identity across close

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Reconcile MCP prompt identity at invocation

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Defer unresolved MCP run headers

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Reject unknown borrowed MCP identity

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

* Python: Serialize MCP identity rediscovery

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

Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Copilot-Session: efc43d46-4f87-4702-9f55-9f5f596c33b7
* Python: tighten security label enforcement

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

* Python: add identity security setup sample

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

* Python: address security review feedback

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

* Python: refine identity policy internals

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
…icrosoft#8311)

* Python: Fix workflow kwargs collision with __global__ executor IDs

* Python: Scope workflow kwargs warning assertion

---------

Co-authored-by: WhaleTech <304937387+ryo-whaletech@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
)

* Python: validate functional workflow response types

* test: cover functional workflow response coercion

* refactor: share workflow response validation

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
* Python: Separate hosted and local shell calls

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

* Python: Preserve local shell approval default

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

* Python: Distinguish local shell environments

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

* Python: Format shell call tests

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

* Python: Preserve shell transcript replay

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
…me (microsoft#8300)

* Python: preserve functional workflow state on response-only resume

* refactor: centralize functional workflow replay state

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
)

* Python: handle concurrent checkpoint deletion

* Python: serialize concurrent checkpoint deletes

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
microsoft#8272)

* fix(python): pickle checkpoint dicts with colliding str keys

When dict keys collide after str() (e.g. 1 and "1"), JSON encoding silently overwrote values. Pickle those mappings instead (microsoft#8256).

* fix(checkpoint): stringify dict keys once during encode

Reuse one str(key) for reserved-key checks, collision detection, and
the encoded mapping so stateful __str__ cannot disagree across passes.

* fix(checkpoint): stringify dict keys once during encode

Reuse one str(key) for reserved-key checks, collision detection, and
the encoded mapping so stateful __str__ cannot disagree across passes.

---------

Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
…pletes (microsoft#8358)

* Python: drop continuation_token after a resumed background stream completes

The non-streaming path pops continuation_token from the caller's options once
the background response completes (microsoft#5394), because FunctionInvocationLayer
reuses that dict across tool-loop iterations. The streaming resume branch did
not, so after the resumed stream ended in a function call, every iteration
retrieved the same response again and ran its tools again until max_iterations.

Fixes microsoft#8357

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Python: drop the continuation_token before yielding the terminal update

A consumer that stops iterating at the terminal update never resumed the
generator past that yield, so the cleanup after the loop didn't run and
the options kept the token. Pop it when the terminal event arrives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Python: drop a finished background response's token from the function loop's options

The pops in _inner_get_response act on the options that reached the
service call. Chat middleware may replace those, and then the function
loop keeps the token in its own options, retrieves the finished response
again on the next iteration and runs its tools again. Clear the token in
OpenAIChatClient._update_function_invocation_continuation_state once the
response has no continuation token, for both streaming and non-streaming
calls. The pre-yield cleanup stays for raw-stream consumers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Python: type the resume tests' options as OpenAIChatOptions

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
…mbedding calls (microsoft#8347)

* Python: record gen_ai.client.operation.duration for failed chat and embedding calls

* Python: record duration metric when stream finalizer raises

* fix(python): re-raise finalizer and result-hook exceptions in _finalize_stream

Narrow error handling to get_final_response and re-raise exceptions while independently guarding telemetry capture, ensuring caller outcomes and duration error metrics remain aligned.
* Python: resolve postponed response handler annotations

* Modify handle_response to use WorkflowContext with bool

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* test: cover response handler annotation fallbacks

* fix: harden response handler annotation validation

* fix: resolve response handler CI checks

* fix: satisfy core pyright checks

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
microsoft#8373)

* Python: close open Workflow AG-UI tool calls before approval interrupt

Workflow AG-UI left streamed function tool calls open when pausing for
request_info approval, so clients rejected RUN_FINISHED. Drain pending
tool call ends before the interrupt path, matching Agent approval emit.

Fixes microsoft#8244

* Avoid unmatched TOOL_CALL_END after Workflow approval resume

Only emit TOOL_CALL_END from _emit_tool_result_common when the call was
opened in this run and is still open. Synthetic closure before interrupt
and fresh FlowState on resume then surface TOOL_CALL_RESULT only, matching
the Agent approval path.

* Fix ag-ui mypy errors in approval interrupt tests

Use EventType for list.count and type WorkflowContext yield_output
parameters so the approval tool-call interrupt tests pass mypy.
…icrosoft#8363)

* perf(foundry-hosting): parallelize pre-model storage reads

The non-workflow response handler loaded the caller's input items, the prior
conversation history, and the agent session with three strictly-sequential
awaits before the model call. These are independent storage round-trips with
no data dependency, so on warm/multi-turn requests they added avoidable serial
latency to the request critical path.

Load them concurrently: the input/history reads are gathered in a new
_load_request_messages helper and kicked off (via ensure_future) so they
overlap the session load. Result ordering (history precedes input) and the
existing error semantics are preserved; the read task is cancelled if session
preparation fails. Stateless single-turn requests are unaffected (history and
session loads short-circuit without a round-trip).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3d900395-13d0-4698-bf9d-f6670f9e545c

* address review: own/cancel read tasks, assemble in helper, add tests

- _load_request_messages now owns both read tasks and, on any BaseException
  (including CancelledError/GeneratorExit from gather's first-failure or an
  outer cancellation), cancels and drains the sibling so no storage read is
  orphaned.
- The helper returns the assembled [*history, *input] list, so the message
  ordering rule lives only in the helper (per review); the caller no longer
  reverses the tuple.
- Session-prep cleanup now catches BaseException, cancels AND awaits (drains)
  the in-flight read task, and logs only ordinary Exceptions.
- Add TestParallelRequestReads: overlap, message ordering, history-skip when
  not agent-server history, and sibling-cancellation on a failed read.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3d900395-13d0-4698-bf9d-f6670f9e545c

* test(foundry-hosting): cover session-prep failure cancels in-flight reads

Adds a handler-level regression test proving that when session
preparation fails, the concurrently-launched input/history read task
started by _handle_inner_agent is cancelled and drained rather than
orphaned. Completes the no-orphan coverage requested in review
(the helper-level read-failure path was already covered).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3d900395-13d0-4698-bf9d-f6670f9e545c

---------

Co-authored-by: Harsheet Shah <harsheetshah@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Copilot-Session: 3d900395-13d0-4698-bf9d-f6670f9e545c
…n the basics group (microsoft#8266)

* Build(deps-dev): bump ruff in /python in the basics group

Bumps the basics group in /python with 1 update: [ruff](https://github.com/astral-sh/ruff).


Updates `ruff` from 0.16.5 to 0.16.6
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.16.5...0.16.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: basics
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix Ruff lockfiles and config aliases

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Clarify Ruff selector aliases

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Document Ruff selector convention

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Annotate Ruff selector aliases

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Polish Ruff selector comments

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Clarify Ruff selector comments

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Preserve Ruff rule code selectors

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Use Ruff code for selector preference ignore

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Group Ruff T selectors

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* Fix Hyperlight rejected output cleanup test

Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
* .NET: Retrieve Aspire traces in DevUI aggregator

* .NET: Display Aspire traces in DevUI frontend

* .NET: Fix Aspire DevUI sample startup configuration

* .NET: Wait for complete Aspire trace snapshots

* .NET: Respect Aspire trace retrieval capability

* .NET: Preserve trace mapping with response compression

* .NET: Capture response IDs from oversized SSE events

* .NET: Preserve SSE response ID precedence

* Python: Preserve trace snapshots and bound polling time

Keep collected spans across transient failures and enforce a six-second deadline across requests, response bodies, and delays. Move frontend tests out of Python test discovery and format the regenerated bundle for the required hooks.

---------

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
* Python: Add MongoDB vector store connector

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f

* Fix MongoDB vector validation edge cases

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

* Address MongoDB review feedback

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f

* Raise MongoDB connector core floor

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
…rosoft#8366)

* Python: Preserve MessageText values during formula preprocessing

Process only original formula text and bind extracted messages through temporary state instead of embedding message content in formula source. Avoid temporary-name collisions and cover literal handling, nested calls, and cleanup regressions.

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

* Python: Respect quoted identifiers and comments in MessageText scanning

Share quoted-token and comment handling between formula scanning and call-boundary matching. Cover identifier escapes and comment boundaries with preprocessing and real-PowerFx regressions, and replace the test append-return lambda with a typed helper for mypy.

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

* Python: Wait for retired output cleanup in Hyperlight test

Assert the rejected sandbox entry is evicted, then drain asynchronous disposal before checking that its output directory is gone. Avoid racing a directory listing against background deletion without changing runtime behavior.

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

* Python: Drop local Hyperlight test fix in favor of upstream

Revert 6d8ca2d. The cleanup test is now fixed upstream; remove our independent correction before merging main.

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

* Python: Preserve MessageText expressions in interpolated strings

Traverse only original expression positions so interpolation expressions are preprocessed without reinterpreting literal text or message values. Move quoted-token handling to module scope and add focused regression coverage for the new interpolation contexts.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rosoft#8377)

* Initial plan

* Temporarily skip flaky steering harness session reuse test

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
)

* Python: Make HTTP response-cookie persistence explicit

Configure internally created MCP, A2A, and AG-UI HTTP clients to reject response-cookie persistence while preserving caller-provided clients. Retain connection reuse and cleanup, and document the migration path for applications requiring persistent cookies.

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

* Python: Align declarative HTTP cookie persistence defaults

Apply the default response-cookie policy to internally managed declarative HTTP clients. Preserve supplied and provider-returned clients, client selection and lifecycle, explicit request headers, and response headers. Document the configuration path and cover reuse, failure responses, and overlapping requests.

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

* Python: Preserve caller-owned A2A HTTP clients

Leave HTTP clients supplied alongside an A2A protocol client open on agent exit. Extend the existing ownership regression, retain internally owned cleanup coverage, and document caller cleanup responsibility.

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

* Python: Clarify AG-UI test types

Type conditional exception contexts explicitly and use separate variables for chat and HTTP responses. Preserve the existing test cases and assertions while satisfying Mypy and Zuban.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bstractions (microsoft#7991)

* feat(dotnet): share agent session store abstraction

* fix(dotnet): address session store review findings

* fix(dotnet): remove legacy session key fallback

* feat(dotnet): add partitioned session store keys

* refactor(dotnet): keep session keys storage agnostic

* refactor(dotnet): promote delegating session store

* Restore session store service discovery

Preserve GetService in the shared contract and delegate service queries through store decorators. Use discovery to avoid duplicate isolation wrappers in Hosting, A2A, and AGUI. Update public APIs, documentation, and regression coverage with scoped RS0026 pragmas.

Copilot-Session: 22c59c1d-1805-41b5-b868-c01855e7ceb7

* Avoid dictionary allocations for unpartitioned session keys

Make AgentSessionStoreKey.Partitions nullable and normalize absent or empty partitions to null. Update equality, hashing, storage encoders, API declarations, and regression tests.

Copilot-Session: 22c59c1d-1805-41b5-b868-c01855e7ceb7

---------

Copilot-Session: 22c59c1d-1805-41b5-b868-c01855e7ceb7

This branch had an error being deployed

1 failed and 1 inactive deployments
github-app-auth — 67aed54d Deployed Sep 15, 2026 by eavanvalkenburg via team_check #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.