-
Notifications
You must be signed in to change notification settings - Fork 9
Edburns/dd 2984436 make copilot cli versions consistent #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
edburns
merged 4 commits into
main
from
edburns/dd-2984436-make-copilot-cli-versions-consistent
Apr 30, 2026
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
477398e
Pin Copilot CLI version across all CI paths via pom.xml
edburns 227a563
On branch edburns/dd-2984436-make-copilot-cli-versions-consistent
edburns 1461106
Address review comments: node exit 0, pin setup-node SHA, update comm…
Copilot d1b7091
Skip CLI npm ci when tests are skipped
edburns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Pin Copilot CLI version across all CI paths via pom.xml
Previously, three different code paths determined the Copilot CLI version
inconsistently:
- Path A (build-test.yml) installed the CLI from the cloned reference impl
pinned by .lastmerge — reproducible.
- Path B (run-smoke-test.yml, update-copilot-dependency.yml via the
setup-copilot action) ran `npm install -g @github/copilot` with no
version pin — floated to whatever was latest on npm.
- Path C (local dev) fell through to whatever `copilot` was on PATH
(often whatever VS Code Insiders had installed).
When the CLI protocol vocabulary changed between 1.0.35 and 1.0.39, this
inconsistency made it hard to land reference-impl merges that required a
specific CLI version.
This change makes pom.xml the single source of truth for the
@github/copilot version that all paths must use, while keeping .lastmerge
as the source of truth for the reference implementation commit.
Changes:
- pom.xml: replace the PRIMER_TO_REPLACE placeholder in the property
<readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync>
with the current value (^1.0.36-0) extracted from the cloned
reference impl's nodejs/package.json. Add a doc-comment explaining
that the property is auto-managed and is the canonical CLI version
for all CI paths.
- .github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh
(new): reads dependencies."@github/copilot" from the reference impl's
nodejs/package.json (via node) and rewrites the pom.xml property in
place. Locates the repo root by walking up from the script's own
location until it finds a pom.xml, so it is resilient to relocation
and works from any CWD. Uses portable sed for the rewrite.
- .github/scripts/reference-impl-sync/merge-reference-impl-finish.sh:
call the new sync script right after writing .lastmerge, and stage
pom.xml alongside .lastmerge in the same commit. .lastmerge and the
CLI version property now always move together.
- .github/actions/setup-copilot/action.yml: read the pinned version from
pom.xml using sed and run `npm install -g "@github/copilot@VERSION"`
instead of installing the latest. Fail fast if the property is unset
or still the primer. Expose the resolved version as an action output.
- CONTRIBUTING.md: document the local-dev workflow that mirrors what
build-test.yml does in CI. The cloned reference impl contains two
separate package.json files that both pin @github/copilot:
* target/copilot-sdk/nodejs/package.json (^1.0.36-0) — the SDK-test
pin; this is the CLI the tests must run against.
* target/copilot-sdk/test/harness/package.json (^1.0.32) — the
replay-harness pin; incidental, NOT the CLI under test.
`mvn generate-test-resources` runs `npm install` only in the harness
subtree, so a generic `find target -path '*/@github/copilot/index.js'`
picks the wrong (older) copy. The instructions now:
1. Run `npm ci` in target/copilot-sdk/nodejs/ explicitly.
2. Scope the COPILOT_CLI_PATH lookup to '*/nodejs/node_modules/...'
so the harness copy can never be selected, even if both are
present. Both POSIX (find) and PowerShell (Get-ChildItem) forms
are tightened.
- .gitignore: minor housekeeping.
Verified mvn clean package -Pskip-test-harness -DskipTests succeeds with
the new POM, the sync script correctly rewrites the property when invoked
from any CWD, and the tightened CONTRIBUTING.md sequence resolves
COPILOT_CLI_PATH to the 1.0.36-0 CLI under target/copilot-sdk/nodejs.- Loading branch information
commit 477398ee61e47bf47d2b1e5f01959abba8951695
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| #!/usr/bin/env bash | ||
| # ────────────────────────────────────────────────────────────── | ||
| # sync-cli-version-from-reference-impl.sh | ||
| # | ||
| # Reads the @github/copilot version specifier from the cloned | ||
| # reference implementation's nodejs/package.json, and updates the | ||
| # corresponding property in pom.xml: | ||
| # | ||
| # <readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync> | ||
| # | ||
| # This keeps the canonical Copilot CLI version (declared in pom.xml) | ||
| # in sync with whatever the reference implementation pinned in | ||
| # .lastmerge depends on. All workflows that install the Copilot CLI | ||
| # (build-test.yml — implicitly via cloned SDK, run-smoke-test.yml and | ||
| # update-copilot-dependency.yml — via the setup-copilot action) read | ||
| # this single property so every CI path uses the same CLI version. | ||
| # | ||
| # Usage: | ||
| # ./sync-cli-version-from-reference-impl.sh <reference-impl-dir> | ||
| # | ||
| # Or, when invoked from merge-reference-impl-finish.sh, sources | ||
| # REFERENCE_IMPL_DIR from the .merge-env file. | ||
| # ────────────────────────────────────────────────────────────── | ||
| set -euo pipefail | ||
|
|
||
| # Locate the repo root by walking up from this script until we find a pom.xml. | ||
| # This is resilient to the script being moved to a different depth under | ||
| # .github/scripts/ in the future. | ||
| find_repo_root() { | ||
| local dir | ||
| dir="$(cd "$(dirname "$0")" && pwd)" | ||
| while [[ "$dir" != "/" ]]; do | ||
| if [[ -f "$dir/pom.xml" ]]; then | ||
| echo "$dir" | ||
| return 0 | ||
| fi | ||
| dir="$(dirname "$dir")" | ||
| done | ||
| echo "❌ Could not locate repo root (no pom.xml found above $(dirname "$0"))" >&2 | ||
| return 1 | ||
| } | ||
| ROOT_DIR="$(find_repo_root)" | ||
|
|
||
| REFERENCE_IMPL_DIR="${1:-${REFERENCE_IMPL_DIR:-}}" | ||
| if [[ -z "$REFERENCE_IMPL_DIR" ]]; then | ||
| echo "❌ Usage: $0 <reference-impl-dir>" >&2 | ||
| echo " or set REFERENCE_IMPL_DIR in the environment." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| PKG_JSON="$REFERENCE_IMPL_DIR/nodejs/package.json" | ||
| if [[ ! -f "$PKG_JSON" ]]; then | ||
| echo "❌ Cannot find $PKG_JSON" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # node is always available since the reference implementation uses npm. | ||
| CLI_VERSION=$(node -e \ | ||
| "const fs=require('fs');const p=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const v=(p.dependencies&&p.dependencies['@github/copilot'])||(p.devDependencies&&p.devDependencies['@github/copilot']);if(!v){process.exit(2);}process.stdout.write(v);" \ | ||
|
edburns marked this conversation as resolved.
Outdated
|
||
| "$PKG_JSON") | ||
|
edburns marked this conversation as resolved.
|
||
|
|
||
| if [[ -z "$CLI_VERSION" ]]; then | ||
| echo "❌ Could not extract @github/copilot version from $PKG_JSON" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| POM="$ROOT_DIR/pom.xml" | ||
| PROP="readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-weekly-reference-impl-sync" | ||
|
|
||
| if ! grep -q "<${PROP}>" "$POM"; then | ||
| echo "❌ Property <${PROP}> not found in $POM" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Use a portable sed invocation (works on both BSD/macOS and GNU/Linux). | ||
| TMP="$(mktemp)" | ||
| sed -E "s|<${PROP}>[^<]*</${PROP}>|<${PROP}>${CLI_VERSION}</${PROP}>|" "$POM" > "$TMP" | ||
| mv "$TMP" "$POM" | ||
|
|
||
| echo "▸ Updated pom.xml: <${PROP}> = ${CLI_VERSION}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,4 @@ changebundle.txt* | |
| .settings | ||
| scripts/codegen/node_modules/ | ||
| *~ | ||
| *.sln | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.