Skip to content

fix(plugins): check a plugin update's package before stopping the plugin - #4330

Merged
Quick104 merged 7 commits into
Silo-Server:mainfrom
Rhainland:fix/2249-plugin-update-check-first
Nov 15, 2026
Merged

Quick104 merged 7 commits into
Silo-Server:mainfrom
Rhainland:fix/2249-plugin-update-check-first

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2249
Related issue: N/A
Validation tasks: changes #1224 C1; changes #1225 C1 (a refused plugin update now leaves the installed plugin running; the refusal message the admin sees is unchanged)

Other clients: Apple N/A (no plugin administration); Android N/A (no plugin administration); Roku N/A (no plugin administration)

Updating an installed plugin stopped its running process before Silo had downloaded or checked the new package. When the package was then refused (a failed download, a checksum mismatch, a signature or identity refusal), Silo started the old version again, but the stop had already dropped the plugin's in-flight calls and, for a resident plugin such as a network access provider, its connections. The automatic updater stopped the plugin even before it looked up the catalog entry, so an unreachable catalog also took the plugin down for the whole attempt.

With this change Silo downloads and checks the new package while the installed plugin keeps running, and stops the plugin only once the package passed every check. A refused update leaves the plugin untouched.

Approach

  • The installer now prepares a replacement in two steps. Preparing downloads the package (for catalog installs) and runs every check that can refuse it: checksum, signature, manifest, API version, catalog and installation identity, the stored archive, the install path, the capability records, and reading every archive entry. It writes nothing. Applying writes the files and the installation row.
  • Catalog installs over an existing installation (Admin > Plugins install or update), automatic updates, binary uploads and archive uploads all prepare first and stop the plugin only after that succeeds. A write that fails after the stop still restarts the old version, as before.
  • An admin who turns the plugin off or on while its update downloads keeps that choice. The replacement no longer writes back the enabled flag it read before the download, always stops the old process, and reports the flag as stored. Before, a plugin turned off mid-update came back on when the update finished, on main as on this branch, and a plugin turned on mid-update kept running the old release.
  • The unused Installer.ReplaceRemote, ReplaceBinary and ReplaceLocal are gone; their callers use the prepared replacement.
  • docs/admin-api.md and docs/architecture/network-access.md now say a refused update leaves the plugin running.
  • No API contract change. The frozen /api/v1 bridge, jellycompat and the Apple and Android clients are not involved. The user manual does not describe when an update stops a plugin, so no manual issue is needed.

Validation

  • go build ./..., gofmt, go mod tidy -diff, go vet, make lint-changed, make lint-router-recovery, make verify-local-paths, make verify-bidi, make verify-size-ratchet, make verify-case-collisions, make verify-route-inventory: pass.
  • make test-go (with umask 022): passes.
  • The new Postgres test passes under the dbpins runner and is listed in scripts/ci/db-contracts.txt.
  • Tests cover the catalog path (a checksum mismatch and a package whose stored archive is refused never stop the plugin; an accepted one is stopped only after its checks), the automatic updater (stop only after preparation; a refused package never stops), a binary upload that can't be stored, and an archive upload with an entry that can't be decompressed, and a plugin turned off or on while its update downloads. Each failed before the fix.
  • Not run: the web checks (no web change) and the generated-contract checks other than the route inventory (no API change).

Evidence

Checked on a local server running origin/main (before) and this branch (after), with the same database. A local test catalog lists a resident test plugin at 1.0.0, which is installed and running, and a 2.0.0 entry whose checksum is wrong. The 2.0.0 download is served slowly so the plugin can be observed during the update. The plugin process ID comes from the host's process list.

Before (origin/main):

## status before update (plugin pid 2036496)
{"version":"1.0.0","runtime":{"state":"running","last_started_at":"2026-11-15T10:03:46.550Z"}}
## manual update: POST /api/v2/admin/plugins/installations {plugin_id, version: 2.0.0}
## 3s into the v2 download (plugin pid <none>)
HTTP 422 "The downloaded plugin doesn't match the SHA-256 checksum its catalog lists, so Silo didn't install it."
## after the refused manual update (plugin pid 2046431)
{"version":"1.0.0","runtime":{"state":"running","last_started_at":"2026-11-15T10:05:04.877Z"}}
## auto-update: POST /api/v2/admin/tasks/check_plugin_updates/run
## 4s into the auto-update (plugin pid <none>)
## after the refused auto-update (plugin pid 2047203)
{"version":"1.0.0","update_failure":"The downloaded plugin doesn't match the SHA-256 checksum its catalog lists, so Silo didn't install it.","runtime":{"state":"running","last_started_at":"2026-11-15T10:05:13.957Z"}}

After (this branch), same steps:

## status before update (plugin pid 2310560)
{"version":"1.0.0","runtime":{"state":"running","last_started_at":"2026-11-15T10:29:24.979Z"}}
## manual update: POST /api/v2/admin/plugins/installations {plugin_id, version: 2.0.0}
## 3s into the v2 download (plugin pid 2310560)
HTTP 422 "The downloaded plugin doesn't match the SHA-256 checksum its catalog lists, so Silo didn't install it."
## after the refused manual update (plugin pid 2310560)
{"version":"1.0.0","runtime":{"state":"running","last_started_at":"2026-11-15T10:29:24.979Z"}}
## auto-update: POST /api/v2/admin/tasks/check_plugin_updates/run
## 4s into the auto-update (plugin pid 2310560)
## after the refused auto-update (plugin pid 2310560)
{"version":"1.0.0","update_failure":"The downloaded plugin doesn't match the SHA-256 checksum its catalog lists, so Silo didn't install it.","runtime":{"state":"running","last_started_at":"2026-11-15T10:29:24.979Z"}}

Accepted updates still apply on this branch: a 2.0.0 entry with the correct checksum installs (201) and runs 2.0.0, an uploaded 1.0.0 zip archive replaces it (201, running), and an uploaded 2.0.0 binary replaces that (201, running).

On origin/main the plugin's runtime.state read running even while its process was gone; that is the host's cached state and is not changed here.

Risks

A replacement now holds the downloaded package and its stored archive in memory until it is applied, as the old code did during the replace. Every archive entry is read once more before the stop, which adds one decompression pass on archive installs. None identified otherwise.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code (via T3 Code); Codex CLI for code review
  • Tool(s): Claude Code, Codex CLI, GitHub CLI, git, Go toolchain, Docker, curl, jq
  • Model(s): claude-opus-5-5; gpt-6.1-sol (code review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: three rounds of dual review (Claude Opus 5.5 and GPT 6.1 Sol, independently, on correctness, standards and spec) of the branch diff. Round 1: GPT found that binary replacements still ran the stored-archive check after the stop; fixed by splitting replacement into a check step and a write step. Round 2: both found that archive asset entries were first decompressed after the stop, and Opus noted that uploads used a different mechanism than catalog installs; fixed by reading every entry while preparing and using one prepared replacement for every path, with the test-only wrappers removed. Round 3: no correctness or spec findings; a redundant test row was folded into the existing test. Opus's note that the write steps copy struct fields into locals was kept on purpose: it leaves the existing write lines unchanged. Round 4, on the enable/disable fix: both found that a failed read-back of the row after a successful update failed the install and skipped the lifecycle refresh; it now logs and keeps going. GPT asked for the test to check the reported flag too; added.

Note

Check plugin update packages before stopping the installed plugin

  • Plugin updates (catalog, local archive, binary upload) now download and validate the new package first, and stop the running plugin only after the checks pass. A rejected package leaves the plugin running.
  • Replaces Installer.ReplaceLocal/ReplaceRemote/ReplaceBinary with a PrepareCatalogReplacement flow that returns a PreparedReplacement applied after the stop. Archive entries that fail to decompress are rejected during preparation.
  • Service.stopInstallationIfRunning no longer checks the Enabled flag; replacements now always stop the process when a host is present. Replacement writes no longer set Enabled in the store, and Service.replaceStopped reloads the stored value so enable/disable changes made during download are preserved.
  • Adds database-contract test TestServiceInstallCatalogStopsPluginOnlyForAnAcceptedPackageDB to db-contracts.txt.
  • Risk: callers of the removed ReplaceLocal, ReplaceRemote, and ReplaceBinary methods on Installer must switch to PrepareCatalogReplacement and PreparedReplacement.Apply in installer.go.

Macroscope summarized 3e3d901.

Updating an installed plugin from its catalog, by hand or automatically,
stopped the running plugin before the new package was downloaded and
checked. A refused package (failed download, checksum mismatch, signature
refusal, wrong identity) then dropped the plugin's in-flight calls and,
for a resident plugin, its connections, and an unreachable catalog took an
auto-updated plugin down for the whole attempt.

The installer now prepares a catalog replacement (download and every check)
without touching the installation, and both the admin install/update path
and the automatic updater stop the plugin only once that succeeded.

Closes Silo-Server#2249
The stored archive, install path and capability checks also ran after the
stop. Split binary and archive replacement into a check step and a write
step, and run the check before stopping on the catalog, upload and local
archive paths.
Asset entries were first decompressed during extraction, after the stop.
Read them while preparing the replacement, and give the catalog, upload and
local archive paths the same PreparedReplacement.
@silo-triage silo-triage Bot added the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Plugin replacement flows now prepare and validate packages before stopping an installed process. The service and automatic-update paths apply prepared replacements after stopping. Successful service replacements report the stored enabled flag. Tests and documentation cover package refusal and replacement order.

Changes: Plugin Replacement Lifecycle

Layer / File(s) Summary
Replacement preparation and writes
internal/plugins/installer.go, internal/plugins/installer_replace_test.go, internal/plugins/installation_paths_test.go, internal/plugins/package_error_test.go
Installer paths prepare binary and archive replacements before writing. Preparation validates package identity and archive entries. Replacement writes update installation metadata without setting the enabled flag. Tests cover preparation and package refusal.
Service replacement flow
internal/plugins/service.go, internal/plugins/service_install_catalog_db_test.go, scripts/ci/db-contracts.txt, docs/admin-api.md, docs/architecture/network-access.md
Service install paths prepare replacements before stopping existing processes. After a successful replacement, the service reloads the stored enabled flag for the result. Database tests cover refused and accepted catalog updates. Documentation describes when the process stops.
Automatic update flow
internal/plugins/auto_update.go, internal/plugins/auto_update_replace_test.go
Automatic updates resolve and prepare the catalog replacement before stopping the plugin. Tests verify prepare-stop-apply order and that a preparation refusal does not stop the plugin.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant PluginService
  participant Installer
  participant PluginHost
  participant InstallationStore
  PluginService->>Installer: Prepare and validate replacement
  Installer-->>PluginService: Return PreparedReplacement
  PluginService->>PluginHost: Stop existing plugin
  PluginService->>Installer: Apply prepared replacement
  Installer-->>PluginService: Return InstallResult
  PluginService->>InstallationStore: Reload installation enabled flag
Loading

Possibly related issues

  • Silo-Server/silo-server#2780 — The PR reads archive entries before stopping the plugin, but does not add ZIP expansion limits or byte and member-count budgets.
  • Silo-Server/silo-server#4352 — The PR changes replacement preparation and write paths, but the supplied summary does not describe a version guard or lock against stale-snapshot writes.

Suggested reviewers: quick104

Merge Risk: Minimal · up to 3e3d9

Plugin updates now validate the new package before stopping the running plugin, so a refused or failed download leaves the installed version running. No merge-blocking issue was found in the changed paths. The known race between automatic and manual updates already existed on main and is tracked separately.

Security architecture risk: Minimal · up to 533b2

Rejected updates no longer interrupt a running plugin, and replacements preserve an administrator’s enable/disable choice. No introduced security or recovery regression was established in the inspected change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — Each replacement targets an existing installation ID and its release metadata. Its effects can extend to resident processes on other hosts: reconciliation detects changed version or installation path and replaces those processes.

Trust Boundaries and Controls

  • observed — Catalog binaries pass checksum and signature-policy checks before manifest execution, followed by catalog and installation identity checks. Archive preparation retains path, collision, required-file, checksum and catalog-identity checks and additionally reads every non-directory entry before the stop.
  • observed — Preparation is not side-effect-free execution of untrusted code: reading a binary manifest writes and executes a temporary binary with ProcessEnv and a five-second timeout. This mechanism already existed; the PR moves catalog replacement preparation before stopping the installed plugin without changing that execution authority.

Resilience and Maintainability Implications

  • observed — The replacement no longer overwrites an administrative enable/disable change made during preparation, and its service result reloads the stored flag. Existing disable handling updates the row and issues lifecycle notification; lazy starts require Enabled, and resident reconciliation selects enabled installations. These controls do not constitute serialization of every concurrent lifecycle operation.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: plugin updates now check the new package before the running plugin is stopped. It matches the changeset, which adds PreparedReplacement and reorders stop and apply in …
Description check Passed The description is detailed and on-topic. It explains the problem (plugin stopped before its package was downloaded or checked), the approach (prepare then apply, enabled-flag preservation, removed Re…
Linked Issues check Passed Issue #2249 requires that Silo download and validate a replacement package before it stops a running plugin, and that a refused update leave the plugin running.

Manual catalog updates: At head 3e3d90…
Out of Scope Changes check Passed All changed areas connect to the replacement-ordering objective of #2249:
- internal/plugins/service.go: InstallCatalog, InstallLocal and InstallBinaryUpload now prepare before replaceStopped. This is…
Full details: Title check

Explanation

The title names the main change: plugin updates now check the new package before the running plugin is stopped. It matches the changeset, which adds PreparedReplacement and reorders stop and apply in the install and auto-update paths. The title uses the conventional fix(plugins) prefix and is 72 characters long.

Full details: Description check

Explanation

The description is detailed and on-topic. It explains the problem (plugin stopped before its package was downloaded or checked), the approach (prepare then apply, enabled-flag preservation, removed Replace* methods), doc updates, validation, evidence, and risks. All of this matches the changeset summaries.

Full details: Linked Issues check

Explanation

Issue #2249 requires that Silo download and validate a replacement package before it stops a running plugin, and that a refused update leave the plugin running.

Manual catalog updates: At head 3e3d901, InstallCatalog (internal/plugins/service.go) calls s.installer.PrepareCatalogReplacement(ctx, existing, target) first. It calls replaceStopped, which stops the plugin, only if preparation returns no error. The error path returns before any stop. This verifies the ordering that the previous assessment left unverified.

Automatic updates: The previous assessment, based on the reviewed diff at 533b226, found that autoUpdatePlugin resolves the catalog target and calls PrepareCatalogReplacement before host.Stop. The later change set does not alter that ordering according to the supplied summary. This part rests on the earlier review and the summary.

Preparation covers the checks that can refuse a package: checksum, signature, manifest, identity, stored archive, install path, capability records, and archive entry reads. The PR's before/after local evidence shows the plugin process ID unchanged across a refused manual update and a refused automatic update.

The change since the previous review (533b226 to 3e3d901) adds a log-and-continue on a failed installation read-back after a successful update. It does not affect the stop ordering. The enabled-flag handling is covered by TestServiceInstallCatalogStopsPluginOnlyForAnAcceptedPackageDB, per the summary.

Docs and validation steps are non-coding and do not affect this verdict. Unresolved: the auto-update stop ordering at head is taken from the earlier review and the summary, not from a fresh read of auto_update.go.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to the replacement-ordering objective of #2249:

  • internal/plugins/service.go: InstallCatalog, InstallLocal and InstallBinaryUpload now prepare before replaceStopped. This is the direct fix. stopInstallationIfRunning no longer checks Enabled, and replaceStopped reports the stored enabled state. These changes keep a stop correct when the flag changes during the download, which the longer prepare-then-stop flow makes possible.
  • internal/plugins/installer.go: PreparedReplacement replaces ReplaceLocal, ReplaceRemote and ReplaceBinary. The write step omits Enabled. Removing the old methods is part of the same change.
  • auto_update.go and its tests: reorder preparation before stop, and add a refusal test.
  • installer_replace_test.go, installation_paths_test.go, package_error_test.go: tests for the prepare step, including archive-entry readability and binary upload refusal.
  • service_install_catalog_db_test.go and scripts/ci/db-contracts.txt: the DB test and its registration.
  • docs/admin-api.md and docs/architecture/network-access.md: describe the new stop behavior.

No change was shown to be unrelated to #2249. The enabled-flag fix is a related behavior change in the replacement path. It is described in the PR and covered by a test.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d33c286-d9ee-4210-ad4c-18b85371ffd4
Commits

Reviewing files that changed from the base of the PR and between 533b226 and 3e3d901.

Files selected for processing: 1

  • docs/admin-api.md
Files skipped from review as they are similar to previous changes: 1

  • docs/admin-api.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@silo-kody

silo-kody Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/plugins/installer.go Outdated
Comment on lines 445 to 453
for _, file := range reader.File {
if file.FileInfo().IsDir() {
continue
}
if _, err := readZipFile(file); err != nil {
return nil, packageError(err, "The plugin archive couldn't be read.")
}
}
if err := checkReplacementIdentity(manifest, existing); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Security high

Archive validation decompresses unbounded entries before identity checks

An archive for a different plugin can exhaust server memory before it is rejected. Run checkReplacementIdentity first and validate entries with a bounded streaming reader instead of readZipFile.

Prompt for LLM
File internal/plugins/installer.go, lines 445-453:

Archive validation decompresses unbounded entries before identity checks

Archive entries are decompressed into unbounded memory before the replacement identity is checked, so a catalog archive naming a different plugin can exhaust server memory even though it would previously have been rejected before extraction. Check identity first and validate entries with a bounded streaming reader rather than `readZipFile`.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right: this branch had moved the identity check after the entries were read, so b9ba889 moves it back to before any entry is decompressed, and a new test case covers it. On the catalog path, openInstallArchive already refuses an archive for a different plugin before this point. main sets no size limit on extracting entries (readZipFile reads them in full there too) beyond the download cap, so this PR doesn't add one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. Moving the identity check ahead of the full entry-validation pass addresses the ordering regression, and the new test covers it. The catalog path also checks identity earlier.

The unbounded decompression concern remains a pre-existing risk, rather than a size-limit regression introduced by this PR. It could be tracked separately if the team wants to add decompressed-size limits.

Comment on lines +331 to +335
var prepared *PreparedReplacement
prepared, err = s.installer.PrepareCatalogReplacement(ctx, existing, target)
if err == nil {
result, err = s.replaceStopped(ctx, existing, func() (*InstallResult, error) {
return s.installer.ReplaceBinary(ctx, existing, binaryReq)
return prepared.Apply(ctx)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Slow preparation can overwrite a concurrent plugin disable

A plugin disabled during a slow download can be silently re-enabled when Apply writes the stale Enabled value. Serialize installation changes or reload and validate the state before stopping and applying the replacement.

Prompt for LLM
File internal/plugins/service.go, lines 331-335:

Slow preparation can overwrite a concurrent plugin disable

A replacement retains the installation snapshot across the package download and writes its stale `Enabled` value back during `Apply`, so disabling a plugin while a slow update downloads can silently re-enable it. Serialize installation changes or reload and validate the installation state immediately before stopping and applying the replacement.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This race also exists on main. There, replaceStopped stops the plugin and then runs the download with the installation loaded beforehand, writing its Enabled value back afterwards, and nothing serializes installs against enable or disable. This PR takes the same snapshot and holds it over the same download, so the window is unchanged. Serializing installation changes is a separate fix, outside this PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Based on that comparison with main, the stale Enabled write is a pre-existing race rather than a regression introduced by this PR. I’ll withdraw the suggestion as a blocker for this change.

Serializing installation changes would be worth tracking separately; reloading alone would still leave a race unless the read and write are coordinated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here after all, in 533b226. The replacement no longer writes the enabled flag it read before the download, so an admin's switch made during the update stands. It also always stops the old process, which covers a plugin turned on mid-update, and it reports the stored flag. The catalog install test now has rows for turning the plugin off and on during the download; both failed before the fix.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. The changes described in 533b22669 address the stale Enabled write, including both disable and enable during a download. The added test cases cover the two scenarios discussed.

I haven’t independently verified the commit.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Nov 15, 2026
An archive for another plugin is refused before its assets are
decompressed, as it was before the entries were read up front.
@silo-kody

silo-kody Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

…update

A replacement wrote back the enabled flag it read before downloading the
package, so turning a plugin off while its update downloaded turned it
back on when the update finished, and the reverse. It also skipped stopping
the old process when that stale flag said disabled, so a plugin enabled
mid-download kept running the replaced release.

The replacement now leaves the enabled flag as stored, always stops the old
process, and reports the flag it reads back after writing.
@silo-kody

silo-kody Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49652b53-8417-4864-b78f-060b52e62d8f
Commits

Reviewing files that changed from the base of the PR and between c11b0a9 and 533b226.

Files selected for processing: 11

  • docs/admin-api.md
  • docs/architecture/network-access.md
  • internal/plugins/auto_update.go
  • internal/plugins/auto_update_replace_test.go
  • internal/plugins/installation_paths_test.go
  • internal/plugins/installer.go
  • internal/plugins/installer_replace_test.go
  • internal/plugins/package_error_test.go
  • internal/plugins/service.go
  • internal/plugins/service_install_catalog_db_test.go
  • scripts/ci/db-contracts.txt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread internal/plugins/auto_update.go Resolved

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one small wording problem in the docs and no defects in the code. I'm fixing the wording in a commit on this branch, so there's no need to change it yourself. The summary comment that follows has the scores and what I checked.

🤖 Claude Code (claude-opus-5-5)

Comment thread docs/admin-api.md Resolved
A refused update never stops the plugin, but a disabled or not yet
started plugin has no process to keep running.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 4 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: 3e3d90117 (533b22669 plus one docs commit from this review).

The fix works as described. A catalog update, an automatic update, a binary upload and an archive upload all download and check the new package while the installed plugin keeps running. The plugin is stopped only when the package passed every check that can refuse it. The prepare step runs the same checks the old replace functions ran before writing. Stopping regardless of the loaded enabled flag is safe because stopping a plugin with no process is ignored.

Addressed

  • docs/admin-api.md said a refused update leaves the plugin "in place and running", which isn't true for a disabled plugin or one that hasn't started yet. Fixed in 3e3d90117.

Left for maintainers to settle

Tests
TestServiceInstallCatalogStopsPluginOnlyForAnAcceptedPackageDB fails on the base (c11b0a968) for the reported reasons: a refused package records a stop, and turning the plugin off or on during the download is overwritten. It passes on the head against a migrated Postgres. The changed unit tests in auto_update_replace_test.go, installer_replace_test.go, installation_paths_test.go and package_error_test.go don't build on the base because they call the new prepare-and-apply interface, so they only cover the new code. go test ./internal/plugins/ passes on the head.

Validated features
I couldn't read the v1.0 validation board in this run, so I didn't check the PR's Validation tasks: line (changes #1224 C1; changes #1225 C1) independently. The explanation it gives matches the code: a refused update now leaves the plugin running, and the refusal message is unchanged.

User manual: unaffected. The plugins page doesn't describe when an update stops a plugin.
Other clients: no API or response-shape change. The install response's enabled now reports the stored flag, and the web app refetches the list after an install. Apple, Android and Roku have no plugin administration.

Review method: three finder passes on the diff, the callers and the conventions, plus a separate read-only review by GPT-6.1 Sol, which found nothing new.

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)

  • Fit: this is a reliability fix in the core plugin lifecycle. It adds no settings or API surface, and a node keeps serving while an update it would refuse downloads.
  • Readiness: the behavior is covered by a test that fails on the base, and no defect is left in the change. The only caveat is the validation line, which I couldn't check against the board.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit 12d93b6 into Silo-Server:main Nov 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish size/XL 500–999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Plugin updates stop the running plugin before checking the new package

2 participants