Repository navigation
Python: Forward function_invocation_kwargs to GitHubCopilotAgent tools - #8868
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 5 commits intoOct 1, 2026
Conversation
RawGitHubCopilotAgent.run swallowed function_invocation_kwargs in **kwargs and the Copilot SDK tool handler invoked FunctionTool without a FunctionInvocationContext, so tools never saw per-run kwargs or the AgentSession. Thread both through session create/resume into the tool handler and pass them via FunctionInvocationContext. Fixes microsoft#8865
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
September 29, 2026 19:28 — with
GitHub Actions
Inactive
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
September 29, 2026 19:28 — with
GitHub Actions
Inactive
…sion The Copilot SDK keeps one session object per service session ID and re-registers tools on every resume, dispatching tool calls by session ID. Since tool handlers now capture the run's function_invocation_kwargs and session, an overlapping resume could let one run's tool calls execute with another run's context. Hold a per-session run lock from create/resume until the run completes.
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
September 30, 2026 06:00 — with
GitHub Actions
Inactive
Dineshsuriya D (droideronline)
requested a review
from Evan Mattson (moonbox3)
September 30, 2026 06:01
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
September 30, 2026 06:01 — with
GitHub Actions
Inactive
Dineshsuriya D (droideronline)
requested a review
from sophia-ramsey
as a code owner
October 1, 2026 07:19
Dineshsuriya D (droideronline)
temporarily deployed
to
github-app-auth
October 1, 2026 07:19 — with
GitHub Actions
Inactive
Contributor
Author
|
Fixed the failing "Test Typing Checks" job in 0eb1e19: the overlapping-run tests now use |
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 1, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
function_invocation_kwargspassed to aGitHubCopilotAgent(directly viaagent.run(...), or from a workflow viaworkflow.run(..., function_invocation_kwargs=...)) never reached its tools.RawGitHubCopilotAgent.runaccepted them only through**kwargsand dropped them, and the Copilot SDK tool handler calledFunctionTool.invokewithout aFunctionInvocationContext. Tools that declare aFunctionInvocationContextparameter therefore saw emptyctx.kwargsand noctx.session, unlike the same tool on a chat-client-backedAgent.Description & Review Guide
RawGitHubCopilotAgent.run(all overloads) now takesfunction_invocation_kwargsas a named parameter and forwards it to_run_impland_stream_updates.AgentSession, is threaded through_get_or_create_session,_create_session/_resume_session,_build_session_kwargsand_prepare_toolsinto_tool_to_copilot_tool.FunctionInvocationContext(function, arguments, session, kwargs)and passes it toai_func.invoke(...), along with the SDK'stool_call_idfor telemetry.FunctionInvocationContextparameter now receive the run'sfunction_invocation_kwargsand session, matching coreAgentbehavior. Tools without a context parameter are unaffected, and the context parameter is not exposed in the tool schema sent to the model.AgentSessionto tools viactx.session, and the new keyword-only parameters on the private session and tool helpers.Tests added for non-streaming and streaming runs, resumed sessions, and tools without a context parameter.
Related Issue
Fixes #8865
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.