chore: upgrade Copilot SDK to v0.3.0 and CLI to v1.0.36-0#8114
Conversation
Update all event handler code and tests to use the new SDK v0.3.0 event type constants (SessionEventType* prefix) and typed event data structs (replacing the flat copilot.Data struct with per-event types like AssistantMessageData, AssistantUsageData, etc.). Key changes: - Rename event constants: copilot.AssistantMessage -> copilot.SessionEventTypeAssistantMessage, etc. - Replace event.Data.Field access with type assertions: event.Data.(*copilot.XxxData) - Remove AssistantStreamingDelta case (SDK v0.3.0 only has TotalResponseSizeBytes, no phase/deltaContent) - Update SessionShutdown handler: TotalPremiumRequests is now a plain float64 - Update ToolExecutionComplete error handling: simplified Error struct - Guard Model assignment against empty string (now plain string, not *string) - Update PermissionRequestKind constants in types_test.go - Remove unused derefStr helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Upgrade github.com/github/copilot-sdk/go from v0.1.32 to v0.3.0 and update the bundled CLI version from 1.0.2 to 1.0.36-0. Breaking changes addressed: - MCPServerConfig changed from map[string]any to a typed interface with MCPStdioServerConfig and MCPHTTPServerConfig structs - PermissionRequestKind constants renamed (e.g. MCP -> PermissionRequestKindMcp) - PermissionRequestResult Kind field now uses typed constants - CLI version regex in tests updated to allow prerelease suffixes This addresses issue Azure#8108 where azd init Copilot Preview silently falls back from claude-opus-4.7 to claude-opus-4.6 due to the older SDK/CLI version not fully supporting newer models. Fixes Azure#8108 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Upgrades the embedded GitHub Copilot integration in azd by bumping the Copilot Go SDK to v0.3.0 and aligning the bundled Copilot CLI version, with corresponding migrations to the SDK’s updated event/data, MCP config, and permission/result APIs.
Changes:
- Migrated session event handling from the old flat
Datastruct to typed event payloads, updating display/headless collectors and gRPC conversion/tests. - Updated MCP server configuration wiring to use the SDK’s typed
MCPHTTPServerConfig/MCPStdioServerConfigand added map→typed conversion helpers. - Bumped bundled Copilot CLI pin to
v1.0.36-0and adjusted version validation tests to permit prerelease suffixes.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/internal/grpcserver/prompt_service_coverage3_test.go | Updates session-event conversion coverage tests to use new SDK event constants and typed data payloads. |
| cli/azd/internal/grpcserver/copilot_service_test.go | Updates gRPC message tests for new event types and validates event data via JSON/map round-tripping. |
| cli/azd/internal/agent/types_test.go | Updates permission kind constants used by permission/consent mapping tests. |
| cli/azd/internal/agent/headless_collector.go | Migrates headless event handling to typed event payloads and updated session lifecycle events. |
| cli/azd/internal/agent/headless_collector_test.go | Updates headless collector tests to construct typed SDK event data. |
| cli/azd/internal/agent/display.go | Migrates interactive display event handling to typed payloads and updated event type constants. |
| cli/azd/internal/agent/display_test.go | Updates usage-metrics test inputs for typed usage payloads. |
| cli/azd/internal/agent/copilot/session_config.go | Migrates MCP server configs to typed SDK configs and adds mapToMCPServerConfig + helpers. |
| cli/azd/internal/agent/copilot/session_config_test.go | Updates MCP server config assertions to use typed config structs. |
| cli/azd/internal/agent/copilot/helpers_test.go | Updates user MCP server parsing test to assert typed HTTP config. |
| cli/azd/internal/agent/copilot/copilot_sdk_e2e_test.go | Updates E2E validation to read typed assistant message payloads. |
| cli/azd/internal/agent/copilot/cli.go | Updates the pinned bundled Copilot CLI version to match SDK v0.3.0. |
| cli/azd/internal/agent/copilot/cli_test.go | Relaxes pinned CLI version regex to allow prerelease suffixes. |
| cli/azd/internal/agent/copilot_agent.go | Migrates permission kinds/results to new typed constants. |
| cli/azd/go.sum | Updates dependency checksums for Copilot SDK v0.3.0. |
| cli/azd/go.mod | Bumps Copilot SDK requirement to v0.3.0. |
| cli/azd/.vscode/cspell.yaml | Adds file-scoped spell-check allowlist entry for “MCPHTTP”. |
- Require type assertion success in E2E test to prevent silent pass - Broaden CLI version regex to support full SemVer prerelease identifiers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
Clean, mechanical SDK migration. The type switches and constant renames are consistent throughout, and the new mapToMCPServerConfig helper is well-structured.
One question about the permission result kind mapping below.
Update permission result kind mappings: - User skip (ErrToolExecutionSkipped): UserNotAvailable -> Rejected (user was consulted and actively chose to skip) - Rules deny (pre-check denial): UserNotAvailable -> Rejected (definitive policy denial, not transient unavailability) This ensures the Copilot service correctly treats these as final denials rather than retryable unavailability scenarios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
Addresses my previous feedback. The Rejected vs UserNotAvailable distinction now makes sense - Rejected for definitive denials (user skipped, explicit deny, fallthrough), UserNotAvailable for cases where the user wasn't consulted (rules blocked it) or couldn't be consulted (error). Looks good.
jongio
left a comment
There was a problem hiding this comment.
Clean SDK upgrade. Permission result kind mappings are now semantically correct after the latest fix. No issues remaining.
hemarina
left a comment
There was a problem hiding this comment.
Nice clean migration to the typed-union event model in v0.3.0 — the permission mapping refactor after @jongio's feedback is much clearer than the original. Approving the chore.
One non-blocking observation for follow-up:
🔵 Premium-request counter only updates on session.shutdown (SDK regression to track upstream)
In v0.1.32, both SessionUsageInfo and SessionShutdown carried TotalPremiumRequests, so display.go and headless_collector.go updated the counter mid-session. In v0.3.0, SessionUsageInfoData no longer exposes TotalPremiumRequests (only SessionShutdownData does), so the counter is now only refreshed once at session end.
Worth confirming this doesn't affect the per-turn telemetry path: sendMessage / sendMessageHeadless call GetUsageMetrics() immediately after WaitForIdle(), well before session.shutdown fires. If premiumRequests hasn't been populated by then, AgentResult.Usage.PremiumRequests and the cumulative a.cumulativeUsage.PremiumRequests telemetry field could read 0 for normal interactive turns even when premium requests were actually consumed.
Suggested follow-ups (not for this PR):
- Verify with a quick manual run / test whether per-turn
PremiumRequeststelemetry is actually populated post-upgrade - If it isn't, file an upstream SDK issue requesting
TotalPremiumRequestsback onSessionUsageInfoData(or another per-request usage event) - In the meantime, consider hiding the live premium-request UI element until the SDK exposes it again, so users don't see a stuck
0
Everything else looks good. 👍
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
* Migrate event system to Copilot SDK v0.3.0 typed events Update all event handler code and tests to use the new SDK v0.3.0 event type constants (SessionEventType* prefix) and typed event data structs (replacing the flat copilot.Data struct with per-event types like AssistantMessageData, AssistantUsageData, etc.). Key changes: - Rename event constants: copilot.AssistantMessage -> copilot.SessionEventTypeAssistantMessage, etc. - Replace event.Data.Field access with type assertions: event.Data.(*copilot.XxxData) - Remove AssistantStreamingDelta case (SDK v0.3.0 only has TotalResponseSizeBytes, no phase/deltaContent) - Update SessionShutdown handler: TotalPremiumRequests is now a plain float64 - Update ToolExecutionComplete error handling: simplified Error struct - Guard Model assignment against empty string (now plain string, not *string) - Update PermissionRequestKind constants in types_test.go - Remove unused derefStr helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: upgrade copilot SDK to v0.3.0 and CLI to v1.0.36-0 Upgrade github.com/github/copilot-sdk/go from v0.1.32 to v0.3.0 and update the bundled CLI version from 1.0.2 to 1.0.36-0. Breaking changes addressed: - MCPServerConfig changed from map[string]any to a typed interface with MCPStdioServerConfig and MCPHTTPServerConfig structs - PermissionRequestKind constants renamed (e.g. MCP -> PermissionRequestKindMcp) - PermissionRequestResult Kind field now uses typed constants - CLI version regex in tests updated to allow prerelease suffixes This addresses issue #8108 where azd init Copilot Preview silently falls back from claude-opus-4.7 to claude-opus-4.6 due to the older SDK/CLI version not fully supporting newer models. Fixes #8108 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: apply preflight auto-fixes (formatting, spelling) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address PR review feedback - Require type assertion success in E2E test to prevent silent pass - Broaden CLI version regex to support full SemVer prerelease identifiers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: use Rejected result kind for explicit denials Update permission result kind mappings: - User skip (ErrToolExecutionSkipped): UserNotAvailable -> Rejected (user was consulted and actively chose to skip) - Rules deny (pre-check denial): UserNotAvailable -> Rejected (definitive policy denial, not transient unavailability) This ensures the Copilot service correctly treats these as final denials rather than retryable unavailability scenarios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: therealjohn <1501196+therealjohn@users.noreply.github.com>
Summary
Upgrades the GitHub Copilot SDK from
v0.1.32tov0.3.0and the bundled Copilot CLI fromv1.0.2tov1.0.36-0.Fixes #8108
Problem
azd initwith the Copilot Preview option silently falls back fromclaude-opus-4.7toclaude-opus-4.6when using the bundled Copilot CLI. The root cause is the pinned SDK/CLI version not fully supporting newer models — the older SDK communicates with the Copilot service which silently downgrades the model, and azd has no mismatch detection.Changes
SDK Event System Migration
copilot.AssistantMessage→copilot.SessionEventTypeAssistantMessage)event.Datachanged from flat struct to typed interface — updated all consumers to use type switches/assertionsdisplay.go,headless_collector.go, and related test filesSDK Types & Permission System
MCPServerConfigchanged frommap[string]anyto interface withMCPStdioServerConfig/MCPHTTPServerConfigmapToMCPServerConfighelper for generic map→typed struct conversioncopilot.MCP→copilot.PermissionRequestKindMcp)CLI Version Update
1.0.36-0)Testing