Skip to content

fix(copilot-cli): use semver sort for prerelease tag resolution - #1657

Merged
Abdurrahmaan Iqbal (abdurriq) merged 7 commits into
mainfrom
copilot/copilot-cli-fix-prerelease-tag-sort
May 22, 2026
Merged

fix(copilot-cli): use semver sort for prerelease tag resolution#1657
Abdurrahmaan Iqbal (abdurriq) merged 7 commits into
mainfrom
copilot/copilot-cli-fix-prerelease-tag-sort

Conversation

Copilot AI commented May 19, 2026

Copy link
Copy Markdown
Contributor

The prerelease channel resolves the install candidate via git ls-remote --tags | tail -1, which sorts alphabetically. This picks v1.0.9 over v1.0.45 because "9" > "4" lexicographically.

Fix: Replace the alphabetic tail with a version-sorted pipeline:

git ls-remote --tags https://github.com/github/copilot-cli \
  | awk '{print $2}' | sed 's|refs/tags/||' \
  | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?' \
  | sort -V | tail -n1
  • Filter to well-formed vX.Y.Z[-N] tags (excludes stray refs)
  • Sort with sort -V (version sort) instead of relying on git's lexicographic order
  • Bump feature version 1.1.21.1.3

Copilot AI changed the title [WIP] Fix prerelease channel to sort tags by version fix(copilot-cli): use semver sort for prerelease tag resolution May 19, 2026
@Kaniska244
Kaniska (Kaniska244) marked this pull request as ready for review May 19, 2026 16:00
@Kaniska244
Kaniska (Kaniska244) requested a review from a team as a code owner May 19, 2026 16:00
Comment thread src/copilot-cli/install.sh Outdated
@Kaniska244

Copy link
Copy Markdown
Contributor

Copilot Check this review comment #1657 (comment)

…d add test

Extract the prerelease tag resolution logic into a standalone
resolve_prerelease_version() function that can read from stdin for
testing. Add a scenario test that validates version sorting with mock
git ls-remote data to prevent regressions.
Comment thread src/copilot-cli/install.sh Outdated
Remove the stdin/cat fallback and use ${1:?} to error if no URL is
provided. Update the test to mock git via PATH instead of piping stdin.
Comment thread test/copilot-cli/resolve_prerelease_version.sh
@abdurriq
Abdurrahmaan Iqbal (abdurriq) merged commit 8bd6ad7 into main May 22, 2026
15 checks passed
@abdurriq
Abdurrahmaan Iqbal (abdurriq) deleted the copilot/copilot-cli-fix-prerelease-tag-sort branch May 22, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copilot-cli: prerelease channel uses alphabetic tag sort, resolves to v1.0.9 instead of latest

3 participants