You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden MCP OAuth cancel E2E tests against create/interest race (#2029)
* Harden MCP OAuth cancel E2E tests against create/interest race
The MCP OAuth "cancel" E2E tests sampled the host auth callback the instant
the server reached `needs-auth`, which is racy: `session.create` kicks off the
MCP connection, but the SDK only registers its `mcp.oauth_required` event
interest after create returns. When the server's initial 401 wins that race,
the runtime records `needs-auth` without invoking the host callback, so the
callback observation was intermittently empty (e.g. the flaky C# CI leg in
copilot-agent-runtime).
Wait for the callback to be invoked (bounded, reusing each suite's existing
wait-for-condition helper) instead of sampling it immediately. A later runtime
auth retry fires the callback with the same `initial` reason, so the assertions
stay valid. Applied uniformly to C#, Go, Python, Java, and Rust; the Go change
also guards the observed request with a mutex to fix a latent data race.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f7849882-a2a2-4587-a602-da7718889a8c
* Use TaskCompletionSource for thread-safe callback wait in C# cancel test
Addresses review feedback: the previous poll read observedRequest (written by the callback thread) from the test continuation without synchronization. Switch to the TaskCompletionSource pattern already used by the direct-RPC test in this file, so the callback result is handed off safely and awaited with a timeout.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f7849882-a2a2-4587-a602-da7718889a8c
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
0 commit comments