Python: [BREAKING] Upgrade github-copilot-sdk to v1.0.0 (stable)#6292
Conversation
Upgrade agent-framework-github-copilot from github-copilot-sdk 1.0.0b2 to the stable 1.0.0 release, adapting to all breaking API changes. Source changes (_agent.py): - SubprocessConfig removed: use RuntimeConnection.for_stdio(path=...) + CopilotClient kwargs (connection, log_level, base_directory) - Import paths: copilot.generated.session_events -> copilot.session_events - Settings: copilot_home -> base_directory (env GITHUB_COPILOT_BASE_DIRECTORY) - Default deny handler: PermissionDecisionUserNotAvailable() (from copilot.generated.rpc) Test changes: - Updated imports and client-construction assertions (kwargs-based) - Permission handler tests use concrete decision types (PermissionDecisionApproveOnce, PermissionDecisionDeniedInteractivelyByUser) Sample changes: - Permission handlers use PermissionHandler.approve_all or sync approve_and_log pattern (v1.0.0 protocol v3 dispatch is incompatible with blocking input() in permission handlers) - Function approval sample uses asyncio.to_thread for interactive prompts - Simplified imports across all samples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the Python agent-framework-github-copilot integration to work with github-copilot-sdk v1.0.0 (stable), including adapting to GA API changes in client construction, settings/env var naming, and permission/decision types.
Changes:
- Bumps
github-copilot-sdkdependency constraints (and updatesuv.lock) to target>=1.0.0,<2. - Refactors
GitHubCopilotAgentclient startup to useRuntimeConnection.for_stdio(...)and kwargs-basedCopilotClient(...)construction; renamescopilot_home→base_directory. - Updates tests and samples to the new import paths and permission decision patterns.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Locks updated dependency graph for the SDK upgrade (incl. transitive bumps). |
| python/samples/02-agents/providers/github_copilot/README.md | Documents env var rename to GITHUB_COPILOT_BASE_DIRECTORY. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_url.py | Updates permission imports/handler pattern for URL fetching sample. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_shell.py | Updates permission imports/handler pattern for shell sample. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_session.py | Simplifies permission handler usage for session samples. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_multiple_permissions.py | Updates permission imports/handler pattern for multi-permission sample. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_mcp.py | Updates permission imports/handler pattern for MCP sample. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_instruction_directories.py | Updates permission imports/handler pattern for instruction-directory sample. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_function_approval.py | Adapts function-approval sample to async prompting and adds permission handler. |
| python/samples/02-agents/providers/github_copilot/github_copilot_with_file_operations.py | Updates file-permission sample handler implementation for new decision types. |
| python/samples/02-agents/providers/github_copilot/github_copilot_basic.py | Simplifies permission handler usage for basic sample. |
| python/packages/github_copilot/tests/test_github_copilot_agent.py | Updates imports + asserts CopilotClient is constructed via kwargs and new decision types. |
| python/packages/github_copilot/pyproject.toml | Updates dependency constraint to github-copilot-sdk>=1.0.0,<2. |
| python/packages/github_copilot/agent_framework_github_copilot/_agent.py | Refactors settings/env var + client construction for SDK v1.0.0 API. |
There was a problem hiding this comment.
Automated Code Review
Reviewers: 4 | Confidence: 86%
✓ Correctness
Clean SDK upgrade from github-copilot-sdk 1.0.0b2 to 1.0.0. All changes are internally consistent: import paths updated, SubprocessConfig correctly replaced with RuntimeConnection.for_stdio + CopilotClient kwargs, copilot_home→base_directory rename is consistent across TypedDict, init, start(), and env var mapping via load_settings. The default deny handler correctly returns PermissionDecisionUserNotAvailable(). No correctness issues found.
✓ Security Reliability
This PR is a clean SDK upgrade from github-copilot-sdk 1.0.0b2 to 1.0.0. The security posture is maintained: the default permission handler still denies all requests (using PermissionDecisionUserNotAvailable which matches the SDK's own fallback behavior). The migration to asyncio.to_thread for interactive input in samples correctly prevents event loop blocking. No injection risks, secrets exposure, resource leaks, or unhandled failure modes were identified. The client construction changes properly gate optional kwargs behind truthiness checks, and the settings loader correctly maps GITHUB_COPILOT_BASE_DIRECTORY via the env_prefix mechanism.
✓ Test Coverage
The PR correctly adapts to the github-copilot-sdk 1.0.0 API changes with corresponding test updates. The main test coverage gap is that the behavioral change in
_deny_all_permissions(now returningPermissionDecisionUserNotAvailable()instead ofPermissionRequestResult()) has no test asserting the actual return value. The existing testtest_session_config_uses_deny_all_when_no_permission_handler_setonly verifies the handler is assigned, not what it returns when invoked.
✓ Design Approach
I found one design-level mismatch: the PR updates
github_copilot_with_file_operations.pyto use an async permission callback, but the package still exposeson_permission_requestas a synchronous callback in its public contract and forwards it unchanged into session creation. That makes the sample demonstrate an API shape the framework itself does not yet promise to consumers.
Suggestions
- If async permission handlers are now part of the supported SDK migration path, widen the framework contract to match (
PermissionHandlerTypeandGitHubCopilotOptions.on_permission_requestdocs/types inpython/packages/github_copilot/agent_framework_github_copilot/_agent.py) rather than only changing the sample.
Automated review by giles17's agents
- Shell sample: only approve kind='shell', deny others - URL sample: only approve kind='url', deny others - Use getattr() for kind-specific attributes to satisfy pyright - Widen PermissionHandlerType to accept async handlers (matches SDK) - Add test for _deny_all_permissions return value Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update scripts/sample_validation/create_dynamic_workflow_executor.py to use copilot.session_events imports and PermissionHandler.approve_all - Assert isinstance(result, PermissionDecisionUserNotAvailable) instead of stringly-typed kind check Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 6 integration tests mirroring .NET coverage: - Basic non-streaming response - Streaming response - Function tool invocation - Session context (multi-turn) - Session resume by ID - Shell command execution Tests require COPILOT_GITHUB_TOKEN env var (skipped otherwise). Each test cleans up its Copilot session via delete_session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
moonbox3
left a comment
There was a problem hiding this comment.
Shall we also make sure to update this doc with these breaking changes? https://learn.microsoft.com/en-us/agent-framework/support/upgrade/python-2026-significant-changes
Changes
Upgrades
agent-framework-github-copilotfromgithub-copilot-sdk1.0.0b2 to the stable 1.0.0 release, adapting to all breaking API changes introduced in the GA version.Source (
_agent.py)RuntimeConnection.for_stdio(path=...)+CopilotClientkwargs (connection,log_level,base_directory)copilot.generated.session_eventstocopilot.session_eventscopilot_hometobase_directory(env:GITHUB_COPILOT_BASE_DIRECTORY)PermissionDecisionUserNotAvailable()(matching SDK fallback behavior)Tests
PermissionDecisionApproveOnce,PermissionDecisionDeniedInteractivelyByUser)Samples
PermissionHandler.approve_allor syncapprove_and_logpattern (v1.0.0 protocol v3 dispatches permission requests viaasyncio.ensure_future, making blockinginput()incompatible)asyncio.to_threadfor interactive promptsBreaking changes for consumers
GITHUB_COPILOT_COPILOT_HOMEenv var renamed toGITHUB_COPILOT_BASE_DIRECTORYcopilot_homeoption renamed tobase_directoryinGitHubCopilotSettingsanddefault_options