Repository navigation
feat: enable plugin packs for chat projects and chats - #203
Conversation
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.
…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
|
@codex review
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…nablement-api # Conflicts: # coderd/database/dbauthz/fork_forkdb.go # coderd/database/forkdb/forkdbmock/forkdbmock.go # coderd/database/forkdb/querier.go # coderd/database/forkdb/sqlc.yaml # coderd/fork_chat_routes.go
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a67f2451e7
ℹ️ 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".
|
@codex review
|
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Merged as a squash of head
|
First part of PR3 of plugin packs (R7.3): an installed pack can now be enabled for a chat project or for one chat. A later PR filters a chat's pack skills by this set, and another writes the enabled packs into the workspace.
What changes
plugin_pack_enablementaddsplugin_pack_projects (organization_id, project_id, pack_id)andchat_plugin_packs (organization_id, chat_id, pack_id). Both are fork tables, so upstream'schatstable and the upstream create-chat paths don't change. The schema keeps a pack inside its organization: a foreign key on(pack_id, organization_id)points atplugin_packs, and a trigger checks that the project or chat is in the same organization.chat_projectsandchatsare upstream tables, so that side is a trigger, likeagent_definition_project_organization./api/v2/chats/fork, behind thefork-plugin-packsexperiment and hidden from the API docs like the other fork routes:GET organizations/{organization}/projects/{project}/plugin-packs, plusPUTandDELETEon.../plugin-packs/{pluginPack}.GET {chat}/plugin-packs, plusPUTandDELETEon{chat}/plugin-packs/{pluginPack}.PUTandDELETEreturn 204 and can be repeated safely.GETreturns onlyid,nameandcommit_sha.Validation
forkdb/generate.sh,chatdmig check,go build ./coderd/... ./enterprise/... ./codersdk/..., vet, and swag and apitypings regen (only the new entries are kept incoderd/apidocandtypesGenerated.ts).TestPluginPackEnablementOrganization(raw inserts across organizations hit the trigger or the foreign key, and the queries match no row), dbauthzTestForkQuerier(new cases for all six queries), coderdTestForkPluginPackEnablement(a member enables a pack on their own project and chat; a pack from another organization and an unknown pack get 404; another member gets 404; disabling empties the list),TestForkPluginPacks,TestForkChatRoutes, the swagger tests, and./coderd/database/migrations/chatdmig/against Postgres 17.