Repository navigation
feat: implement S3 Plugin Store and Asset Handling - #761
Conversation
- Introduced a fake S3 implementation for testing the plugin store. - Added functionality to handle plugin assets via HTTP, including frontend, MCP, and skills bundles. - Enhanced the S3 client to manage checksum headers conditionally. - Updated the SkillsHandler to support reading skills from the plugin store. - Created tests for the new plugin asset handling and skills functionality. - Modified the router to include routes for serving plugin assets. - Implemented migration logic for local to S3 plugin store. - Ensured that the plugin store can handle both local and S3 configurations in end-to-end tests
There was a problem hiding this comment.
ℹ️ No critical issues. The
Storeabstraction, the s3 implementation and the gateway plumbing hold up under inspection. The findings are documentation that still describes the local-folder-only store, one CI coverage gap for the bucket-backed e2e path, and a local/s3 parity nit in the new asset handler.
Reviewed changes
Storeinterface —plugin.Storenow abstracts backend, migrations and the three bundles; installer,Runtime,MigrationRunnerand skills depend on it instead of folder paths.- S3 store — new
s3Storebehind theS3APIsubset interface: prefix-scoped deletes (trailing/, soa.bnever deletesa.bc), extension-derived content types,NoSuchKey→ErrAssetNotFound. - Asset serving — public
GET /api/v1/plugin-assets/{kind}/{name}/*streaming frontend/MCP/skills files, with ETag/304 and the gateway's cache policy; backend files are unreachable. - Local → bucket migration —
MigrateLocalToStoreplusapi migrate-plugins [--dry-run], verifying each uploadedbackend.wasmby reading it back. - Skills —
SkillReaderreplaces the skills directory inSkillsHandlerandListSkills*. - Deploy wiring —
PLUGINS_STOREpropagated to api and gateway across compose, Helm, CFN, GCP, DO and Render; Caddy selectsplugin_frontend_*/plugin_mcp_skills_*snippets; Helm drops the RWM volume and PVC in s3 mode. - Shared storage client — checksums switched to
WhenRequiredandRaw()exposed so the plugin store reuses the attachment client's endpoint and credentials.
ℹ️ Deployment docs still describe plugins as local-folder-only
The templates now put plugins in the object bucket, but the user-facing deployment guide still tells operators the opposite: docs/deployment/one-click.md says installed plugins are lost on restart for AWS lite (line 79) and live on the instance's ephemeral disk for GCP lite (line 95), and that plugins are "not usable" on DO App Platform (line 121) and Render (line 166) — all four now set PLUGINS_STORE=s3 and route /plugins* to the API. docs/plugins/skills-plugin-system.md:121 has the same problem for skills. Neither file is in this diff, so the docs will contradict the shipped behaviour on merge.
Technical details
# Stale plugin-storage claims after PLUGINS_STORE=s3
## Affected sites
- `docs/deployment/one-click.md:79` — "installed plugins live on the task's ephemeral disk and are lost when it restarts" (AWS lite). `paca-lite.cfn.yaml` now sets `PLUGINS_STORE=s3` on the api, writing to the `${Bucket}` that the template keeps on delete.
- `docs/deployment/one-click.md:95` — "installed plugins live on the instance's ephemeral disk" (GCP lite). `deploy-lite.sh` now uses the Cloud Storage bucket.
- `docs/deployment/one-click.md:121` — "Plugins are not usable on App Platform yet (no shared disk, no gateway to serve their assets)". `.do/deploy.template.yaml` now adds ingress rewrites for `/plugins-mcp`, `/plugins-skills` and `/plugins` onto the API, so no gateway or disk is needed.
- `docs/deployment/one-click.md:166` — "Plugins are not usable on Render yet … installs vanish on restart". `render.yaml` now sets `PLUGINS_STORE=s3` on `paca-api` and the gateway, and the gateway image bakes `deploy/caddy/Caddyfile`.
- `docs/plugins/skills-plugin-system.md:121` — "The installer extracts this tarball to `{PLUGINS_SKILLS_DIR}/{pluginId}/` and the gateway serves it at `/plugins-skills/{pluginId}/`". Only true for `PLUGINS_STORE=local`; in s3 mode the bundle lands at `{PLUGINS_S3_PREFIX}/{pluginId}/skills/` and is streamed by the API.
## Required outcome
- Each platform section states what actually happens now (plugins persist in the platform's object store; no shared volume needed), and keeps any remaining real caveat (e.g. the unverified RustFS permission issue on Render, which is about attachments too).
- The skills doc distinguishes `local` from `s3`, the way `docs/plugins/backend-plugin-system.md` and `docs/plugins/marketplace.md` already do in this PR.ℹ️ The bucket-backed e2e path never runs in CI
newPluginE2EStore only takes the s3 branch when PACA_E2E_PLUGIN_STORE=s3, and nothing in the repo sets that variable — not deploy/docker-compose.e2e.yml, not .github/workflows/e2e-tests.yml, which runs go test ./test/e2e/... and starts the RustFS testcontainer that branch depends on. The new path is exercised by the fakeS3 unit tests, but never against a real S3-compatible backend, which is the part most likely to differ.
Technical details
# PACA_E2E_PLUGIN_STORE is unreferenced
## Affected sites
- `services/api/test/e2e/plugin_runtime_test.go:98-130` — `newPluginE2EStore` reads `PACA_E2E_PLUGIN_STORE`; the s3 branch requires `sharedStorageEndpoint` (RustFS testcontainer).
- `.github/workflows/e2e-tests.yml:115-119` — starts the compose stack and the testcontainer, but passes no plugin-store variable.
## Required outcome
- The s3 store is exercised at least once per run, e.g. a workflow step (or matrix entry) that runs `./test/e2e/...` with `PACA_E2E_PLUGIN_STORE=s3`, or an explicit note that the branch is manual-only.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Directory URLs serve
index.html— the asset handler maps an empty or trailing-slash wildcard toindex.html(matching Caddy'sfile_server), with tests for both the hit and the missing-index.html404. - S3 e2e path now runs in CI — a second
test-e2estep inapi-pr-ci.ymlrunsTestE2EPluginRuntimewithPACA_E2E_PLUGIN_STORE=s3against the RustFS testcontainer the suite already starts. - Deployment docs match the shipped behaviour — AWS lite, GCP lite, DigitalOcean and Render sections now describe bucket-backed plugins (
PLUGINS_STORE=s3) while keeping the real caveats (untested ingress rewrite, RustFS disk permissions, GCS interop);skills-plugin-system.mddistinguisheslocalfroms3, andbackend-plugin-system.mdgains the storage table plus migration procedure. MigratedPluginrename — migration report type renamed, no stale references.
Verified at 70276c7: go build ./... succeeds and the handler package tests pass. My note about the empty-wildcard 404 is resolved, and the RustFS-backed e2e step is a sound place for the s3 branch: TestMain starts RustFS whenever PACA_E2E=1, and each test uses a unique plugin name, so the shared bucket under -parallel 4 cannot collide.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
…on and asset handling
There was a problem hiding this comment.
ℹ️ No critical issues — the store and asset-serving changes in this push hold up; two minor touch-ups below.
Reviewed changes
- Upload-then-prune in the S3 store —
PutTree/PutBackendnow list the existing prefix, upload every new object, and only then delete the leftovers through the new shareddeleteKeys, so a failed upgrade leaves the previous install readable. - Tolerant batch deletes —
deleteKeysskips keys inkeep, keeps going after individualDeleteObjectfailures and returnserrors.Join;DeleteAll/deletePrefixnow route through it. - Migration listing parity —
ListMigrationsignores objects nested undermigrations/, matchinglocalStore'sReadDirsemantics and removing the basename collision a nested file could cause. - Weak
If-None-Match—ifNoneMatchHithandles*, comma-separated lists andW/prefixes, which the local store's weak ETags (W/"…") and Caddy's gzip revalidation both need; the handler doc now records why Range requests are unsupported. - Tests — upgrade-failure retention, nested-migration filtering and a conditional-request table.
ℹ️ PR description still describes delete-then-upload
The "How it works" bullet still reads "a reinstall clears the old objects first", which e6b25b1 deliberately inverted. Since the description carries into the merge commit, it is worth a one-line edit so it does not contradict the shipped ordering.
Technical details
# PR body describes superseded ordering
## Affected sites
- PR #761 body, "How it works" section — "In s3 mode `plugin.json` is uploaded last and a reinstall clears the old objects first."
- `services/api/internal/platform/plugin/store_s3.go:182-223` (`PutTree`) and `:147-180` (`PutBackend`) — uploads first, prunes via `deleteKeys` afterwards.
## Required outcome
- The description says the new objects are uploaded before the stale ones are pruned, and that a failed upload therefore keeps the previous install intact.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Summary
Installed plugins (backend WASM,
plugin.json, migrations, and the frontend / MCP / skills bundles) can now live in the object-storage bucket instead of folders. One setting chooses where:PLUGINS_STORE=local|s3.local(the default everywhere except the one-click templates) behaves exactly as before: the fourPLUGINS_*_DIRfolders, shared between the API and the gateway.s3keeps everything in theSTORAGE_*bucket underPLUGINS_S3_PREFIX(defaultplugins). No shared volume, no ReadWriteMany StorageClass, and the bucket stays private.Before this,
PLUGINS_STORE=s3only read the WASM, manifest and migrations. The installer, skills, frontend and MCP bundles were still folder-only, and the S3 client ignoredSTORAGE_ENDPOINT, so it could not have worked against RustFS.How it works
Store interface.
Storeis now an interface with two implementations,localStoreands3Store.NewStoreis the only place that readsPLUGINS_STORE; the installer, runtime, migration runner and skills reader depend only on the interface.Store(PutBackend,PutTree); uninstall isDeleteAll. In s3 modeplugin.jsonis uploaded last and a reinstall clears the old objects first.storage.S3Client.Raw()), so it honours the same endpoint and credentials as the rest of the app.SkillReader; everyStoreimplements it.Serving assets without making the bucket public. The gateway can't sign S3 requests, so in s3 mode Caddy forwards
/plugins/*,/plugins-mcp/*and/plugins-skills/*to a new public API route,GET /api/v1/plugin-assets/{kind}/{name}/*, which streams from the store (Store.OpenAsset). Onlyfrontend,mcpandskillsare reachable;backend.wasm,plugin.jsonand migrations never are. Paths that could leave a bundle return 404. Cache headers match what Caddy does today (remoteEntry.jsisno-cache, other filesmax-age=900, immutable), with ETag /If-None-Match.Caddy. The three Caddyfiles (
deploy/caddy/Caddyfile,Caddyfile.dev, and the Helm copy) pickplugin_frontend_local|s3andplugin_mcp_skills_local|s3fromPLUGINS_STORE(defaultlocal), on both the public:80block and the internal:8080block. Set the same value on the API and the gateway.Migrating an existing install. New command
api migrate-plugins [--dry-run]copies the plugins in the local folders into the bucket. It never changes the folders, reads eachbackend.wasmback to verify it, and is safe to re-run; one failing plugin doesn't stop the others. SwitchingPLUGINS_STOREdoes not move plugins by itself, so run it first (documented indocs/plugins/backend-plugin-system.md, "Plugin Storage Location").Deployment changes
api.plugins.store, schema-validated):PLUGINS_STOREis passed to the API and the gateway. Defaults staylocal. With Helmstore: s3the plugins PVC is not created and nothing is mounted.s3: AWS lite, GCP lite, Render, and DigitalOcean App Platform. The plugin volumes andPLUGINS_*_DIRsettings are removed there. On DigitalOcean (no gateway) the ingress rewrites/plugins*onto the API route.backend-plugin-system.md,marketplace.md,.env.example,.env.production.example, Helm READMEs).Things worth a close look
GET /api/v1/plugin-assets/{kind}/{name}/*is unauthenticated (like the static files it replaces) and is added to the open-route allow-list inauthorization_test.go.storage.NewS3Clientnow setsRequestChecksumCalculation/ResponseChecksumValidationtoWhenRequired. The SDK's newer default (a CRC32 on every PutObject) is handled inconsistently by S3-compatible stores such as GCS and RustFS. This client is shared with attachments, so it applies there too.deletePrefixusesDeleteObjectper key instead of the batchDeleteObjects, because GCS's S3 interoperability layer has no multi-object delete. A plugin is at most a few hundred small files..md,.wasm,.jsonhandled explicitly) so both modes serve the same types.smithy-gois now a direct dependency ingo.mod.Testing
OpenAssetin both modes, the assets handler (headers, 304, 404, traversal), andMigrateLocalToStore(dry run, a broken plugin, re-run is idempotent).test/e2e/plugin_runtime_test.gocan now run against the RustFS testcontainer withPACA_E2E_PLUGIN_STORE=s3. All 10TestE2EPluginRuntime_*tests pass in that mode.migrate-pluginsagainst its RustFS and fetched the frontend, MCP and skills files through the gateway (correct content types and cache headers;backend.wasmand traversal return 404).auth/mfa.spec.ts:641,projects/conversations.spec.ts:980) failed once and passed on retry, unrelated to plugins.PLUGINS_STORE=s3: migrated the 9 plugins inplugins/localand loaded their files and backends from the bucket.helm lintandhelm templatein default,store=s3, andnfsProvisioner.enabledcases; a badstorevalue is rejected by the schema.Not verified
/pluginsalso matches/plugins-mcpand/plugins-skills(the longer prefixes are listed first), and the ingressrewrite, need a check on a first deploy.releases/latest, so they need a release that includes the new Caddyfile and API image before s3 mode works there.HEADrequests on the plugin-assets route are not routed (browsers useGET).Notes for upgrading
Plugins installed under one mode are not visible under the other. Run
api migrate-plugins(with the folders still mounted) before switching an existing deployment tos3; to go back, setPLUGINS_STORE=local, since the folders are never modified.