Skip to content

[bug] Some plugin installation writes ignore a newer install of the same plugin #4518

Done

Description

@Quick104

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:

  1. Archive repair overwrites the newer package. ArchiveCache.load (internal/plugins/archive_cache.go) reads an installation, repairs a legacy stored archive, then persists it with SaveArchive(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.
  2. A stale notify pass can offer a downgrade. notifyPluginUpdate (internal/plugins/auto_update.go) records available_version by 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}/update then installs 1.1.0 over 2.0.0, because it trusts the recorded version and never compares it with the installed one.
  3. /update can erase a fresh notification. The replacement already clears available_version in 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.
  4. /update can answer 500 instead of 409. PluginHandler.ApplyAdminPluginUpdate (internal/api/handlers/admin_plugin_lifecycle.go) checks that an update is recorded, then UpdateToAvailableVersion reads the row again and returns a plain no update available error 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:

  1. Archive repair: an installation with a legacy raw-binary stored archive, a node loading it while an admin replaces the plugin from the catalog.
  2. 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.
  3. Lost notification: POST …/{id}/update while an update check records a newer release.
  4. 500: two POST …/{id}/update calls, 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.Update with Archive and IfInstallPath set to the snapshot's path, and drop the repair on ErrInstallationChanged.
  • Notify: set IfInstallPath on the available_version write; in UpdateToAvailableVersion, refuse a recorded version that isn't newer than the installed one.
  • Remove the second available_version clear in UpdateToAvailableVersion.
  • 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

  1. added
    bug
    on Nov 18, 2026
  2. added
    priority: P2
    on Nov 18, 2026
  3. added 2 commits that reference this issue on Nov 19, 2026
    ac66f90
    c806dbc
  4. added a commit that references this issue on Nov 23, 2026
    59a7981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions