Fix incompatible addon version activation when Bundler.setup fails after retry#3963
Merged
Fix incompatible addon version activation when Bundler.setup fails after retry#3963
Conversation
…ter retry When Bundler.setup raises GemNotFound or GitError and the retry has already been attempted (or install_error is set), the rescue block fell through without setting setup_error. This caused the server to boot thinking setup succeeded, bypassing the load_addons guard. Without Bundler constraining Gem.find_files, every installed version of every addon gem was discovered, leading to version mismatches (e.g., ruby-lsp-rails 0.4.2 loaded with ruby-lsp 0.26.5) and ArgumentError crashes. The StandardError rescue already handled this correctly - this aligns the GemNotFound/GitError rescue to do the same.
KaanOzkan
commented
Feb 18, 2026
vinistock
approved these changes
Feb 18, 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.
When Bundler.setup raises GemNotFound or GitError and the retry has already been attempted (or install_error is set), the rescue block fell through without setting setup_error. This caused the server to boot thinking setup succeeded, bypassing the load_addons guard. Without Bundler constraining Gem.find_files, every installed version of every addon gem was discovered, leading to version mismatches (e.g., ruby-lsp-rails 0.4.2 loaded with ruby-lsp 0.26.5) and ArgumentError crashes.
The StandardError rescue already handled this correctly - this aligns the GemNotFound/GitError rescue to do the same.
Motivation
Resolves errors that may occur from activating incorrect add-on versions. Instead of getting error reports we can not load the add-ons in the first place.
Implementation
Set
setup_errorand adjust theLOAD_PATHsimilar toStandardErrorcase.Automated Tests
Manual Tests