Repository navigation
fix(backends): keep the installed backend when its upgrade fails - #13413
Merged
mudler merged 1 commit intoNov 23, 2026
Merged
Conversation
The backend op handler removes the named backend after any failed install, to clear a half-written directory. It ran the same cleanup for a failed upgrade, but there the name is the installed, working build. gallery.UpgradeBackend already restores the old build when its own swap fails, and a failure before the swap (for example a download error) leaves it untouched, so the handler's cleanup only ever deleted a good backend. Skip the cleanup for upgrades. A failed plain install still removes its leftover directory. Assisted-by: Claude:claude-sonnet-5-5
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.
What
A failed backend upgrade no longer deletes the backend that is installed.
Why
After a failed install, the backend op handler removes the named backend to clear a half-written directory. It ran the same cleanup after a failed upgrade. For an upgrade, the name is the installed, working build. So an upgrade that failed for any reason that is not a cancel (for example, an interrupted download) left the user with no backend at all.
gallery.UpgradeBackendalready puts the old build back when its own swap fails, and a failure before the swap leaves the old build untouched. The handler's cleanup could only remove a good backend.Change
core/services/galleryop/backends.go: skip the failure cleanup when the operation is an upgrade. A failed first install still removes its leftover directory.core/services/galleryop/backend_failed_op_cleanup_test.go: two specs. A failed upgrade keeps the installedrun.shand reports the error. A failed plain install still cleans up.Tests
The upgrade spec fails without the change and passes with it.
golangci-lintand the full suite were not run.Not in this PR
A failed forced reinstall (
op.Force, not an upgrade) probably still runs the same cleanup. I did not change it because I did not check how that path swaps files.Assisted-by: Claude:claude-sonnet-5-5