Repository navigation
feat: add agent-plugins experiment and Agent API v2.17 plugin messages - #29320
Conversation
931721d to
71f89e0
Compare
71f89e0 to
815c273
Compare
815c273 to
961c9b5
Compare
961c9b5 to
b500f10
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.13.0 | Round 9 | Last posted: Round 9, 89 findings (19 P3, 53 P4, 17 Nit), COMMENT. Review Finding inventoryFinding inventory: PR #29320Findings
Contested and acknowledgedCRF-11 (P3, agent/proto/agent.proto:107) - plugins_supported name vs experiment state
CRF-18 (P4, codersdk/deployment.go:5519) - experiment description promises unshipped behavior
CRF-4 (P4, agent/proto/agent_drpc_old.go:117) - unused 2.12/2.13 client interfaces
Law analysisNot run. Effective additions 168 (threshold 1000). Round logRound 1Full panel (round 1). Netero first pass: 1 P3, 4 P4, 2 Note, no P0, panel proceeded. Panel: ging-go, melody, ryosuke, knuckle, kurapika, pariston, mafuuu, bisky, gon, leorio, mafu-san, chopper (wildcard). Size 12: multi-domain (proto wire format, Go, coderd ingress of agent-supplied data). Result: 7 P3, 8 P4, 2 Nit, 3 Note (body), 2 OOS, 3 dropped. CRF-9 and CRF-10 downgraded from Gon P2 to P3: comment-only, the consequence depends on a future change. Keep-argument recorded: next developer adding a variant without a gate breaks every context push on older coderd. CRF-12 set to P4: the interface has no methods and version.go holds the full changelog. Reviewed against 0d12256..b500f10. Round 2Restructure round (new migration files 000612 added; effective additions 168 to 357). Churn guard PROCEED: 15 fixed, CRF-11 and CRF-18 contested; CRF-4 defense re-raised by Netero after orchestrator found its convention claim unsupported. Dispute check-in: gon, mafu-san, ryosuke, mafuuu, leorio, chopper resumed from R1 agents. CRF-11 closed 1/1, CRF-18 closed 6/6. Full panel: ging-go, melody, ryosuke, knuckle, kurapika, pariston, mafuuu, bisky, gon, leorio, mafu-san, chopper, plus wildcard zoro (13; chopper is a contested persona, outside the size target). Netero R2 is a new agent. New: 2 P3, 4 P4, 1 Nit, 2 Note (body). Reviewed against 0f78361..10dbcb0. Round 3Fix round (no files added; effective additions 357 to 489; changes address R2 findings). Churn guard PROCEED: 8 fixed (CRF-4, CRF-26 to CRF-32), none contested. Panel (new agents): gon, bisky, ryosuke, leorio, zoro, mafuuu, chopper, knuckle (raisers of findings whose code changed), ging-go, melody (specialists for changed Go and proto wire files), wildcard knov. New: 3 P3, 4 P4, 2 Nit; 2 Note (body), 1 OOS. Melody's routing-name P3 moved to out of scope (consumers in unchanged chatd and agent code; extends CRF-24). Gon P2 comment findings downgraded: CRF-41 to P4 (wording ambiguity, code is correct), CRF-42 to Nit; keep-argument recorded: duplicated rule lists drift. Most new findings come from the CRF-29 fix (withoutShadowedPluginServers). Reviewed against 0f78361..2be2785. Round 4Fix round (4 files changed; no files added; effective additions unchanged at 489). Churn guard PROCEED: CRF-35 to CRF-43 fixed. Panel (new agents): ryosuke, zoro, chopper, leorio, mafuuu, knuckle, bisky, knov, gon (raisers), ging-go, melody (specialists), wildcard meruem. New: 2 P4, 3 Nit, 1 Note (body), 2 OOS; 3 Gon findings dropped (CRF-52 keep-argument: two rule lists can drift; dropped because the author applied the fix offered and each list matches its function). Gon P2 on PluginBody downgraded to Nit (comment duplication, no behavior). Reviewed against 0f78361..825f9e6. Round 5Fix round (branch squashed; diff 825f9e6..938caef touches 4 files, no files added). Churn guard PROCEED: CRF-47 to CRF-51 fixed. Panel (new agents): chopper, leorio, mafuuu, knov, meruem, gon (raisers), ging-go, melody (specialists), ryosuke, bisky (policy layering and new tests), wildcard razor. New: 1 P3, 7 P4, 2 Nit, 2 Note (body). CRF-58 raised from six P4s to P3: consequence chain with CRF-56 (a malformed orphan is accepted, then fixing the manifest makes the same push reject, and the agent retry loop stops context sync until restart). Gon P2s on comments downgraded to Nit (wording, no behavior). Reviewed against 0f78361..938caef. Round 6Fix round (diff 938caef..8397708 touches 4 files; adds proto field plugin_source tag 5 as part of the CRF-60 fix; effective additions 577 to 758). Churn guard PROCEED: CRF-58 to CRF-66 fixed. Netero (advisory): 3 P4. Panel (new agents): mafuuu, knov, meruem, chopper, bisky, razor, melody, leorio, gon, ryosuke (raisers), ging-go (specialist), wildcard kite. New: 1 P3 (seven reviewers converged, reproduced), 8 P4, 1 Nit. CRF-71 (PR description) has no file line; listed in the review body. Gon P2 on test-helper comments downgraded to Nit. Reviewed against 0f78361..8397708. Correction: CRF-71 was posted as an inline comment on tailnet/proto/version.go:95 (post requires every open finding inline), not in the review body. Round 7Fix round (diff 8397708..4494299; no files added). Churn guard PROCEED: CRF-69 to CRF-78 fixed. Netero advisory: 2 P4, 1 Note (not posted: fixture style). Panel (new agents): mafuuu, knov, meruem, chopper, bisky, razor, melody, ryosuke, leorio, gon (raisers), ging-go, kurapika (specialists: input bounds, path prefix), wildcard zoro. New: 3 P3, 7 P4, 1 Nit, 2 Note (body). CRF-81 is a fix-chain regression: the CRF-69 cap removal (our round-6 advice) plus the CRF-74 log fields left plugin_source unbounded; convergence of four reviewers set P3 (amplification runs before the version gate). CRF-83 (structural: delete plugin_source) would also remove CRF-81 and CRF-84. Meruem's push.go:150 out-of-scope item is CRF-56, not re-added. Reviewed against 0f78361..4494299. Round 8Fix round (diff 4494299..f64e456; plugin_source removed, skip replaced by rejection; effective additions 831 to 661). Churn guard PROCEED: CRF-79 to CRF-89 fixed. Netero advisory: 1 P4. Panel (new agents): kurapika, knov, razor, chopper, meruem, zoro, bisky, ryosuke, leorio, gon (raisers), ging-go, melody (specialists), wildcard kite. New: 2 P3, 7 P4, 3 Nit, 1 Note (body), 1 OOS. CRF-93 is the remaining half of CRF-81 (other uncapped fields reach errors), six reviewers, P3. Gon P2 on proto wording merged into CRF-95 at P4. Zoro P4 on test duplication downgraded to Nit. Reviewed against 0f78361..f64e456. Round 9Fix round (branch rebased onto b4fb790; migration renumbered to 000614; withoutPluginData replaced by in-loop drop; collectOKPlugins added). Churn guard PROCEED: CRF-92 to CRF-102 fixed. Netero advisory: 1 P4, 1 Note (DRPCAgentClient213 belongs in agent PR; not posted). Panel (new agents): leorio, kurapika, razor, chopper, meruem, kite, gon, bisky, melody, zoro, ryosuke (raisers), ging-go, knuckle (specialists; migration renumbered), wildcard takumi (distilled set exhausted). New: 8 P4, 2 Nit. No P3: CRF-93 bound verified by five reviewers and a <4096 test. Gon P2s downgraded (comment wording): CRF-106 merged with Razor at P4, CRF-111 to Nit; CRF-113 merges two Gon P4s. Reviewed against b4fb790..ff177d1. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This PR adds the agent-plugins experiment, the v2.13 plugin context messages, and Manifest.plugins_supported. Findings: 7 P3, 8 P4, 2 Nit.
The main design question is where the experiment is enforced. GetManifest gates plugins_supported on the experiment, but PushContextState stores plugin bodies and plugin_name values unconditionally and does not call ValidatePluginName, so both the experiment and the name grammar depend on the agent. Several comment findings below change wording depending on that answer.
Out of scope (needs a ticket or explicit acceptance by a human):
coderd/x/chatd/context_prompt.go:115: pinned MCP tool names are built asserver + "__" + toolfromserver_name, so two plugins that declare the same server name produce identical model-facing tool names even when their sources differ (not checked against the later stack PRs).coderd/agentapi/context.go:368-394: the four existing switch arms repeat a nil-payload guard that cannot change the stored body, sinceprotojson.Marshalon a typed nil returns{}. The new plugin arm copies it.
Notes:
- The PR description says agents keep dialing v2.10;
agent/agent.go:1183dials v2.11 throughConnectRPC211WithRole. - CI
genandofflinedocsfail because the base commit lacksdocs/manifest/generated/cli.json; rebasing onto main fixes both.agent.pb.goregenerates without changes. The Storybook failure was not investigated because the job log could not be read. coderd/database/queries/chats.sql:1684:mcp_serverrows are re-synced into chat pins on every push, butpluginrows change only on a drift re-pin, so a pinned server'splugin_namecan name a plugin that is not pinned or is pinned at an older version.
coderd/x/chatd/context_prompt.go:403
P3 [CRF-1] The contextResourceKind and pinnedContextResources (line 335) doc comments still call plugin a reserved kind. (Netero)
After the new ContextResource_Plugin arm in coderd/agentapi/context.go, plugin rows are written to workspace_agent_context_resources and pinned into chat_context_resources, and chatd drops them because it does not handle them yet. Change both comments to say plugin rows are stored but not surfaced, and that hook, subagent, and command remain reserved.
🤖
coderd/database/dump.sql:3576
P4 [CRF-2] The body_kind column comments on workspace_agent_context_resources and chat_context_resources (line 1930) still say plugin is reserved for the Claude Code plugin RFC. (Netero)
After this PR, plugin holds Agent Plugins PluginBody JSON. The enum needs no migration, but the column comments can only be corrected with a COMMENT ON COLUMN migration, in this PR or the stacked PR that first reads plugin rows.
🤖
agent/agentcontext/resolve.go:842
Nit [CRF-21] KindPlugin is still documented as "reserved for Claude Code plugin manifests", while this PR defines the plugin kind as an Agent Plugins plugin.json manifest. (Mafuuu)
Reword it to name Agent Plugins.
🤖
🤖 This review was automatically generated with Coder Agents.
def34d5 to
10dbcb0
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This push makes coderd enforce the experiment and validate plugin names in PushContextState, and adds migration 000612. New findings: 2 P3, 4 P4, 1 Nit.
All 15 round-1 fixes were verified against the code. The defenses on the plugins_supported name and on the experiment description were accepted by the reviewers that raised them. The unused 2.12/2.13 client interfaces remain open; see the reply on that thread.
The test-go-pg CI failure was not attributed to this diff: the job log could not be read, and the PR's targeted tests and DB=ci go test ./coderd/database/migrations/ pass locally.
Notes:
coderd/agentapi/context.go:83: with the experiment off, the storedaggregate_hashstill covers plugin resources that coderd dropped. This only happens when an agent ignoresplugins_supported, and the field comment documents it.- The commit body still says agents dial v2.10 and that no migration is needed. The squash merge uses the PR body, which is accurate.
🤖 This review was automatically generated with Coder Agents.
10dbcb0 to
2be2785
Compare
| string name = 2; | ||
| string description = 3; | ||
| // plugin_name is the owning Agent Plugin, or empty for a workspace skill. | ||
| string plugin_name = 4; |
There was a problem hiding this comment.
Why do this with a (soft) reference to the plugin, instead of, for example, embedding the Skills and MCP servers directly into the PluginBody message?
There was a problem hiding this comment.
Good question - I have a mild preference to keep wire protocols like this flat though in this case it does lead to some additional stitching logic. I'll kick off a quick exploration on the nested version.
There was a problem hiding this comment.
The thing I dislike about references like this is that they can be wrong. I.e. the plug_name doesn't match any plugin.
With the embedded structure errors like that are simply unrepresentable, which eliminates a whole class of problems, making the server code tighter with fewer error cases to check.
831ef99 to
8b7f074
Compare
8b7f074 to
068cb50
Compare
Adds the agent-plugins experiment and bumps the Agent API to v2.16 with message-only changes for Agent Plugins (agent-plugins.org): - ContextResource gains a PluginBody variant carrying validated plugin manifest fields and the plugin's skills and MCP servers as nested ContextResources. - Manifest gains agent_plugins_enabled, which coderd sets when the agent-plugins experiment is enabled. Agents dial v2.16, so they need a coderd that supports it. coderd stores the plugin variant under the existing plugin body kind, without its nested resources, and each nested skill and MCP server as its own row. Migration 000632 adds a plugin_name column to workspace_agent_context_resources and chat_context_resources. It holds the plugin's name on each nested row and on an OK plugin's row, and the hydrate, MCP sync, and re-pin queries copy it. With the experiment off, PushContextState drops plugin resources and the resources nested in them. It rejects pushes with invalid plugin names, OK plugin resources without a name, two OK plugin resources with the same name, a non-OK plugin that nests resources, nested entries with the wrong body kind, plugin skill sources outside "<plugin source>/skills/", and plugin MCP servers with an empty server_name or a source other than "<plugin name>/<server_name>". Nested resources count toward the 1000-resource cap. workspacesdk.ValidatePluginName implements the spec's plugin name grammar (1 to 64 characters of a-z, 0-9, '.', '-', alphanumeric first and last, no repeated separators) so the agent and coderd validate names the same way.
068cb50 to
4b0cfc9
Compare
Main shipped Agent API v2.16 (template_id/template_name, manifest fields 21 and 22) and migration 000633, so the plugin changes move to v2.17, agent_plugins_enabled becomes manifest field 23, and the plugin_name migration becomes 000642.
|
Got this mergable again, only version numbers were bumped so I'm going to respect the original reviews here. |
Linear: CODAGT-1101
tl;dr: Adds the
agent-pluginsexperiment and the Agent API v2.17 messages that carry Agent Plugins data from the agent to coderd. First of eight stacked PRs adding read-only Agent Plugins v1.0.0 support.A plugin is a directory with a
plugin.jsonmanifest, skills underskills/, and an optionalmcp.json. Across the stack, the agent discovers plugins inplugins/and.agents/plugins/under its scan roots (for example~/.coder/plugins/<name>), chatd lists their skills with plugin attribution, the agent runs the MCP servers of plugins in the workspace working directory, and the Agents page shows plugin attribution in the chat context. Hooks, commands, agents, install flows, and org-managed plugins are out of scope. Background: research/agent-plugins-standard.md (internal).This PR adds
codersdk.ExperimentAgentPluginsand aPluginBodyoneof variant onContextResource(tag 18) that carries the validated manifest fields and nests the plugin's skills and MCP servers.Manifestgainsagent_plugins_enabled(field 23), which coderd sets when the experiment is enabled; the agent discovers plugins only then. coderd stores each nested resource as its own row with the plugin's name in a newplugin_namecolumn (migration 000642), which the hydrate, MCP sync, and re-pin queries copy. With the experiment off,PushContextStatedrops plugin resources and everything nested in them. Otherwise it rejects pushes with plugin names that failworkspacesdk.ValidatePluginName(the spec's name grammar, shared by agent and coderd), OK plugins without a name or with a duplicate name, a non-OK plugin that nests resources, nested entries of the wrong kind, plugin skill sources outside<plugin source>/skills/, and plugin MCP servers with an emptyserver_nameor a source other than<plugin name>/<server_name>. Nested resources count toward the 1000-resource cap.Agents now dial v2.17, so a new agent needs a coderd that supports it, as with every Agent API minor. Turning the experiment off does not remove plugin data already pinned to existing chats.
PR map
main..4b0cfc9657coderd/agentapi/context.go(+211/-51, API): drops plugin resources when the experiment is off; otherwise validates plugin names and nesting, and stores each nested skill and MCP server as its own row with the plugin's name.agent/proto/agent.proto(+39/-9, API):PluginBodywith nestedskillsandmcp_servers, andManifest.agent_plugins_enabled.codersdk/workspacesdk/frontmatter.go(+31/-0):ValidatePluginNameandMaxPluginNameLength(manifest name grammar).coderd/database/queries/chats.sql,workspaceagentcontext.sql, migration 000642 (+28/-7, DB): theplugin_namecolumn on both context resource tables, copied by the hydrate, MCP sync, and re-pin queries.codersdk/agentsdk/agentsdk.go,agent/agent.go(+18/-4, API):Manifest.AgentPluginsEnabledandConnectRPC217WithRole; the agent dials v2.17.coderd/agentapi/api.go,manifest.go(+4): the manifest flag follows the experiment.tailnet/proto/version.go(+8/-1, API): Agent API v2.17.codersdk/deployment.go(+4, API): theagent-pluginsexperiment.This PR was generated by Coder Agents on behalf of @jscottmiller.