Skip to content

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

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/copilot-cli-fix-prerelease-tag-sort
Open

fix(copilot-cli): use semver sort for prerelease tag resolution#1657
Copilot wants to merge 5 commits into
mainfrom
copilot/copilot-cli-fix-prerelease-tag-sort

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

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
Copilot AI requested a review from Kaniska244 May 19, 2026 15:55
@Kaniska244 Kaniska244 marked this pull request as ready for review May 19, 2026 16:00
@Kaniska244 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.
Copilot AI requested a review from Kaniska244 May 21, 2026 11:41
@Kaniska244 Kaniska244 requested a review from abdurriq May 21, 2026 12:12
Comment on lines +12 to +14
| awk '{print $2}' | sed 's|refs/tags/||' \
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$' \
| sort -V | tail -n1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My intention was that we test just this part (without the git part to simplify tests), and also without rewriting the function. Happy to approve to unblock this but would appreciate if we can have this as a follow-up.

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