Skip to content

Fix CopilotCliRunner version parsing for 'GitHub Copilot CLI X.X.X' format#14568

Merged
mitchdenny merged 2 commits intorelease/13.2from
fix/copilot-cli-version-parsing
Feb 20, 2026
Merged

Fix CopilotCliRunner version parsing for 'GitHub Copilot CLI X.X.X' format#14568
mitchdenny merged 2 commits intorelease/13.2from
fix/copilot-cli-version-parsing

Conversation

@mitchdenny
Copy link
Member

Summary

Fix aspire mcp init failing to detect GitHub Copilot CLI due to a version parsing issue. The Copilot CLI now outputs GitHub Copilot CLI 0.0.397 but the parser only handled raw version strings or v-prefixed versions.

Changes

  • Extract version parsing into a testable TryParseVersionOutput static method
  • Handle prefixed version strings by extracting the last space-separated token before parsing
  • Add 11 unit tests covering the prefixed format, raw versions, v-prefix, multiline output, whitespace, and invalid inputs

Fixes #14174

…ormat

Extract version parsing into a testable TryParseVersionOutput method
that handles prefixed version strings like 'GitHub Copilot CLI 0.0.397'
by taking the last space-separated token before parsing.

Fixes #14174

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 19, 2026 05:07
@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14568

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14568"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes aspire mcp init failing to detect an installed GitHub Copilot CLI by making version parsing handle the newer GitHub Copilot CLI X.Y.Z output format, and by extracting the parsing logic into a unit-testable helper.

Changes:

  • Refactors Copilot CLI version parsing into CopilotCliRunner.TryParseVersionOutput.
  • Updates parsing to support prefixed version lines by extracting the last space-separated token.
  • Adds unit tests covering common valid/invalid version output variations (including multiline and whitespace).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Aspire.Cli/Agents/CopilotCli/CopilotCliRunner.cs Introduces TryParseVersionOutput and uses it in GetVersionAsync to parse prefixed version output.
tests/Aspire.Cli.Tests/Agents/CopilotCliRunnerTests.cs Adds theory-based tests for parsing raw, v-prefixed, and prefixed Copilot CLI version strings.

Trim trailing period and other punctuation before parsing, to handle
output like 'GitHub Copilot CLI 0.0.397.' from the issue report.
Add test case for the trailing period format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 51f6420:

Test Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
ResourcesCommandShowsRunningResources ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22169730822

@mitchdenny mitchdenny merged commit 1dcab16 into release/13.2 Feb 20, 2026
343 checks passed
@mitchdenny mitchdenny deleted the fix/copilot-cli-version-parsing branch February 20, 2026 00:49
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 20, 2026
joperezr added a commit that referenced this pull request Feb 21, 2026
* Fix CopilotCliRunner version parsing for 'GitHub Copilot CLI X.X.X' format (#14568)

* Fix CopilotCliRunner version parsing for 'GitHub Copilot CLI X.X.X' format

Extract version parsing into a testable TryParseVersionOutput method
that handles prefixed version strings like 'GitHub Copilot CLI 0.0.397'
by taking the last space-separated token before parsing.

Fixes #14174

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR feedback: handle trailing punctuation in version string

Trim trailing period and other punctuation before parsing, to handle
output like 'GitHub Copilot CLI 0.0.397.' from the issue report.
Add test case for the trailing period format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Suppress update notification when running with --detach (#14571)

* Suppress update notification when running with --detach

When running 'aspire run --detach', the parent process no longer
displays the update notification message before exiting. The update
check is not useful in detach mode since the parent exits immediately
after spawning the child process.

Fixes part of #14238

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add unit tests for update notification suppression in detach mode

Validates that the update notification is not shown when --detach is
used, and that it is shown for normal (non-detach) runs. Uses a
tracking ICliUpdateNotifier to verify the behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Move TestCliUpdateNotifier to shared TestServices folder

Consolidate duplicate ICliUpdateNotifier test implementations from
RunCommandTests and UpdateCommandTests into a single shared
TestCliUpdateNotifier in TestServices, combining tracking and
callback capabilities.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add ACA deployment E2E tests for custom and existing ACR (#14510)

* Add ACA deployment E2E tests for custom and existing ACR

Add two new deployment E2E tests:

- AcaCustomRegistryDeploymentTests: Deploys a starter app to ACA using
  AddAzureContainerRegistry + WithAzureContainerRegistry to create and
  attach a custom registry instead of relying on the default ACR.

- AcaExistingRegistryDeploymentTests: Pre-creates an ACR via az CLI,
  then deploys a starter app to ACA referencing the existing ACR via
  AsExisting() with parameters.

Both tests follow the established AcaStarterDeploymentTests pattern
with Hex1b terminal automation, endpoint verification, and cleanup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix deployment test failures

- Custom Registry: Increase deploy wait to 35 min, detect PIPELINE FAILED
  to fail fast instead of timing out, bump test timeout to 45 min
- Existing Registry: Use null for resourceGroup param in AsExisting()
  since ACR is in the same resource group as the deployment, avoiding
  cross-RG Bicep scope that caused compilation errors. Add same pipeline
  failure detection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Verify container images exist in ACR after deployment

Replace simple ACR existence checks with comprehensive image verification:
- Discover the ACR name in the resource group
- List all repositories in the ACR
- Verify each repository has at least one tagged image
- Fail the test if no images are found

This ensures the deployment actually pushed container images to the
custom/existing registry, not just that the ACR resource exists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix misleading comment: recordings are uploaded for all tests

The comment said 'only for failed tests' but the code uploads
recordings for all tests regardless of pass/fail status.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix NU1009 error for CPM projects during aspire update (#14585)

* Fix NU1009 error for CPM projects during aspire update

When a project uses Central Package Management (CPM) and has a
PackageVersion entry for Aspire.Hosting.AppHost in Directory.Packages.props,
running 'aspire update' would leave the PackageVersion orphaned after
removing the PackageReference from the csproj. The new SDK format adds an
implicit PackageReference with IsImplicitlyDefined=true, and NuGet rejects
PackageVersion entries for implicitly-defined packages (NU1009).

The fix removes the orphaned PackageVersion entry from
Directory.Packages.props during the SDK migration in aspire update.

Fixes #14550

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Handle NuGet.config prompts in CPM e2e test

The aspire update flow prompts for NuGet.config directory and confirmation
when the project doesn't have an existing NuGet.config. The test now handles
both prompts by accepting the defaults.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update external NuGet dependencies to latest versions (#14549)

* Update external NuGet dependencies and enhance dependency update skill

Update 38 external dependencies to their latest versions:
- Confluent.Kafka 2.12.0 -> 2.13.0
- Google.Protobuf 3.33.0 -> 3.33.5
- Grpc.AspNetCore/ClientFactory 2.71.0 -> 2.76.0
- Grpc.Tools 2.72.0 -> 2.78.0
- Hex1b/McpServer/Tool 0.78.0 -> 0.90.0
- Humanizer.Core 2.14.1 -> 3.0.1
- JsonPatch.Net 3.3.0 -> 5.0.0
- KubernetesClient 18.0.5 -> 18.0.13
- Markdig 0.43.0 -> 0.45.0
- Microsoft.Data.SqlClient 6.1.2 -> 6.1.4
- Microsoft.DevTunnels.Connections 1.3.6 -> 1.3.12
- Microsoft.FluentUI.AspNetCore.Components 4.13.2 -> 4.14.0
- ModelContextProtocol 0.4.0-preview.3 -> 0.8.0-preview.1
- MongoDB.Driver 3.5.0 -> 3.6.0
- MongoDB.Driver.Core.Extensions.DiagnosticSources 2.1.0 -> 3.0.0
- MySqlConnector.DependencyInjection 2.4.0 -> 2.5.0
- NATS.Net 2.6.11 -> 2.7.2
- Npgsql.DependencyInjection/OpenTelemetry 10.0.0 -> 10.0.1
- OpenAI 2.7.0 -> 2.8.0
- OpenTelemetry.Exporter.Console/InMemory 1.14.0 -> 1.15.0
- OpenTelemetry.Instrumentation.GrpcNetClient 1.14.0-beta.1 -> 1.15.0-beta.1
- Oracle.ManagedDataAccess.OpenTelemetry 23.26.0 -> 23.26.100
- Polly.Core/Extensions 8.6.4 -> 8.6.5
- Pomelo.EntityFrameworkCore.MySql 8.0.3 -> 9.0.0
- Qdrant.Client 1.15.1 -> 1.16.1
- RabbitMQ.Client 7.1.2 -> 7.2.0
- Spectre.Console 0.52.1-preview.0.5 -> 0.54.1-alpha.0.37
- StackExchange.Redis 2.9.32 -> 2.11.0
- StreamJsonRpc 2.22.23 -> 2.24.84
- System.IO.Hashing 9.0.10 -> 10.0.3

Move Microsoft.Extensions.Caching.Memory to the common section
(no longer TFM-conditional) to support Pomelo 9.0.0's transitive
dependency on it.

Also enhance the dependency-update skill with:
- Bulk update workflow (update-then-verify-then-mirror)
- Transitive pinning conflict guidance (NU1109)
- Broken transitive dep metadata guidance (NU1603)
- Known special-handling packages
- Azure CLI fallback for Windows (az.cmd)
- Hex1b.Tool added to package family list

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix build errors from dependency updates

- MCP SDK 0.8.0: Convert IDictionary to Dictionary for IReadOnlyDictionary
  compatibility in AgentMcpCommand.cs, suppress MCPEXP001 experimental warning
- Humanizer 3.0: Fully qualify Resources references in ResourceDetails.razor
  to avoid ambiguity with Humanizer.Resources namespace
- MySqlConnector 2.5.0: Migrate from obsolete MySqlConnectorLogManager.Provider
  to DbContextOptionsBuilder.UseLoggerFactory(), remove unused
  MySqlConnector.Logging.Microsoft.Extensions.Logging package reference
- RabbitMQ.Client 7.2.0: Suppress SYSLIB0026/0027/0028 warnings from
  source-generated configuration binder code touching obsolete X509Certificate2
  APIs, regenerate ConfigurationSchema.json
- FluentUI 4.14.0: Implement new IMessageService.ShowMessageBar/Async
  MarkupString overloads in test mock
- Revert OpenAI to 2.7.0 (needs coordinated update with
  Microsoft.Extensions.AI.OpenAI)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix test failures from dependency updates

- Revert JsonPatch.Net to 3.3.0: Updating to 5.0.0 caused TypeLoadException
  due to incompatible JsonPointer.Net value type change vs pinned
  JsonSchema.Net 7.4.0. Both packages need to be updated together in a
  separate PR.
- Update Microsoft.Azure.StackExchangeRedis 3.2.1 -> 3.3.1 and
  Microsoft.Extensions.Azure 1.13.0 -> 1.13.1: Required for
  StackExchange.Redis 2.11.0 compatibility. The AMR refactor split
  Azure auth into AzureManagedRedisOptionsProvider; updated tests to
  check for the new type instead of IAzureCacheTokenEvents.
- Revert Pomelo MySqlConnector logging to MySqlConnectorLogManager.Provider
  with #pragma CS0618 suppression: UseLoggerFactory only configures EF Core
  logging, not MySqlConnector's internal categories (ConnectionPool, etc.).
  There is no non-obsolete alternative when using Pomelo without
  MySqlDataSource.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Exclude incompatible analyzers from transitive flow to consuming projects

Humanizer.Core 3.x and StreamJsonRpc 2.24.x ship Roslyn analyzers that
are incompatible with older SDK versions (net8):
- Humanizer.Analyzers requires System.Collections.Immutable 9.0.0 (CS8032)
- StreamJsonRpc.Analyzers targets Roslyn 4.14.0 (CS9057)

These analyzers flow transitively to template projects, causing build
failures when template tests verify backward compatibility with older SDKs.

Add PrivateAssets="analyzers" to prevent these analyzers from flowing to
consuming projects while keeping them available for our own builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert Humanizer.Core and StreamJsonRpc to previous versions

Humanizer.Core 3.0.1 and StreamJsonRpc 2.24.84 ship Roslyn analyzers
that are incompatible with older SDKs (net8) used by template tests:
- Humanizer.Analyzers requires System.Collections.Immutable 9.0.0 (CS8032)
- StreamJsonRpc.Analyzers targets Roslyn 4.14.0 (CS9057)

PrivateAssets="analyzers" does not prevent these from flowing to
template projects since the analyzers are resolved from the NuGet package
cache at build time. Reverting to compatible versions:
- Humanizer.Core: 3.0.1 -> 2.14.1
- StreamJsonRpc: 2.24.84 -> 2.22.23

Also reverts the Humanizer namespace ambiguity fix in ResourceDetails.razor
since 2.14.1 does not introduce the Humanizer.Resources collision.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert Spectre.Console to 0.52.1-preview.0.5

Spectre.Console 0.54.1-alpha.0.37 changed hyperlink rendering behavior:
the [link=url] markup no longer emits ANSI OSC 8 hyperlink escape
sequences in the same way, breaking the ConsoleActivityLoggerTests
that verify clickable link rendering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix up RabbitMQ

* Fix Azure Redis break from StackExchange/StackExchange.Redis#2986

The Azure Managed Redis endpoints were split out into another class, so we need to check both classes.

* Alphabetize Caching.Memory and update remaining OTel packages to 1.15.0

- Move Microsoft.Extensions.Caching.Memory to alphabetical position
  in the common section of Directory.Packages.props
- Update OpenTelemetry version properties in eng/Versions.props:
  - Instrumentation.AspNetCore: 1.14.0 -> 1.15.0
  - Instrumentation.Http: 1.14.0 -> 1.15.0
  - Extensions.Hosting: 1.14.0 -> 1.15.0
  - Instrumentation.Runtime: 1.14.0 -> 1.15.0
  - Exporter.OpenTelemetryProtocol: 1.14.0 -> 1.15.0
  - Azure.Monitor.OpenTelemetry.Exporter: 1.5.0 -> 1.6.0
- Regenerate Aspire.Seq ConfigurationSchema.json for OTel changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert Azure.Monitor.OpenTelemetry.Exporter update due to AOT warning

* Update dependency skill to document OTel packages in eng/Versions.props

- Document that OTel packages are split across Directory.Packages.props
  (hardcoded versions) and eng/Versions.props (MSBuild properties), and
  both must be updated together to keep OTel in sync
- Add guidance to check eng/Versions.props when identifying packages
- Add Humanizer.Core, StreamJsonRpc, and Azure.Monitor.OpenTelemetry.Exporter
  to the special handling section with upstream issue links

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>

* Update container image tags to latest versions (#14555)

* Update container image tags to latest versions

Update 17 Docker container image tags across 12 hosting integrations:

- EventHubs Emulator: 2.1.0 → 2.2.0
- ServiceBus SQL Server: 2022-latest → 2025-latest
- Kafka (Confluent): 8.1.0 → 8.1.1
- Kafka UI: v1.3.0 → v1.4.2
- Keycloak: 26.4 → 26.5
- Milvus: v2.5.17 → v2.5.27
- MySQL: 9.5 → 9.6
- Oracle: 23.26.0.0 → 23.26.1.0
- Postgres: 17.6 → 18.2
- pgAdmin: 9.9.0 → 9.12.0
- pgWeb: 0.16.2 → 0.17.0
- Qdrant: v1.15.5 → v1.16.3
- Redis: 8.2 → 8.6
- RedisInsight: 2.70 → 3.0
- SQL Server: 2022-latest → 2025-latest
- YARP: 2.3.0-preview.4 → 2.3.0-preview.5

Also adds an agent skill (.github/skills/update-container-images/) with
a companion C# script to automate future container image tag updates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix test snapshots and Postgres test assumptions for updated image tags

- Update 5 YARP snapshot files: 2.3.0-preview.4 → 2.3.0-preview.5
- Update aspire-manifest.json: 2022-latest → 2025-latest
- Fix Postgres v17 data path tests to explicitly set v17 image tag
  since the default image is now v18

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix hardcoded YARP tag in Dockerfile assertion test

Update Assert.Contains for YARP image tag: 2.3.0-preview.4 → 2.3.0-preview.5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR feedback: revert SQL Server, Postgres, and use rolling YARP tag

- Revert SQL Server back to 2022-latest (Mac ARM incompatibility)
- Revert Postgres back to 17.6 (data checksums concern, will do separately)
- Change YARP to rolling tag 2.3-preview instead of pinned 2.3.0-preview.5
- Update all affected test snapshots and assertions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Document stdout/stderr conventions in UpdateImageTags.cs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <midenn@microsoft.com>
Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Copilot AI pushed a commit that referenced this pull request Mar 10, 2026
…ormat (#14568)

* Fix CopilotCliRunner version parsing for 'GitHub Copilot CLI X.X.X' format

Extract version parsing into a testable TryParseVersionOutput method
that handles prefixed version strings like 'GitHub Copilot CLI 0.0.397'
by taking the last space-separated token before parsing.

Fixes #14174

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR feedback: handle trailing punctuation in version string

Trim trailing period and other punctuation before parsing, to handle
output like 'GitHub Copilot CLI 0.0.397.' from the issue report.
Add test case for the trailing period format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aspire mcp init fails to detect GitHub Copilot CLI due to version parsing issue

3 participants