Repository navigation
fix(install): preserve existing binary when installation fails - #5684
Open
harshvarudkar wants to merge 2 commits into
Open
harshvarudkar wants to merge 2 commits into
harshvarudkar wants to merge 2 commits into
Conversation
harshvarudkar
requested review from
a team
and
an adaptive review from Copilot
December 5, 2026 17:57
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The workflow passes tests/install.sh as an argument to install.sh, leaving the test script unchecked; each script needs a separate bash -n invocation.
1 open issue
What changed in this PR
Protects existing Copilot CLI installations by staging and validating replacements before an atomic rename.
Changes:
- Adds staging cleanup, executable validation, and directory-destination rejection.
- Adds 15 offline regression cases covering successful installs and failure recovery.
- Adds path-filtered Linux and macOS CI checks.
| File | Description |
|---|---|
tests/install.sh |
Adds offline installer regression tests. |
install.sh |
Stages replacements to preserve existing binaries on failure. |
.github/workflows/test-install.yml |
Runs syntax checks and regression tests on Linux and macOS. |
Review effort: Balanced (adaptive)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

An interrupted or failed archive extraction currently overwrites
$PREFIX/bin/copilotin place, replacing a working installation with a partial executable.Stage the replacement in a temporary directory on the destination filesystem, check that it is a non-empty regular file, and set its executable permissions before renaming it into place. Clean up the staging directory on exit. Reject directory destinations, including symlinks to directories, so
mvcannot silently install inside them.Adds 15 offline regression cases covering extraction failure and termination, permission and rename failures, staging-directory creation failure, invalid archive contents, fresh installs, upgrades, paths containing spaces, and existing symlink/directory destinations. The tests use local fixtures and do not download or run Copilot. A path-filtered workflow runs the suite on Linux and macOS.
Validation:
previous executable was changed.git diff --checkpassed.