Skip to content

feat: add plugin pack install API - #201

Merged
ibetitsmike merged 5 commits into
mainfrom
mike/plugin-packs-3-install-api
Nov 11, 2026
Merged

ibetitsmike merged 5 commits into
mainfrom
mike/plugin-packs-3-install-api

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Third step of plugin packs (R7.2), stacked on #200: the API that installs, lists, updates and deletes plugin packs, and the per-organization allowlist of Git hosts they can come from.

What changes

  • Routes under /api/v2/chats/fork/organizations/{organization}, behind the fork-plugin-packs experiment and hidden from the API docs like the other fork routes:
    • GET/PUT plugin-pack-sources: read or replace the allowlisted hosts (lowercased, deduplicated, host names only).
    • GET/POST plugin-packs: list packs (without files), or install one from a source URL, path and ref.
    • GET/DELETE plugin-packs/{pluginPack}: one pack with its file list (path, size, SHA-256), or delete it.
    • POST plugin-packs/{pluginPack}/update: fetch again, at the current ref or a new one.
  • Install and update authorize first, so a caller who cannot install never makes the server fetch. The fetch runs outside the transaction against the organization's allowlist; the pack row and its files are then written in one transaction, pinned to the resolved commit. A duplicate name returns 409; a host that is not allowlisted returns 400.
  • Access: packs reuse the organization skill object from feat: store plugin packs and fetch them from Git #200, so organization admins manage packs, auditors can only read them, and members get 404.
  • Schema: chatdmig node plugin_pack_sources adds one row per organization with its host list, plus GetPluginPackSources/UpsertPluginPackSources with dbauthz and dbmetrics wrappers.
  • Test helper: pluginpackstest.Repo serves a real git http-backend repository over TLS, shared by the fetcher and API tests.

Validation

  • In a container: forkdb/generate.sh, chatdmig check, go build ./coderd/... ./enterprise/... ./codersdk/..., vet, swag and apitypings regen (only the plugin pack entries are kept in coderd/apidoc and typesGenerated.ts).
  • Tests passed: ./coderd/x/pluginpacks/..., forkdb TestPluginPack*, dbauthz TestForkQuerier, coderd TestForkPluginPacks and TestForkChatRoutes, the swagger tests in coderdtest and coderdenttest, and ./coderd/database/migrations/chatdmig/ against Postgres 17 with a matching pg_dump.
  • fork-ci runs only for PRs based on main, so it does not run on this PR until feat: store plugin packs and fetch them from Git #200 merges.

Adds the plugin_packs and plugin_pack_resources tables (chatdmig node),
their forkdb queries with dbauthz and dbmetrics wrappers, and
coderd/x/pluginpacks, which fetches one commit of a pack directory over
smart HTTP with a host allowlist and fixed size caps.

Packs reuse the organization skill RBAC object, so only organization
admins and auditors read or manage them.
The 64 MiB transfer cap does not bound memory, because go-git inflates
every fetched object into memory storage before the per-file limits run.
Read the pack first and reject it when its object headers, and the target
sizes of its deltas, add up to more than 256 MiB.
Organization admins can allowlist Git hosts and install, update, list and
delete plugin packs through /api/v2/chats/fork/organizations/{organization}
behind the fork-plugin-packs experiment. An install or update fetches the
pack, pins the resolved commit and stores its files. Members cannot see
packs and auditors can only read them.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac807c1972

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coderd/fork_plugin_packs.go Resolved
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T16:11:11.580419Z a100822 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from mike/plugin-packs-2-install to main November 11, 2026 15:49
…nstall-api

# Conflicts:
#	coderd/database/dbauthz/fork_forkdb.go
#	coderd/database/dbauthz/fork_forkdb_test.go
#	coderd/database/dbmetrics/fork_forkdb.go
#	coderd/database/forkdb/forkdbmock/forkdbmock.go
#	coderd/database/forkdb/models.go
#	coderd/database/forkdb/plugin_packs.sql.go
#	coderd/database/forkdb/querier.go
#	coderd/database/forkdb/queries/plugin_packs.sql
#	coderd/database/forkdb/sqlc.yaml
#	coderd/x/pluginpacks/fetch_test.go
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: a10082295c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike merged commit 0c32663 into main Nov 11, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/plugin-packs-3-install-api branch November 11, 2026 16:34
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merged as a squash of head 7da1af4893, on top of main e7f55da11b (#202).

  • CI: fork-ci run 43057167841 passed on the exact head. The branch was retargeted to main after feat: store plugin packs and fetch them from Git #200 merged; the lead then merged main in with update-branch. The non-test, non-generated diff matches the UAT'd head ac807c1972 against its old base exactly.
  • UAT: UAT201 passed at ac807c1972 on a fresh branch server with fork-plugin-packs and github.com egress approved for that run only. It installed cursor/plugins pinned to 5866df5573 (573 files, 58 skills, 2 agents), refetched on an explicit update, rejected gitlab.com and http:// with 400 before any outbound request, returned 404 to members and 403 with the experiment off. The leak audit was clean.
  • Codex: clean receipt 6800911959 on a10082295c, which has the same diff. One earlier P2 (create-only API key scopes) was replied and resolved. 0 unresolved threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant