Skip to content

Python: Forward provider config to SessionConfig in GitHubCopilotAgent (fixes…#5195

Merged
giles17 merged 3 commits intomicrosoft:mainfrom
Serjbory:fix/issue_5190
Apr 15, 2026
Merged

Python: Forward provider config to SessionConfig in GitHubCopilotAgent (fixes…#5195
giles17 merged 3 commits intomicrosoft:mainfrom
Serjbory:fix/issue_5190

Conversation

@Serjbory
Copy link
Copy Markdown
Contributor

@Serjbory Serjbory commented Apr 9, 2026

Fixes #5190

Motivation and Context

GitHubCopilotAgent does not forward the provider field from default_options (or runtime options) to the Copilot SDK's SessionConfig / ResumeSessionConfig. This makes BYOK (Bring Your Own Key) and Azure Managed Identity authentication impossible through the Agent Framework wrapper, even though the underlying github-copilot-sdk fully supports ProviderConfig on both config types.

Description

Follow the established mcp_servers pattern to add provider passthrough:

  • Import ProviderConfig from copilot.types.
  • GitHubCopilotOptions TypedDict: Add provider: ProviderConfig field with docstring for discoverability and type safety.
  • __init__: Pop provider from the options dict and store it as self._provider (same as mcp_servers, on_permission_request, etc.), so it does not leak into _default_options.
  • _create_session: Resolve provider from runtime_options first, falling back to self._provider, and forward it to SessionConfig.
  • _resume_session: Forward self._provider to ResumeSessionConfig.
  • Tests: Add TestGitHubCopilotAgentProvider class with 7 tests covering:
    • Provider passed to create_session (Azure + bearer_token)
    • Provider passed to resume_session
    • Config excludes provider when not set (both create and resume)
    • Runtime provider takes precedence over default
    • Provider is popped from opts and not leaked into _default_options
    • Provider coexists with model, tools, and mcp_servers

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR. — No, this is a purely additive change.

@moonbox3 moonbox3 added the python label Apr 9, 2026
@github-actions github-actions Bot changed the title Forward provider config to SessionConfig in GitHubCopilotAgent (fixes… Python: Forward provider config to SessionConfig in GitHubCopilotAgent (fixes… Apr 9, 2026
@eavanvalkenburg
Copy link
Copy Markdown
Member

@Serjbory please pull in the latest changes and make the updates!

@Serjbory
Copy link
Copy Markdown
Contributor Author

@Serjbory please pull in the latest changes and make the updates!

@eavanvalkenburg updates are done. Could you review it, please?

@moonbox3
Copy link
Copy Markdown
Contributor

moonbox3 commented Apr 10, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/github_copilot/agent_framework_github_copilot
   _agent.py2681295%37–38, 44, 63, 370–371, 646–647, 662, 665, 732, 757
TOTAL27549319988% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5577 20 💤 0 ❌ 0 🔥 1m 23s ⏱️

@giles17 giles17 added this pull request to the merge queue Apr 14, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Apr 15, 2026
@Serjbory
Copy link
Copy Markdown
Contributor Author

hello @eavanvalkenburg . I can see that PR was added to the merge queue, but after it was deleted. Is there any problem with CI or should I fix something on my side?

@giles17 giles17 added this pull request to the merge queue Apr 15, 2026
Merged via the queue into microsoft:main with commit eab7f09 Apr 15, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: GitHubCopilotAgent does not forward provider config to SessionConfig, BYOK not working

4 participants