Skip to content

Commit 667271b

Browse files
authored
deps: upgrade Microsoft.Agents.AI.GitHub.Copilot to 1.14.0-rc1 + GitHub.Copilot.SDK to 1.0.7 (#1519)
Upgrades Microsoft.Agents.AI.GitHub.Copilot from 1.11.0-rc1 to 1.14.0-rc1 and the direct GitHub.Copilot.SDK reference from 1.0.3 to 1.0.7 in src/Squad.Agents.AI/Squad.Agents.AI.csproj, together, since 1.14.0-rc1 requires GitHub.Copilot.SDK >= 1.0.5. Supersedes the SDK only Dependabot PR #1508. Fixes transitive native Copilot CLI payload propagation: Microsoft.Agents.AI.GitHub.Copilot ships GitHub.Copilot.SDK's CLI download build/ targets to transitive consumers via a buildTransitive bridge that otherwise resolves the SDK version the adapter itself was packed against (1.0.5, CLI 1.0.67) rather than the version this repo references (1.0.7, CLI 1.0.71). New Directory.Build.props and a generated buildTransitive/Squad.Agents.AI.props (built with System.Xml.Linq, packed into Squad.Agents.AI's own nupkg) set the documented _MicrosoftAgentsAICopilotSdkVersion override so test/Squad.Agents.AI.Tests, the sample project, and real external NuGet consumers all resolve the same CLI build as src/Squad.Agents.AI itself. Bumps Squad.Agents.AI's package version from 0.5.5 to 0.5.6-rc1, a prerelease matching the adapter's own -rc1 channel, resolving NU5104 ("stable package should not have prerelease dependency") instead of suppressing it. Adds a hermetic, cross-platform consumer packaging guard (scripts/verify-squad-agents-ai-consumer.ps1, wired into squad-agents-ai-ci.yml on ubuntu-latest and windows-latest) that packs Squad.Agents.AI, restores a scratch consumer pinned to the local nupkg via NuGet Package Source Mapping, verifies the restored package's SHA512 against the freshly packed bytes, builds for the runner's RID, and asserts the native Copilot CLI executable and runtime.node-derived library land under runtimes/*/native/ at the expected version with no stale 1.0.67 payload, without ever executing the downloaded binary. Refs #1519, #1508
1 parent c904e25 commit 667271b

5 files changed

Lines changed: 575 additions & 5 deletions

File tree

‎.github/workflows/squad-agents-ai-ci.yml‎

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- 'src/Squad.Agents.AI/**'
77
- 'test/Squad.Agents.AI.Tests/**'
88
- 'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/**'
9+
- 'scripts/verify-squad-agents-ai-consumer.ps1'
910
- '.github/workflows/squad-agents-ai-ci.yml'
1011
- 'Directory.*.props'
1112
- 'Directory.*.json'
@@ -17,6 +18,7 @@ on:
1718
- 'src/Squad.Agents.AI/**'
1819
- 'test/Squad.Agents.AI.Tests/**'
1920
- 'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/**'
21+
- 'scripts/verify-squad-agents-ai-consumer.ps1'
2022
- '.github/workflows/squad-agents-ai-ci.yml'
2123
- 'Directory.*.props'
2224
- 'Directory.*.json'
@@ -60,6 +62,50 @@ jobs:
6062
- name: Restore sample
6163
run: dotnet restore src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/Squad.Agents.AI.Sample.csproj -p:NuGetAudit=true
6264

65+
# Resolves the Copilot CLI version that GitHub.Copilot.SDK (the version this repo
66+
# actually references, $(SquadCopilotSdkVersion)) pins, straight from that package's
67+
# own build/GitHub.Copilot.SDK.props in the local NuGet cache, so the expected/
68+
# forbidden CLI versions used by the checks below never need to be hardcoded here
69+
# and can't drift out of sync with a future SDK version bump.
70+
#
71+
# CopilotCliVersion is untrusted third-party content (it comes from the
72+
# GitHub.Copilot.SDK NuGet package, not this repo), so it is validated against a
73+
# narrow version grammar before being written to $GITHUB_OUTPUT. Downstream steps
74+
# then read it via env: rather than interpolating the ${{ }} expression directly
75+
# into their run: script bodies, so a malformed or hostile value can never be
76+
# concatenated into, and executed as, PowerShell source.
77+
- name: Resolve expected Copilot CLI version
78+
id: copilot-cli-version
79+
shell: pwsh
80+
run: |
81+
# Same grammar as the version-validation guard in
82+
# scripts/verify-squad-agents-ai-consumer.ps1 (kept in sync by hand: both
83+
# accept dotted release/prerelease CLI versions such as 1.0.71 or 1.0.64-1,
84+
# single line, no surrounding whitespace).
85+
$versionGrammar = '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.]*)?$'
86+
87+
$sdkVersion = (dotnet msbuild src/Squad.Agents.AI/Squad.Agents.AI.csproj -getProperty:SquadCopilotSdkVersion -nologo).Trim()
88+
if ([string]::IsNullOrWhiteSpace($sdkVersion) -or $sdkVersion -notmatch $versionGrammar) {
89+
throw "SquadCopilotSdkVersion resolved to an empty or invalid value from Squad.Agents.AI.csproj: '$sdkVersion'."
90+
}
91+
92+
$globalPackagesOutput = dotnet nuget locals global-packages --list
93+
$nugetPackagesRoot = ($globalPackagesOutput -split ':', 2)[1].Trim()
94+
$sdkPropsPath = Join-Path $nugetPackagesRoot "github.copilot.sdk/$sdkVersion/build/GitHub.Copilot.SDK.props"
95+
if (-not (Test-Path $sdkPropsPath)) {
96+
throw "GitHub.Copilot.SDK $sdkVersion props file not found at '$sdkPropsPath'. Was the package restored yet?"
97+
}
98+
99+
[xml]$sdkProps = Get-Content $sdkPropsPath
100+
$cliVersion = "$($sdkProps.Project.PropertyGroup.CopilotCliVersion)".Trim()
101+
if ([string]::IsNullOrWhiteSpace($cliVersion) -or $cliVersion -notmatch $versionGrammar -or $cliVersion.Contains("`n")) {
102+
throw "CopilotCliVersion parsed from '$sdkPropsPath' is empty, multiline, or does not match the expected grammar ($versionGrammar): '$cliVersion'."
103+
}
104+
105+
Write-Host "GitHub.Copilot.SDK $sdkVersion pins Copilot CLI $cliVersion"
106+
echo "sdk-version=$sdkVersion" >> $env:GITHUB_OUTPUT
107+
echo "cli-version=$cliVersion" >> $env:GITHUB_OUTPUT
108+
63109
- name: Build package
64110
run: dotnet build src/Squad.Agents.AI/Squad.Agents.AI.csproj --no-restore -c Release
65111

@@ -69,12 +115,72 @@ jobs:
69115
- name: Build sample
70116
run: dotnet build src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/Squad.Agents.AI.Sample.csproj --no-restore -c Release
71117

118+
# Regression guard for Reviewer finding #1 (Squad.Agents.AI PR #1519): before the
119+
# Directory.Build.props fix, test/Squad.Agents.AI.Tests and
120+
# src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample downloaded an OLDER Copilot CLI
121+
# (pinned by whatever GitHub.Copilot.SDK version Microsoft.Agents.AI.GitHub.Copilot's
122+
# buildTransitive bridge defaults to) instead of the CLI this repo actually depends
123+
# on, because neither project has a direct PackageReference to GitHub.Copilot.SDK.
124+
- name: Verify no stale Copilot CLI payload in repo builds
125+
shell: pwsh
126+
env:
127+
EXPECTED_COPILOT_CLI_VERSION: ${{ steps.copilot-cli-version.outputs.cli-version }}
128+
run: |
129+
$versionGrammar = '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.]*)?$'
130+
$expected = $env:EXPECTED_COPILOT_CLI_VERSION
131+
if ([string]::IsNullOrWhiteSpace($expected) -or $expected -notmatch $versionGrammar) {
132+
throw "EXPECTED_COPILOT_CLI_VERSION is empty or does not match the expected grammar ($versionGrammar): '$expected'."
133+
}
134+
135+
$forbidden = @('1.0.67')
136+
$projectObjDirs = @(
137+
'src/Squad.Agents.AI/obj',
138+
'test/Squad.Agents.AI.Tests/obj',
139+
'src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample/obj'
140+
)
141+
142+
$failed = $false
143+
foreach ($objDir in $projectObjDirs) {
144+
$cliDirs = Get-ChildItem -Path $objDir -Recurse -Directory -Filter 'copilot-cli' -ErrorAction SilentlyContinue
145+
$versions = $cliDirs | ForEach-Object { Get-ChildItem -Path $_.FullName -Directory } | Select-Object -ExpandProperty Name -Unique
146+
147+
Write-Host "$objDir -> Copilot CLI version(s): $($versions -join ', ')"
148+
149+
if ($versions -notcontains $expected) {
150+
Write-Host "::error::$objDir did not download the expected Copilot CLI $expected (found: $($versions -join ', '))"
151+
$failed = $true
152+
}
153+
foreach ($bad in $forbidden) {
154+
if ($versions -contains $bad) {
155+
Write-Host "::error::$objDir downloaded forbidden stale Copilot CLI $bad"
156+
$failed = $true
157+
}
158+
}
159+
}
160+
161+
if ($failed) {
162+
throw "Stale or missing Copilot CLI payload detected, see ::error annotations above."
163+
}
164+
Write-Host "All Squad.Agents.AI-related builds resolved Copilot CLI $expected."
165+
72166
- name: Test
73167
run: dotnet test test/Squad.Agents.AI.Tests/Squad.Agents.AI.Tests.csproj --no-build -c Release --logger trx --results-directory TestResults
74168

75169
- name: Pack
76170
run: dotnet pack src/Squad.Agents.AI/Squad.Agents.AI.csproj --no-build -c Release -o nupkgs
77171

172+
# Hermetic consumer-level packaging check (Reviewer finding #1): proves the fix also
173+
# works for a REAL external NuGet consumer of Squad.Agents.AI, not just this repo's
174+
# own ProjectReference-based test/sample projects above (which Directory.Build.props
175+
# alone would cover even without the buildTransitive/Squad.Agents.AI.props fix in
176+
# Squad.Agents.AI.csproj). See scripts/verify-squad-agents-ai-consumer.ps1.
177+
- name: Verify Squad.Agents.AI consumer packaging (native Copilot CLI payload)
178+
shell: pwsh
179+
env:
180+
EXPECTED_COPILOT_CLI_VERSION: ${{ steps.copilot-cli-version.outputs.cli-version }}
181+
run: |
182+
./scripts/verify-squad-agents-ai-consumer.ps1 -NupkgsDir nupkgs -ExpectedCopilotCliVersion $env:EXPECTED_COPILOT_CLI_VERSION
183+
78184
- name: Upload test results
79185
if: always()
80186
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7

‎Directory.Build.props‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Project>
2+
<!--
3+
Repo-wide MSBuild defaults for the Squad.Agents.AI .NET package (src/Squad.Agents.AI,
4+
test/Squad.Agents.AI.Tests, src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample).
5+
This file currently only exists to fix Copilot CLI native-payload propagation; see
6+
below. It applies to every project in the repo, but today those three are the only
7+
.csproj files that exist.
8+
-->
9+
<PropertyGroup>
10+
<!--
11+
Single source of truth for the GitHub.Copilot.SDK version Squad.Agents.AI targets.
12+
Squad.Agents.AI.csproj's PackageReference uses this value, and the override right
13+
below keeps the Microsoft.Agents.AI.GitHub.Copilot native-payload bridge in sync
14+
with it, so bumping this one property is enough to move both together.
15+
-->
16+
<SquadCopilotSdkVersion>1.0.7</SquadCopilotSdkVersion>
17+
18+
<!--
19+
Why this override is required:
20+
Microsoft.Agents.AI.GitHub.Copilot ships GitHub.Copilot.SDK's CLI-download build/
21+
targets to transitive consumers via a buildTransitive/ bridge file
22+
(Microsoft.Agents.AI.GitHub.Copilot.targets), because GitHub.Copilot.SDK itself only
23+
ships those targets under build/ (which NuGet auto-imports solely for projects with
24+
a DIRECT PackageReference to it). That bridge file imports
25+
"$(NuGetPackageRoot)/github.copilot.sdk/$(_MicrosoftAgentsAICopilotSdkVersion)/build/GitHub.Copilot.SDK.targets"
26+
and, when $(_MicrosoftAgentsAICopilotSdkVersion) is unset, defaults it to the SDK
27+
version the adapter itself was packed against, its nuspec's dependency FLOOR
28+
(1.0.5 for Microsoft.Agents.AI.GitHub.Copilot 1.14.0-rc1), NOT the version this repo
29+
actually depends on ($(SquadCopilotSdkVersion), i.e. 1.0.7). Left unset, any project
30+
that pulls in the adapter WITHOUT a direct PackageReference to GitHub.Copilot.SDK
31+
(test/Squad.Agents.AI.Tests, src/Squad.Agents.AI/samples/Squad.Agents.AI.Sample here,
32+
and any real external NuGet consumer of Squad.Agents.AI) downloads and bundles the
33+
OLDER Copilot CLI build pinned to SDK 1.0.5 (Copilot CLI 1.0.67) instead of the CLI
34+
pinned to SDK 1.0.7 (Copilot CLI 1.0.71); verified against this repo's own CI logs
35+
for PR #1519 (run 29856026557): "Build package" (src/Squad.Agents.AI, which DOES have
36+
the direct PackageReference) downloaded CLI 1.0.71, while "Build tests" and
37+
"Build sample" (no direct PackageReference) downloaded CLI 1.0.67, on both
38+
ubuntu-latest and windows-latest.
39+
40+
Setting the property here (Directory.Build.props is imported before NuGet's
41+
per-project generated props/targets) makes every project in this repo resolve the
42+
SAME SDK version, and therefore the same native Copilot CLI/runtime.node payload,
43+
whether or not it has a direct PackageReference to GitHub.Copilot.SDK. This is the
44+
exact override contract Microsoft.Agents.AI.GitHub.Copilot.targets documents in its
45+
own comments ("consumers may override the SDK version path by setting
46+
$(_MicrosoftAgentsAICopilotSdkVersion) before this file is imported"), so it works
47+
regardless of NuGet's props/targets import ordering between packages: if this file's
48+
value is seen first, the adapter's own conditional default (guarded by
49+
Condition="'$(_MicrosoftAgentsAICopilotSdkVersion)' == ''") never fires; if it is
50+
seen after, Squad.Agents.AI's own packed buildTransitive/Squad.Agents.AI.props
51+
(generated at pack time from this same property, see Squad.Agents.AI.csproj)
52+
unconditionally overwrites it again for real external consumers.
53+
54+
Excluded for the Squad.Agents.AI project itself: it already gets the right SDK
55+
version via its own direct PackageReference to GitHub.Copilot.SDK (whose build/
56+
import happens unconditionally, ahead of the adapter's fallback), so setting the
57+
override there too would just make NuGet import the SAME
58+
github.copilot.sdk/$(SquadCopilotSdkVersion)/build/GitHub.Copilot.SDK.targets file
59+
twice, and MSBuild warns (MSB4011) about the resulting harmless-but-noisy duplicate
60+
import.
61+
-->
62+
<_MicrosoftAgentsAICopilotSdkVersion Condition="'$(MSBuildProjectName)' != 'Squad.Agents.AI'">$(SquadCopilotSdkVersion)</_MicrosoftAgentsAICopilotSdkVersion>
63+
</PropertyGroup>
64+
</Project>

0 commit comments

Comments
 (0)