Plugin installs and the artifact store
How a plugin type is registered, installed, updated, stored on disk and recovered. The plugin model is in plugins.
Three independent states
A plugin type is in three separate states, and they can disagree:
- Registered: loaded in this replica's plugin registry, from a disk scan. This is per replica and ignores the database.
- Installed: cluster-wide and durable, in
integration.plugin_installations. It survives having zero instances. - Instances: the configured rows in
plugin_instances, zero or more per type.
Installing a plugin creates no instance. Install adds the type (the artifact on disk, the installation record and the permission grant) and stops there. The operator adds instances afterwards from Integrations, and a type can stay installed with zero of them indefinitely. The install dialogs create the first instance themselves, as a second call after the install commits, so the two steps can fail independently. An install that succeeds followed by a create that fails leaves the plugin installed without an instance, and the dialog reports exactly that.
What an install request means (POST /api/plugins/repositories/{id}/install):
| The type | The request | Result |
|---|---|---|
| has no instance | names no instance | a first install: the installation record, the grant and the artifact |
| has instances | names one of them (instanceId) |
an update of that instance; its configuration, deployment parameters and adoptions apply to it |
| has instances | names no instance | refused with instance_not_named (400), whatever else the request carries |
| any | names an instance of another type, or none that exists | refused with instance_not_found |
A new instance of an installed type is made through create-instance, never through install. Auto-update names the type's oldest instance, and so does its approval, except for a release with a deployment: that approval names the instance the type's workload update review picks, which is the oldest instance holding workloads, or the oldest instance when none holds any.
Configuration defaults are applied by the server. The dialogs render the manifest's
configSchema, which a plugin may omit, while the create validates against the loaded factory's
schema — which only the server has. A required field the request leaves out is filled with the
factory's declared default before validation; a value sent blank is the operator's and is still
refused, and an update is never filled, because it replaces a configuration the client already holds.
After a factory registers on install, update, replica activation or boot, the host best-effort migrates the type's stored settings, including disabled instances. A later activation or boot retries rows a failed pass could not migrate. Before creating an instance, the host also performs a blocking per-instance migration: it locks the instance and settings rows, verifies ciphertext before commit, and records the sensitive names for stale replicas. A failure leaves that instance stopped and faulted; the recovery sweep retries it. Sensitivity comes from the factory schema, so a field collected only by a configuration flow must also be declared there. An already-running older factory keeps its in-memory configuration until reload; the newer factory protects stored settings before its next create.
Deployment parameters come only from the caller. The wizard's create carries the parameters its Parameters step collected. Integrations → Add instance sends none, so an instance added there resolves the author's defaults. When the install recorded consent for another posture (Matter installed on an operator network, say), the consent enforcer refuses that instance's workloads until they are covered.
A deployment-bearing plugin deploys no workloads until its first instance exists. Workloads belong to an instance and are created with it, not with the install. Installing such a plugin therefore starts no container, and the wizard's Deploy step streams the workloads of the instance it just created.
Deleting the last instance of a native plugin does not uninstall it: the installation record stays, so the marketplace keeps reporting it as installed at its version instead of offering "Install" again, and so do the grant and the recorded consent, so the next instance deploys without asking again. Only a type with no installation record loses them with its last instance. Bundled plugins carry no installation record, because they ship in the image.
Removing a type is its own operation: DELETE /api/plugins/types/{pluginTypeId}, which requires
integrations.manage. It removes the type, never the things instances own, so it is refused while
any instance exists: a conflict carrying reason: "instances_exist" and the names of the instances
that block it. There is no cascade, because deleting an instance hard-deletes the logical devices
it owns along with their history, scenes and telemetry, and that destruction stays behind the
explicit per-instance delete, where the operator is told what it costs. A type with no installation
record to remove is reported absent — never installed, bundled with the image, or the platform-owned
system type, which is answered here exactly as it is hidden from the instance list.
Otherwise the type goes cluster-wide. The installation record, the permission grant and the recorded consent are deleted, the on-disk artifact is deleted, the cluster's stored copy of that artifact is deleted once no record still names it (see what an uninstall reclaims), the type is evicted from this replica's registries, and an uninstall event fans out to the peers, which delete and evict their own copies. Re-installing afterwards asks for consent again, because the grant went with the uninstall. The artifact is deleted before the eviction, here and on every peer, because the load roots are scanned without the database at boot and an eviction that left the files behind would be undone by the next restart. Only the install root is deleted from, never the bundled image directory. A type that also ships in the image stays hidden after its uninstall until it is reinstalled. The marketplace detail page of an installed plugin offers the action, and renders the refusal as the list of instances to delete first rather than as an error.
Uninstalling a native plugin cannot promise its code has stopped. A native assembly lives in a collectible load context, and a plugin that left a static, a thread or a subscribed handler behind keeps that context alive. Where it cannot unload, the assembly stays loaded in the current process — records gone, artifact gone, registry entry gone, code still running — until the process restarts. The removal itself is durable across that restart on every replica that deleted the artifact: with no installation record, boot self-heal re-pulls nothing and the boot scan finds nothing to register. It is the running process, not the deployment, that may still be holding the plugin, so roll the deployment when a native plugin has to actually stop.
Auto-update and permissions are addressed by the type
Both are properties of the artifact, so both are addressed by the plugin type and are readable and writable while the type has no instance at all:
GET/POST /api/plugins/types/{pluginTypeId}/auto-update, plus/approveand/reject.PluginAutoUpdateSubscriptioncarriesPluginTypeIdand is unique on it, case-blind — two instances of one type cannot sit on different versions, so there is one subscription and one decision per type./approveand/rejecttake{ "version": "<parked version>" }: the version the caller reviewed. When another version is parked by then (a sync pass re-parked a newer release, or a second tab decided first), the call is refused with 409pending_version_changedand nothing is installed or skipped, so a decision never applies to a version whose changes were not shown.GET/PUT /api/plugins/types/{pluginTypeId}/permissions. The grant is keyed on(repositoryId, pluginTypeId); the route takes the type id.
The subscription does not end with the last instance. Only an uninstall retires it, and that is where it is deleted. The sync pass also evaluates a type that has no instance.
The type is what the operator's own tooling should use too: a permissions read for an id nothing on this host knows — no release declaring it, no registered factory, no installation record, no instance — is a 404 rather than a panel showing an empty requested set, which would read as "this plugin asks for nothing".
An installed plugin's grant identity and requested set come from its installation record. Release rows go with their repository and can be yanked; the record outlives both. A type with a record runs under that record's repository, asking for what the installed version's manifest asked for (the record's snapshot, else its own version's release row when there is no snapshot; the factory's declared set when neither is readable), so the operator's narrowed grant clamps it whatever became of the catalogue. Only a type with no record and no declaring release is treated as bundled: it requests what the built-in declares, and a stored bundled grant row, when there is one, still clamps that. The start-time compatibility and pre-flight judgements and the update feasibility gate read the same snapshot.
Approving a parked update for a type with no instance requires workloads.approve when the candidate declares a
deployment. The escalation diff the approve consults is addressed by instance, and an approve records the consented
deployment profile, so a diff that cannot be computed is never treated as an all-clear. A candidate with no
deployment section cannot escalate host privileges and needs only integrations.manage.
What an install request answers while an update of that type may be running
An install of a deployment-bearing update stages a durable intent, and the version commits mid-roll while the intent stays active. Under the type's update-start lock the answer is decided from the recorded version of the requested repository, the active intent and its target, and whether the request carries deployment parameters or adopted resources:
| Recorded version (this repository) | Active intent | Request | Answer |
|---|---|---|---|
| not the requested one | none | any | a new intent is staged |
| any | one, rolling to the requested version | parameters equal | the request joins it and returns its id |
| any | one, rolling to the requested version | parameters differ | refused, update_already_in_progress (422) |
| any | one, rolling to another version | any | refused as an install in progress (409): retry once it finishes |
| the requested one | none | the version alone, or parameters the workloads already hold | 201 with no intent id; nothing is staged |
| the requested one | none | other parameters, or adopted resources | refused as an install in progress (409): the retry applies them in place |
| the requested one, but from another repository | none | any | a new intent is staged (a source switch, which the operator acknowledges as source_repository_changed first) |
The baseline is read before the lock and the version commits without it, so a few milliseconds remain between this read and the initiator's own check; the intent a peer finishes inside them stages a no-op.
The unattended auto-update sweep never reaches that refusal for a type with an open update. It reads every
open intent of the type (a cohort has one per member) and judges the newest phase start among them: a member
waiting its turn, or waiting at the commit barrier, keeps an old stamp while another member moves. While the
newest start is within the time a healthy phase is expected to take, the sweep waits quietly at information
level. That time is the larger of the roll's turn budget for each replica of the fleet (one on an unclustered
host) and the orchestrator's sidecar and health-gate timeouts. Past it the update is stalled: every pass logs a
warning and writes a failed plugin.autoupdate.applied audit row (update_stalled), and takes no candidate
behind it. A candidate equal to the version already rolling is not waited behind; the install joins it.
A staged rollout is an attempt, not an application. The decision unit is a plugin type and a version, not one workload
intent: an update fans out to one intent per instance, an approve starts rollouts the sweep never staged, and an
operator's abandon is about the version. When the install returns an intent, the sweep records the attempt on the
subscription (AutoUpdateAttemptVersion, AutoUpdateAttempts, AutoUpdateAttemptStartedUtc, taken before the install call),
saves it at once, and moves neither the applied version nor the baseline: the commit moves both through the installation
record, as any install does. An approve that stages a rollout begins the same attempt, with a fresh budget. The workload
library has no completion callback, and a host stage can only run after the version commit, so a rollback at the health
gate is never seen by one. The next pass reads IActivePluginUpdates.RolloutOutcomeAsync, which adds up every update of the
type's instances to that version that had not finished before the attempt began, whoever started it, and settles the attempt;
a rollout that stops progressing is reported as update_stalled on every pass.
The instances settle together. Any running instance keeps the rollout running; then a failed rollback outweighs an operator's abandon, which outweighs a rollback; and the rollout took only when every instance committed, so one instance committed and another rolled back is a rollback.
| Outcome | What the sweep does |
|---|---|
| Committed (every instance) | plugin.autoupdate.applied with success: true and the replaced version as oldVersion; the record is reset |
| Rolled back by the health gate (any instance) | success: false, reason update_rolled_back; the candidate is staged again on a later pass until Plugins:AutoUpdateMaxAttempts (default 3) rollouts of it are spent. When another instance had already committed, the baseline has reached the version: the failure is audited once, the record is reset and the version is not retried |
Rollback failed (update_rollback_failed) |
the whole budget is spent at once; this includes an abandon pressed during a rollback, which gives up on the rollback and leaves the deployment unrestored, and an abandon whose own rollback then fails |
| Budget spent | the candidate is parked in the pending-approval fields with that anomaly code, announced once; the sweep then skips it silently |
| Abandoned by an operator, on any instance, of a rollout from any source, and its rollback finished | a decision, not a failure: the baseline moves past the version without installing it (plugin.autoupdate.abandoned; a park or attempts for another version stay) and it is not retried |
| Failure for a version the baseline already reached | audited, record reset, nothing parked |
Refused by the workload library before it starts (workload_update_refused, for example a disabled or consent-held instance of the type) |
the candidate is parked with that code and the library's reason, announced once; the sweep then skips it until it is approved, rejected or superseded |
A candidate of a type that has workloads is judged by the workload update review before anything is staged: when the review holds it back, it is parked with the review's reasons (refreshed when a later pass finds different ones) and the sweep stages nothing, writes no grant and counts no install for it; it goes ahead on the first pass the review clears it.
Once an abandon is durable, the abandon endpoint tells the subscription whether it requested a rollback, which the library's result says; giving up on a rollback or ending the walk where it stood is not a request. The subscription then awaits that version's rollout and the sweep declines it when the rollback has finished, so a rollback that fails is parked, never declined. The endpoint answers success even when that write fails; an attempt the sweep already awaits is settled the same way, and the sweep recognises the abandon by the library's reason text. Repeating it changes nothing.
One rule decides exhaustion: spent attempts are always parked. Whoever finds a version with a spent budget and no park, for instance after a mode change cleared the park, creates the park again with one audit, so a version is never skipped without the operator being told. A newer candidate has its own budget and retires the older park; approve or reject also resets it. An install that fails before staging is not counted, but a rollout the install had already started is adopted so that a repeating fault cannot stage a new one on every pass. An operator's in-flight update to the same version is part of the attempt, so a candidate that joins it counts it. A fault while settling one subscription skips only that subscription for the pass.
The walk does not bound every phase: parameter staging, operator redeploy, the commit barrier and the plugin roll's wait for the fleet have no timer, so the expected time is a reporting threshold, not a point at which the walk gives up. The stage journal is not consulted, and the comparison uses the sweeping replica's clock against the leader's stamps, so clock skew moves the warning by the skew.
When more than one instance of the type has workload rows, an intercepted type update stages one update
cohort covering every workload-bearing instance. The selected instance is first and receives the submitted
parameters; the others keep their stored parameters. Members apply and pass their health gates sequentially,
and the shared plugin version commits only after every member passes. The host refuses a new instance of the
type while the cohort is open, and refuses to start a cohort while any replica is on a build that cannot walk
cohorts safely. Abandoning before the version commit rolls back all cohort members. The update view shows a
waiting member's stage.params Working detail, and its confirmation says the whole cohort will be rolled back.
How the signature verdict survives an orchestrated update
A deployment-bearing update is routed through the workload update orchestrator, which commits the
version at swap time — later than the install, and from whichever replica leads that reconcile. That
replica downloaded nothing and verified nothing, so it has no verdict of its own to record, and the
commit must not write Unknown over a verdict the install measured.
The install that does download and verify the artifact therefore stages its verdict on the
installation record against the exact version it describes (StagedSignatureVersion). The commit
adopts that staging only when it lands on that version, and records Unknown otherwise. A verdict is
never carried across a version move: the staging is keyed on the version it was computed for, is spent
when adopted, and a verdict the caller supplies always wins over a staged one.
The orchestrated path is therefore as strict as the in-place one, which records the install-time verdict. The record's verdict describes the artifact on disk, not whatever the process currently has loaded, and the loader's re-verification at load time is the tamper backstop for both paths.
The verdict is more than a badge. The update anomaly detector reads it as the previous install's signature state,
so a record stuck at Unknown would disable the Critical signature_dropped and signing_key_changed anomalies
for the plugins that take this path (the ones running sidecars). The signature revalidation sweeps run only on
operator key management (adding, updating or revoking a trusted signing key), never on a plugin update.
A staged update holds its grant until it commits
A deployment-bearing update writes the new grant when it stages the workload rollout, because the rollout's
consent checks read it, but the version moves only at the commit. The grant row therefore keeps a restore point
(update_restore_point_json) next to the grant: the installed version it was taken under, the version being
staged, when it was staged, the grant in force before it, and the grant the staging wrote. While the installed
version is unchanged, a new staging (the same version resubmitted, or another version before the first one
settled) keeps the grant from before the first staging as the one to restore, and moves the staging time, so only
rollouts of the new attempt are judged. Reading the grant of the installed
release (an approve, an unattended auto-update) takes that prior grant while a restore point is pending, not the
staged one.
A restore point applies only while the version it was taken under is still the installed one and the staged version is not; any other installed version drops it, whichever build moved the version. It is settled in one of these ways:
- Committed. The commit records the version on the grant and drops the restore point; the new grant stays.
- Never started. When the install wrote the grant but returns no rollout (the update was refused, the version
turned out to be installed already, the judgement found nothing to stage) or throws after the grant write, and
no rollout of that version exists since the staging, the install puts the grant and the previous restore point
back before it returns, and audits
plugin.permissions.restoredwith outcomenot_staged. When a rollout did start (the failure came after it, or another cohort member's intent runs), the restore point stays for the settle. A lost install lock is the exception: another install may own the grant by then, so it is left alone. - Ended without committing. The workload library has no completion callback, so the cluster job
plugin-grant-restoresettles every restore point every 15 seconds, on one replica, independent of repository syncs. While any rollout of the plugin type is open, whatever its version, the restore point waits. Otherwise a rollout that was rolled back, abandoned or whose rollback failed gets the grant from before the update back, audited asplugin.permissions.restoredwith the outcome, and the workload consent is enforced again. A restore point with no rollout found for an hour is restored the same way, with outcomeNotObserved. A rollout still running is left for a later pass. A replica in safe mode does not run the job.
The settle locks the grant row (FOR UPDATE) and decides on what it reads under the lock, so an owner edit or a
staging that commits first is what it judges. When the grant no longer holds what the staging wrote, the restore point is dropped and the grant kept; an owner edit drops the restore point
outright. The consented deployment profile the staging recorded is not restored with the grant.
A rolled-back approved auto-update is restored like any other. The next pass retries the release from the restored grant and parks it again for the same anomalies, so it needs a new approval.
Where an installed artifact lives
An installed artifact has two homes: the per-replica plugins directory it is loaded from, and one cluster-wide copy in object storage. A replica with empty local storage reads the stored copy before it goes back to the plugin's repository.
That copy lives in the core:plugin-artifacts namespace under the key sha256/<64 lowercase hex>. The
key is the content's own digest, so identical bytes deduplicate onto one object and anything fetched by
a key can be re-hashed and checked against the key it came from. A write hashes the content against
that digest, refuses anything over the active object-storage backend's per-object cap, and then reads
the object's metadata back — a write that reports success and stored nothing is treated as a failure.
It runs in a dependency-injection scope of its own, so storing an artifact can never commit database
work its caller had staged and not yet saved.
The artifact is stored before the install is recorded. A PluginInstallation record exists only if its artifact
is in object storage, so a failed put or a failed read-back leaves no record and no install.
Artifact and install refusals
Each carries a stable code on the problem document's errorCode (reason carries the same value), on POST /api/plugins/repositories/{id}/install and on the auto-update approve and reject
endpoints.
errorCode |
HTTP | What happened | What to do |
|---|---|---|---|
artifact_too_large |
422 | The artifact is larger than the active object-storage backend's per-object cap | Raise that backend's cap, or switch to a backend with a larger one — see the two caps below |
artifact_digest_mismatch |
422 | The bytes handed to the store do not hash to the digest the release declared | Install again. This compares only the downloaded bytes against the key they would be stored under; it says nothing about whether the backend keeps them intact |
artifact_not_stored |
422 | The write returned successfully, but reading the object back found nothing, or the wrong size | Check the object-storage backend's health, then install again |
artifact_store_migrating |
503 | An object-storage backend migration is running, and a migration blocks writes for as long as it runs | Wait for the migration to finish, then install again. Nothing is wrong with the plugin |
host_builds_mixed |
409 | A workload update was requested while live replicas report different host builds | Wait for the host rollout to finish, then install again |
fleet_size_unset |
409 | A workload update was requested on a clustered host where Workloads:PluginRoll:FleetSize is not set; nothing was installed, pinned or adopted |
Set Workloads:PluginRoll:FleetSize to the replica count on every replica, restart them, then install again |
host_membership_unconfirmed |
503 | Live membership does not contain this replica, so install safety cannot be confirmed | Check cluster membership and retry after this replica appears |
For plugin code calling IObjectStorage, ObjectStorageMigrationInProgressException and
ObjectStorageUnavailableException are transient. Retry the operation with backoff; the migration refusal
clears when the switch finishes, and storage availability can recover when pool capacity returns.
The artifact-installation errors above are separate from workload update refusals: host_builds_mixed,
fleet_size_unset and host_membership_unconfirmed refuse before installation begins because the host state is
uncertain or unconfigured.
Two size caps, and they are not the same setting
An oversized install refuses under one of two codes. They name different settings, and acting on the wrong one changes a number that cannot help.
| Code | Cap it names | Where it is configured | Default |
|---|---|---|---|
artifact_too_large |
The active object-storage backend's per-object cap | Runtime settings, category object_storage, key backend_caps — one JSON object keyed by backend name |
db 50 MB, fs and s3 5 GB |
asset_too_large |
The plugin asset cap | Plugins:MaxAssetSizeBytes |
50 MB |
A GitHub or GitLab install is measured against both and reports whichever cap actually bound, a tie
reporting asset_too_large. An OCI install is measured against the object-storage cap alone — that cap
replaces the OCI client's own 256 MB — and so reports artifact_too_large. The default active backend
is db and both caps are then 50 MB, so the same situation reports different codes on different providers.
An OCI install refuses on the declared Content-Length before the body is read, and hard-stops
mid-stream if the header understated the size. The streaming providers are handed a stream with no
declared length, so a running total is the only check available to them.
The record names its own artifact
PluginInstallation carries two nullable columns, ArtifactSha256 and ArtifactManifestJson. Together they are
the whole address: the digest is the object key, and the manifest says which entry asset to load, under which
loader, after the release row is gone.
The digest cannot be read out of the manifest. PluginRepositoryRelease.Sha256 holds the manifest's
own declared sha256 on the GitHub and GitLab sync arms, which names the entry asset — but on the OCI
arm it holds the layer blob's digest, which appears nowhere in the manifest. Every plugin in the
official index arrives over OCI, so the column on the record is the only place that digest is written
down.
A sync never rewrites an installed release. When a repository republishes a version that is installed (or that a staged update is moving to) with a different manifest or artifact digest, the sync keeps the release row as it was and logs a warning (once per version and digest on each replica, at debug level after that); a version nobody runs takes the new content. The workloads of an installed version render from that row on a replica without the on-disk copy, so a rewritten row would change what they run without the update gate asking for consent.
A version move the workload orchestrator commits against a release row that is
missing (never synced, or beyond the per-repository release cap the sync walk stops at) or whose Sha256 is not a digest is refused and
writes nothing. The plugin roll then waits with the pin could not be committed: Module '…' version … has no release with an artifact digest … until the repository's release row is back (sync the repository), or until the roll is
given up; a given-up roll leaves the pin uncommitted and the fleet on the previous version.
A replica that has to re-pull an installed version from its repository, because its own copy is gone and the store
has none, first compares the digest the release row names now with the one the record names. When they differ it
pulls nothing: it logs the refusal as an error, a hot install records installed_digest_changed as the type's fault
on that replica. A replica with no copy has the plugin unloaded until the version is installed again; one that holds an older copy keeps it.
Filling the store
One single-owner pass, the plugin-artifact-store unit kind the cluster library places, runs when the unit is assigned and
every six hours after. It is idempotent: a converged cluster costs one query
and one metadata read per installed plugin. It never writes an installation record; it stores an artifact for a
record that names a digest.
The pass gives the cluster a copy of every artifact a record names and no backend holds. The bytes come from this replica's own disk when the artifact is the entry asset — which the recorded digest equalling the manifest's own identifies, the streaming arm's case — and from the repository otherwise, through the same verified download an install performs, into a staging directory that is deleted again. It never writes into the install root: a loaded plugin is running from those files. An OCI artifact is the layer blob and cannot be rebuilt from the directory it extracted to, so for an OCI plugin whose repository has been deleted there is no source and no copy is possible.
The put happens under the install lock for that plugin identity, after re-reading that a record still names the digest — uninstall commits its record removal before it reclaims the object, so a put decided earlier would leave an object nothing reclaims again. The download runs outside that lock: retention waits for the same key, and holding it across a download would make an uninstall's reclaim wait for the download.
The signature gate does not run in this pass, and nothing is loaded from what it stores. The bytes are hashed against the digest the record names — on the streaming arm twice, since the download verifies that digest too — and every read of a stored copy re-runs the gate before anything is registered. A release row that no longer names the recorded digest is skipped rather than stored, so the pass cannot introduce bytes the install did not verify.
What an uninstall reclaims
Uninstalling a type deletes every stored object of that type: the digests its records named and those of its releases
in their repositories, so nothing kept for rollback outlives the type. An object stays while another PluginInstallation
row or another plugin's release names its digest, and the uninstall re-checks the records under the same install lock
the install path takes for that plugin identity, immediately before each delete. This runs last, after the eviction and
the fan-out, on a token the request cannot cancel, which gives up after 10 minutes. The lock is polled for up to Plugins:RetentionLockWaitSeconds,
since a retention pass of the same identity holds it briefly; if it stays taken, the object stays in storage, a Warning
says so and an audit entry names it. Two records sharing a digest — the deduplication case — keep the object alive. An
object written within the last 5 minutes is left alone: an object no record names is exactly the
shape of an install that stored its artifact and then failed before committing.
During an object-storage backend migration the uninstall completes rather than refusing. The
records are already committed by that point, so refusing would report a finished removal as broken for
as long as the migration runs. The object is left behind and an audit entry
plugin.type.artifact_retained records pluginTypeId, artifactSha256 and a reason —
artifact_store_migrating, install_lock_held when the install lock stayed taken for the whole wait,
reclaim_deadline_passed for each object the uninstall had not yet examined when its 10 minutes ran out (one still
named by another record is among them, and stays), or
artifact_delete_failed for any other storage fault.
A retained object is never reclaimed afterwards. Uninstall is retention's only trigger, and the record that named the digest is gone, so nothing looks at that object again. The digest in the audit entry is the only handle an operator has left on it, and there is no tooling that takes one.
Version retention
An install or an update writes a new <repositoryId>/<version>/ directory beside the old ones, and nothing
else removes it. Retention does, once an update has taken effect and not before: an update keeps its target, the
version it replaced, and the highest version on disk below the replaced one that is not the target, and deletes the
rest. With 1.0.0, 1.1.0 and 1.2.0 installed, an update to 1.3.0 removes 1.0.0 and keeps 1.1.0, 1.2.0 and 1.3.0.
A downgrade follows the same rule, so it can never remove its target or the version it replaced; a first install, a
reinstall of the installed version and a type with fewer than three versions delete nothing. A directory whose name is
not a version is never deleted.
Each replica owns its plugin install root and prunes only that root. Only this process writes it: an install, the apply of an install from the plugin_type generation and a roll turn's apply run under the type's in-process install gate, so the disk pass needs no knowledge of other replicas. The uninstall's directory delete runs without the gate, after the record is gone, and the boot re-pull finishes before any pass can start; neither changes what a pass decides.
A disk pass runs once per completed update per replica, and it waits for the writers of its own root:
- It waits for the sweep side of the type's in-process install gate, polled for up to
Plugins:RetentionLockWaitSeconds(120). A pass still blocked when that runs out logs a Warning and deletes nothing; a skip is never silent. Waiting, not skipping, is what keeps one update's pass from being lost to an install of the same type. No cluster lock is taken. - It reads the installation record and the open update only once it holds the gate. A pass acts only when the record names the target and no update to another version is open; an unreadable record or update state deletes nothing.
- It skips every version directory that a plugin load context of this process was built from, or from a directory below
it (a build is loaded from
<version>/<framework>/), and has not yet been collected: the loader keeps its own list of them, becauseUnload()removes a context fromAssemblyLoadContext.Allat once, long before its code is gone, and the list tracks resurrection so a context unloaded by its finalizer still protects its directory. The in-process registry is what protects the running code of this replica, whatever versions the records named before.
- The install root, after this replica has finished its own update. Each replica prunes its own root at the end of its roll turn (an update with a workload walk), after its generation's apply of an install, or after an in-place install it served itself, detached from the request; an update that needs a restart counts, as its record is committed and the replaced version is kept. Only the directories under the record's repository whose manifest names the type are considered, so a type that moved to another repository leaves the old repository's directories until it is uninstalled.
- The shared object store, once per update. The roll stage reclaims after every live replica reports the target,
detached so that the walk and its group gate never wait for it; an in-place install reclaims right after its record
commits, also detached. The store is shared, so this pass takes the cluster-wide install lock of the type's identity
and then its update-start lock, polled for up to
Plugins:RetentionLockWaitSecondsaltogether; a pass still blocked logs a Warning and deletes nothing. A pass gives up after 10 minutes, so a storage endpoint that stops answering does not keep the locks. The slow scan of the store (one request per release) runs before the locks; the locks are held only for the decision and the deletes, which are decided again from rows read under them, so an instance create or delete and an auto-update are delayed by a few reads, not by the scan. No peer is asked: no running code reads a stored object, and a replica that restarts downloads the version its record names, which the record protects. An artifact's digest comes from the release row of the version, so a version whose release row was pruned from the repository's history is not reclaimed. The rule is applied to the versions that still have a stored object, and an object is deleted only when no installation record, no kept version and no release row of another repository or type names its digest.
Directories already on disk are not swept at boot. A plugin's old directories stay until its next update, which then cuts its history down to three in one pass. The version a replica replaced is the one it ran before the update, so a replica that boots straight onto the target, or runs nothing before, prunes nothing.
Recovery and boot behaviour
Safe mode engages automatically after repeated failed boots, or from a startup flag. It skips all plugin loading, repository sync, the assembly watcher and workflow execution, so the host comes up with no plugins and the operator can disable the offending one from the Cluster tab of System status. The health endpoint reports safe mode and its reason. Safe mode cannot be toggled at runtime.
Once a replica first serves, the boot pass starts the enabled instances up to four at a time and waits at most 30 seconds
for each, so a slow start holds only its own slot. A start still running after that goes on in the background and the pass logs a warning naming the instance; the
instance runs if the start completes (the plugin's StartAsync itself is abandoned and faulted after 30 s), and a failure is recorded like any other start failure. Until it ends, the replica's
status report lists the instance as faulted ("The start has not completed after 30 s."), so plugin.load_fault is raised
for it. The pass therefore always settles, which finishes boot and lets the convergences and the recovery sweep begin;
a roll, hot install or catch-up of that instance's own type still joins the running start and waits for it. The startup watchdog and
Hosting:StartupTimeoutSeconds cover the hosted services' StartAsync, not the artifact restore or the instance starts, which begin after it.
Installed artifacts live on per-replica storage, so a fresh replica starts empty. Boot self-heal restores every installed artifact at the head of the boot pass, after the hosted services have started and before any instance starts; a WASM artifact it restored is registered then. The WASM scan at start leaves a type whose pinned version is not on disk yet to that pass, which records the type as not loaded only when the restore did not bring the pinned version (or the records cannot be read again). That pass looks only at those types and at types the scan did not find on disk, so a type the scan already judged is not judged twice. It reads the cluster's stored copy first and falls back to the plugin's repository only when there is no usable object — no object at all, unreadable bytes, bytes that do not hash to the key they were asked for, a copy that does not yield the declared entry asset, or a record naming no digest or no usable manifest. A repository fall-back re-populates the object on its way out, so the next replica does not pay the same download. A peer receiving an install applied from the plugin_type generation takes the same path, for native and WASM alike. If neither source can produce the artifact, that plugin stays absent (fail-open) until one of them can.
Removing a repository does not strand what it installed. Deleting a repository removes its release rows and leaves
the installation records (PluginInstallation.RepositoryId carries no foreign key). A replica that reboots
afterwards rebuilds the plugin from the stored object and the manifest on the record, which is all that is left
describing what to load.
Reading a stored copy does not skip verification. Every read re-hashes the bytes against the digest
the record names, and a WASM artifact is re-checked for being a real module; either failing sends the
replica back to the repository. While the repository row exists the same signature gate runs as on any
re-pull, resolved against the same key set — it is the repository row that decides which keys may
verify, so nothing about the object path relaxes it. With the repository gone, no key set can be
resolved at all and no signature can be checked now: the artifact is admitted only if it is not WASM,
or Plugins:RequireSignatureWasm is off, or the verdict this cluster recorded for those exact bytes at
install time was Verified; otherwise the file just written is deleted and the load is refused with
signature_required. That stand-in reads a recorded verdict rather than re-verifying, so a signing key
revoked since the install is not reflected in it.
Installs and uninstalls reach every replica through the plugin_type generation, described under
Cross-replica convergence. Creating, deleting, enabling or disabling an instance
is still fanned out to peers; a peer applies the instance row it reads, not the message. A create on a replica that has not loaded an
installed type yet applies the install there first and answers 503 if the
type is still not registered after Plugins:TypeCatchUpTimeout, or 404 at once when that activation
finished without registering it. The 404 classification uses a registry mark keyed by the installed
version. Boot-seeded and hot registration-only native types, plus WASM block or trigger types, carry
the version they were observed at. A mark from an older version cannot make a newly installed version
look absent, so a replica that declined the new native registration reports the type as not runnable
here instead. A native decline leaves the existing mark alone; a successful factory registration
clears it. The catch-up and the generation's apply of one type take the same gate, so the second finds the type registered
and does nothing. Neither activates a type that has an open update: during a rolling update a replica not yet rolled keeps
serving the version registered there, and one with no version registered answers 503 PLUGIN_TYPE_NOT_LOADED, so the new
version arrives only with the replica's own turn. Starting, resuming and submitting a config or
options flow resolve the type the same way: a type still not loaded answers 503 PLUGIN_TYPE_NOT_LOADED
and leaves the flow as it was, and a replica takes over a flow whose owner has gone only once it has
loaded the flow's type. These resolutions wait for the boot start pass to finish after a replica first serves (at most 30 seconds per instance), bounded also by the request's cancellation, so a request in that window waits for it. Reload, hot-registration and the three install markers — Requires restart,
Rejected and Backend too old — are per-replica, and the replica that served the install writes
them; roll the deployment to converge plugin code globally.
The type catalog and the permissions panel use the serving request's pinned plugin_type state: an uninstalled type is hidden and its permissions GET and PUT answer not found. An installed type this replica has not loaded is hidden from the catalog; a new instance request for it follows the catch-up behavior above. Creating an instance of a type the pinned state records as uninstalled is refused with the same not-found answer (404), before any catch-up is tried. The native trigger types are built at boot, so an uninstall does not unload them on any replica; only a restart does. A WebAssembly trigger type is unregistered by its uninstall, and the trigger host stops every trigger of it that is still armed at its next sync, at most 30 seconds later. An uninstall drops the type's discovery matchers on each replica as it unregisters the type, and withdraws its alert subscribers: no new alert reaches them, and each replaced facade is disposed once the deliveries in progress end, waited for at most 30 seconds.
A hot native install reads Requires restart when the installed version declares endpoints, workflow blocks,
system-alert subscribers or triggers that the replica has not loaded at that version, or when
parts loaded at another version are still loaded — an update that drops them included, since they stay until
the next boot. The verdict is kept per kind: a kind loaded at the installed version drops out of it. Workflow blocks
reach the installed version without a boot when the replica swaps them live: every block it has registered for the
plugin is exported again with an equal shape, and every call of the activation answered at that version with no
host failure. The replica then writes the new block set after those calls and records the blocks at the installed
version; otherwise, for a changed or dropped block, the restart reason ends with (blocks after restart: block `x` changed shape) or block `x` is no longer exported. A call that did not succeed or left an instance at another
version fails the activation, so the instance's reason names that call, and the replica's log carries
blocks not swapped: <reason>; it reaches a restart reason only on an instance whose own reload succeeded while
another instance's call failed. A plugin without instances has no badge and its install response carries only
requiresRestart, so its block outcome is only in each replica's log. Alert subscribers reach the installed
version the same way, after the same calls: the alert bus swaps each of the plugin's slots in place, adds a slot for a
new type and withdraws a dropped type's slot, and records the kind at the installed version; a subscriber that cannot
be built or activated leaves every slot of the plugin until the next boot, and the restart reason ends with
(alert subscribers after restart: <reason>). The reason
names the kinds the installed version declares that are still behind; when only kinds the installed version no
longer declares are behind it names none, saying only that the parts loaded at boot stay. Reinstalling the version that booted
them reads nothing, also when one of its parts threw while boot built it: boot counts every kind an artifact declares
as loaded at the booted version before it builds any part, so after such a throw an update to a version without
boot-only parts still reads Requires restart, the replica reports loaded at V, needs a restart, and the replaced
factory's load context is logged as kept until restart, and a WASM start that fails in a host step reads Requires restart too. A native artifact
some of whose types cannot be loaded — a missing dependency — registers the types that did load, logs one warning
for that module in the process, and records a fault at its version at boot and on a hot install; a plugin roll
halts on that fault at the target version. A WASM start that faults in the installed version's own code
— or that the saved configuration blocks, lacking a field that version requires and gives no default for
— writes no install marker at all: the instance's health reads Faulted with that reason, and the
replica's recovery sweep re-attempts the start every Plugins:InstanceSweepInterval. A peer applying an
install applied from the generation writes no marker, and points at the instance's health on that replica with a warning when an
activation that ran did not succeed; one that never ran only logs.
A type with no installation record is refused and its files are removed. When Plugins:CustomPluginsDirectory
separates the install root from the image's own directory, the boot scan loads nothing for a type that has directories
in the install root and no installation record, native or WASM, and the native loader deletes those directories. The
loader never falls back to the highest version on disk for such a type. This clears an uninstall that a replica
missed, a crash between an install's files and its record, and a hand-copied development drop:
install a development build through the repository path, or keep it in the image directory. Nothing else writes this
replica's root while it boots, so the record read the boot already took decides, and the boot waits for no lock. Four things stop it:
- the record table could not be read when the boot starts: the boot fails, like an unreadable database, and loads nothing. The native loader's read fails it while the plugin registry is built; the WASM boot's read fails it too (the hosted service rethrows the typed failure);
- the directory is not at
<root>/<repositoryId>/<version>: it stays and is not loaded, and the orphan report names it; - a bundled plugin, which ships in the image directory and carries no record by design, is never judged this way;
- when the install root is the image directory itself, nothing says which copy is bundled, so nothing is refused.
A Reeve.Plugins.*.dll without a manifest is not a typed install and is left to the orphan report.
PluginOrphanArtifactBootReporter continues to name unaccounted-for directories without deleting them.
An uninstall tombstone is positive evidence. The operator uninstall writes a normalized type id
to core.plugin_uninstall_tombstones in the same save that removes its installation rows. Every path
that writes an installation record clears that type's tombstone in the same save. A replica's recovery
pass considers only a loaded registration whose manifest is under the reportable install root and
whose type has a tombstone but no installation row. The plugin_type generation hands every such type to the sweep, and
the sweep re-reads the tombstone under the locks before it deletes. A failed read changes nothing. If the install root
is also the bundled root, the sweep is disabled.
The timestamp cutoff comes from the tombstone. The sweep compares both the install directory and manifest mtimes with that database timestamp, and logs when it preserves a newer artifact. Replica filesystem clocks are expected to stay close to PostgreSQL through NTP; if a filesystem clock runs ahead, a recently installed artifact can be preserved for operator review rather than removed. A copied development drop is judged by its mtimes: tools that preserve old timestamps can make a post-uninstall copy look older than the tombstone and eligible for removal.
The sweep evicts factory-bearing native types, native registration-only types (found by their instanceless marker) and all WASM kinds, including triggers and blocks. A removal that meets a local install or a busy lock is retried, as is one that fails. Two cases are not retried and log a warning: a directory newer than the uninstall (a re-pull that began before it and landed after it, or a clock ahead of PostgreSQL), and a replica whose install root is missing or is the bundled root. For both, remove the artifact directory by hand and restart the replica.
The origin replica can crash mid-uninstall. The records and the tombstone commit before the artifact is deleted: a
process killed between the two leaves the rows gone cluster-wide and the artifact on the origin's disk. The retry does not
help, because there is no installation record left to remove: DELETE answers 404. Every replica's generation still
carries the tombstone, so each removes its own artifact and registration; the origin does so at its next boot.