[agentserver] ghcopilot toolbox per-request call ID (protocol v2.0.0)#47730
[agentserver] ghcopilot toolbox per-request call ID (protocol v2.0.0)#47730vangarp wants to merge 1 commit into
Conversation
Adds the ghcopilot toolbox/MCP per-request call ID forwarding that was split out of #47584 so it could land after core (2.0.0b7) and responses (1.0.0b8) were merged and published. Bumps ghcopilot to 1.0.0b3 and includes the generated api.md / api.metadata.yml. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds the azure-ai-agentserver-ghcopilot half of container protocol v2.0.0 (per-request call ID forwarding), which was deliberately split out of #47584 so it could land after azure-ai-agentserver-core (2.0.0b7) and azure-ai-agentserver-responses (1.0.0b8) were published. The toolbox/MCP bridge now echoes the inbound x-agent-foundry-call-id on outbound Foundry toolbox calls so a single shared agent session can serve multiple users correctly. Because tools/call is dispatched on the Copilot engine task (where the request-scoped context var is empty), the per-turn call ID is captured in the request task and carried out-of-band keyed by the Copilot session_id, plus a per-conversation user-ownership guard prevents cross-user identity bleed.
Changes:
- Forward
x-agent-foundry-call-idon toolboxinitialize/tools/list(via request context) and ontools/call(via a session-keyed out-of-band map, stamped on both the HTTP header andparams._meta). - Bind each Copilot session to its owning
x-agent-user-idand recreate a fresh session when a different user reuses a conversation, to avoid echoing another user's call ID. - Bump the package to
1.0.0b3, raise core/responses dependency floors to the published 2.0.0b7/1.0.0b8, and add CHANGELOG, README guidance, generated api.md/api.metadata.yml, and unit tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
azure/ai/agentserver/githubcopilot/_toolbox.py |
Adds session-keyed call-id map + set/clear helpers; forwards call ID on outbound MCP calls and stamps params._meta on tools/call. |
azure/ai/agentserver/githubcopilot/_copilot_adapter.py |
Tracks per-conversation session owner, enforces single-user sessions, and binds the per-turn call ID to the Copilot session. |
tests/unit_tests/test_toolbox.py |
New tests for header forwarding, session-keyed tools/call, and set/clear semantics. |
azure/ai/agentserver/githubcopilot/_version.py |
Version bump to 1.0.0b3. |
pyproject.toml |
Raises core/responses dependency floors to published betas. |
CHANGELOG.md |
Documents the 1.0.0b3 protocol 2.0.0 toolbox feature. |
README.md |
Adds a multi-user-sessions usage section. |
api.md / api.metadata.yml |
Generated API surface snapshot (no public API surface change). |
| if request_user is not None and owner is not None and owner != request_user: | ||
| logger.warning( | ||
| "Session for conversation %r is owned by a different user; " | ||
| "creating a fresh session to avoid cross-user identity bleed", | ||
| conversation_id, | ||
| ) | ||
| stale = self._sessions.pop(conversation_id, None) | ||
| self._session_owner.pop(conversation_id, None) | ||
| if stale is not None: | ||
| clear_session_call_id(getattr(stale, "session_id", None)) |
Adds the ghcopilot toolbox/MCP per-request call ID forwarding that was split out of #47584 so it could land after core (2.0.0b7) and responses (1.0.0b8) were merged and published. Bumps ghcopilot to 1.0.0b3 and includes the generated api.md / api.metadata.yml.
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:
General Guidelines and Best Practices
Testing Guidelines