upgrade: ignore failed shared prefetches#22091
Merged
MikeMcQuaid merged 1 commit intomainfrom Apr 26, 2026
Merged
Conversation
- keep `DownloadQueue#fetch` output and failure handling unchanged while recording whether a shared fetch failed - stop `brew upgrade` reusing prefetched downloads after a failed shared fetch so later retries download again - cover the mixed upgrade path and the `DownloadQueue` regression in specs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a brew upgrade edge case where a failed shared (combined) prefetch could cause subsequent upgrade logic to incorrectly treat downloads as reusable, preventing proper retry behavior. It does so by tracking whether a DownloadQueue#fetch run encountered any failures and disabling reuse of prefetched downloads when that happens.
Changes:
- Add
DownloadQueue#fetch_failedstate to record whetherfetchencountered rejected/failed downloads. - Update
brew upgradeto avoid reusing prefetched downloads when the shared prefetch had any failures. - Add/extend unit coverage for both the new
fetch_failedbehavior and the upgrade flow decision.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
Library/Homebrew/download_queue.rb |
Tracks whether a fetch had any failures via @fetch_failed and exposes it via fetch_failed. |
Library/Homebrew/cmd/upgrade.rb |
Disables use_prefetched / skip_prefetch when the shared download queue reports a failed fetch. |
Library/Homebrew/test/download_queue_spec.rb |
Adds a spec ensuring parallel-mode rejected downloads set fetch_failed and mark Homebrew failed. |
Library/Homebrew/test/cmd/upgrade_spec.rb |
Updates existing mocking for fetch_failed and adds coverage for not trusting failed shared prefetches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6 tasks
p-linnane
approved these changes
Apr 26, 2026
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.
DownloadQueue#fetchoutput and failure handling unchanged while recording whether a shared fetch failedbrew upgradereusing prefetched downloads after a failed shared fetch so later retries download againbrew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex with several rounds of (mean) review and testing.