Skip to content

[agentserver] ghcopilot toolbox per-request call ID (protocol v2.0.0)#47730

Open
vangarp wants to merge 1 commit into
mainfrom
pranavp/agentserver-ghcopilot-callid
Open

[agentserver] ghcopilot toolbox per-request call ID (protocol v2.0.0)#47730
vangarp wants to merge 1 commit into
mainfrom
pranavp/agentserver-ghcopilot-callid

Conversation

@vangarp

@vangarp vangarp commented Jun 28, 2026

Copy link
Copy Markdown
Member

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:

  • 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.

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>
Copilot AI review requested due to automatic review settings June 28, 2026 08:35
@github-actions github-actions Bot added the Hosted Agents sdk/agentserver/* label Jun 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-id on toolbox initialize/tools/list (via request context) and on tools/call (via a session-keyed out-of-band map, stamped on both the HTTP header and params._meta).
  • Bind each Copilot session to its owning x-agent-user-id and 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).

Comment on lines +330 to +339
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hosted Agents sdk/agentserver/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants