Repository navigation
feat(coderd/x/chatd): gate plugin packs by project and chat enablement - #204
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
…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
…cks-5-chatd-gating
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb1c541dbd
ℹ️ 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".
…cks-5-chatd-gating
|
@codex review
|
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c914e1f38
ℹ️ 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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f049a85e9c
ℹ️ 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".
Merged as a squash of head
|
Second part of PR3 of plugin packs (R7.3), stacked on #203. A chat now uses an installed pack only when the pack is enabled for the chat's project or for the chat. The next PR writes the enabled packs into the workspace.
What changes
filterPackResourcesincoderd/x/chatd/fork_plugin_gate.gonow takes the chat. Withfork-plugin-packsoff it still drops every pack row. With it on, it drops rows of installed packs that are not enabled for the chat.~/.coder/plugins/<name>/, the directory the next PR writes packs into. The gate reads<name>from the row's manifest path. Packs the user placed elsewhere, such as~/.claude/plugins/cache, are not gated.resolveUsableChatProjectID), plus the packs enabled on the chat itself and on each of its ancestors (the root and, withfork-nested-subagents, the chats in between, viaAncestorChatIDs). Subagents inherit the project's packs and their ancestors' packs. The lookups run as chatd, like project skills, and only when a chat has installed pack rows. A failed lookup enables nothing.spawn_agent, and the agent type catalog. The catalog passes a chat that doesn't exist yet, so it sees only the project's packs.DriftHashis unchanged. A workspace holds the packs of all its chats, so filtering happens per chat after pinning.coderd/x/chatd/ARCHITECTURE.mdgets a TODO for the pack gate, for the human author.Known limitations
/.coder/plugins/<name>/segment of its manifest path. If~/.coderor~/.coder/pluginsis a symlink, the agent stores the resolved path, so the pack is not gated and reaches every chat on the workspace. A user's own pack under some other.coder/plugins/directory is gated.DriftHashcovers every pack on the workspace, so a pack file change marks all chats on that workspace context-dirty, including chats that do not have the pack enabled. Their refresh changes nothing.Validation
go build ./coderd/... ./enterprise/...andgo vet ./coderd/x/chatd/.TestManagedPackName,TestFilterPackResources(against Postgres: project packs, chat packs, a subagent inheriting its root chat's packs and adding its own, a nested subagent inheriting every ancestor's packs, a chat with nothing enabled, and the catalog's new chat),TestAgentRowDefinitionsGatesPackAgents,TestIsPackContribution,TestDriftHash,TestPinnedWorkspaceContext,TestContextResources,TestForkAgentDefinition*, and coderdTestForkAgentTypes.