Repository navigation
Description
What happened
#4509 makes plugin replacements write only while the installation still holds the package they were prepared against, and adds that guard (IfInstallPath, ErrInstallationChanged) to InstallationStore.Update. Four other writes to the same installation still go by ID alone, so they can undo or misreport a newer install that landed after they read the row:
- Archive repair overwrites the newer package.
ArchiveCache.load(internal/plugins/archive_cache.go) reads an installation, repairs a legacy stored archive, then persists it withSaveArchive(installation.ID, …). If a replacement commits in between, the repair puts the old release's package back under the new row. A node that rehydrates from it then refuses the version mismatch. For a replacement with the same version, the node runs the old bytes. - A stale
notifypass can offer a downgrade.notifyPluginUpdate(internal/plugins/auto_update.go) recordsavailable_versionby ID. A pass that read 1.0.0 and decided to offer 1.1.0 can write that after an admin installed 2.0.0.POST /api/v2/admin/plugins/installations/{id}/updatethen installs 1.1.0 over 2.0.0, because it trusts the recorded version and never compares it with the installed one. /updatecan erase a fresh notification. The replacement already clearsavailable_versionin its own transaction.Service.UpdateToAvailableVersion(internal/plugins/service.go) clears it again by ID afterwards, so a check that recorded a newer release in between loses it until the next check./updatecan answer 500 instead of 409.PluginHandler.ApplyAdminPluginUpdate(internal/api/handlers/admin_plugin_lifecycle.go) checks that an update is recorded, thenUpdateToAvailableVersionreads the row again and returns a plainno update availableerror if another install cleared the marker in between. That error maps to 500.
Steps to reproduce
Found by reading the code during review of #4509; not reproduced live. Each case needs two operations on the same plugin to overlap:
- Archive repair: an installation with a legacy raw-binary stored archive, a node loading it while an admin replaces the plugin from the catalog.
- Downgrade: update policy
notify, a plugin update check running while an admin installs a newer release from the same repository, then Update on that plugin. - Lost notification:
POST …/{id}/updatewhile an update check records a newer release. - 500: two
POST …/{id}/updatecalls, or one alongside a catalog install of the same plugin.
Expected behavior
A write made from an installation snapshot applies only while the installation still holds that package (IfInstallPath), and /update installs only a version newer than the installed one. A write that lost the race is dropped, or answers 409 conflict to an admin.
Silo version / commit
main at 2f5a14b; follows #4509, which adds the guard these fixes use.
Deployment
Any; the races need two concurrent operations, and some need two API servers.
Area
Plugins
Clients affected
Web admin (plugin administration). No client app is involved.
Relevant logs
No logs available.
Technical notes
- Repair: persist the repaired archive through
InstallationStore.UpdatewithArchiveandIfInstallPathset to the snapshot's path, and drop the repair onErrInstallationChanged. - Notify: set
IfInstallPathon theavailable_versionwrite; inUpdateToAvailableVersion, refuse a recorded version that isn't newer than the installed one. - Remove the second
available_versionclear inUpdateToAvailableVersion. - Return a typed conflict (
ErrPluginUpdateUnavailable) when the service's own read finds no recorded update, or pass the handler's snapshot into the service.
Source: found in review of #4509. These touch lines that PR changes, so they wait for it to merge.
AI harness
Claude Code (via T3 Code)
AI tool(s)
Claude Code, Codex CLI, GitHub CLI
AI model(s)
claude-opus-5-5; gpt-6.2-sol (cross-provider review)
AI involvement
Fully AI-generated; not yet verified by a person
Independent or adversarial review
Found by a gpt-6.2-sol review of #4509 and checked against the source on main by claude-opus-5-5.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Activity
fix(plugins): guard the remaining installation writes on the package …
fix(plugins): guard the remaining installation writes on the package …
fix(plugins): guard the remaining installation writes on the package …