Repository navigation
feat: list the agent types of new chats and spawn_agent - #188
Conversation
ResolveRootAgent resolves an agent type for a new root chat the way spawn_agent does, from the built-in general and explore types and the owner's personal, organization and project definitions. Workspace definitions are not pinned when a chat is created, so they are refused. CreateChat takes the result in CreateOptions.RootAgent. It appends the definition's prompt, sets the base type's mode, drops the orchestration guidance when the type cannot spawn, and stores a depth 0 chat_subagents row with the definition's tool policy in the insert transaction. customAgentToolPolicyOfChat now loads the policy for any chat with a row, so the policy holds for such a root from its first turn. The depth 0 row counts toward no subagent limit: every count selects children by parent_chat_id or root_chat_id.
POST /chats takes agent_type, which starts the chat as general, explore,
or a personal, organization or project agent definition, behind the
fork-agent-definitions experiment. The definition's model and reasoning
effort apply unless the request sets model_config_id or reasoning_effort.
Unknown, unreadable and workspace-only types fail with 400, and so does
agent_type without the experiment.
The chat list, GET /chats/{chat} and the created watch event report the
root's agent_type from its chat_subagents row. Roots without a row are
unchanged.
GET /api/v2/chats/fork/organizations/{organization}/agent-types lists
the built-in general and explore types and the caller's enabled
personal, readable organization and project definitions, plus the
definitions that a workspace's agent reports when workspace= is given.
Each row carries the name spawn_agent accepts, qualified the same way,
its source, description, model and base type, and whether a new root
chat can start as it, with the reason when it cannot. Workspace rows
are never root-available.
The catalog reuses the S1a resolution helpers: mergeCustomAgentTypes
for naming and rootAgentFromDefinition for root availability.
|
@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. |
Root turns now read their tool policy with forkdb.From when fork-agent-definitions is on, so a database.Store wrapper that a turn runs through must forward ForkUnwrap and ForkWrap like dbmetrics does. Without them TestProcessChatPanicRecovery failed its turn before the first model call.
…ge-1b-root-agent-type-api
…t-usage-5-agent-types-catalog
buildTurnEnvironment decided whether to add the ACP subagent guidance from the tools before the custom agent policy filtered them, so a root or child whose policy drops acp_spawn_agent still got the guidance. It now checks the tools that the policy keeps. CreateChat also refuses a RootAgent for a chat with a parent, so a child cannot get a depth 0 chat_subagents row.
…ge-1b-root-agent-type-api
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e894fd226c
ℹ️ 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".
…t-usage-5-agent-types-catalog
…t-usage-5-agent-types-catalog
…ge-1b-root-agent-type-api
List computer_use when spawn_agent offers it, check project= like POST /chats, resolve definition models against the root model (new model_config_id= parameter), and report a workspace with several chat agents as an error.
|
@codex review
|
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
…n its policy Show the ACP guidance only when the policy keeps every ACP tool, drop dynamic tool names whose tools the policy removed, and leave out the create_workspace advice for a detached root that cannot create a workspace.
…ge-1b-root-agent-type-api # Conflicts: # coderd/x/chatd/fork_root_agent.go
…t-usage-5-agent-types-catalog # Conflicts: # coderd/x/chatd/fork_root_agent.go
…ge-1b-root-agent-type-api
…t-usage-5-agent-types-catalog
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0807aac85a
ℹ️ 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: 4219a44de5
ℹ️ 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".
…ge-1b-root-agent-type-api # Conflicts: # docs/fork/pstack-adapter.md
…t-usage-5-agent-types-catalog # Conflicts: # docs/fork/pstack-adapter.md
|
@codex review
|
|
Codex Review: Didn't find any major issues. Delightful! 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". |
…oot-agent-type-api # Conflicts: # coderd/x/chatd/fork_root_agent.go # docs/fork/pstack-adapter.md
…t-usage-5-agent-types-catalog # Conflicts: # docs/fork/pstack-adapter.md
…t-usage-5-agent-types-catalog # Conflicts: # docs/fork/pstack-adapter.md
…ent-types-catalog # Conflicts: # docs/fork/pstack-adapter.md
|
@codex review
|
|
Codex Review: Didn't find any major issues. Nice work! 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
|
The agent type catalog from main (#188) parses workspace agent context rows directly and copied only BodyKind, Body and Status, so it bypassed the fork-plugin-packs filter: with the experiment off it listed pack agent types that spawn_agent does not offer. agentRowDefinitions now carries SourcePath into the converted rows and runs filterPackResources before parsing, matching workspaceAgentDefinitions. TestAgentRowDefinitionsGatesPackAgents covers both experiment states.
* feat: discover plugin packs in agentcontext behind fork-plugins A plugin pack is a directory holding a Claude Code, Cursor or agent-plugins.org manifest. The agentcontext resolver now discovers packs among the direct children of every scan root (and the root itself), reads their manifests, and emits the pack's declared skills and agents directories like ordinary skill and agent containers, honoring Cursor manifest dir overrides while rejecting declarations that leave the pack root. Pack-contributed resources carry the manifest path in SourcePath, and a new chatd gate drops them from the prompt and the context popup when the fork-plugins experiment is off, so a deployment without the flag matches upstream. The KindPlugin manifest resource itself stays agent-local: no DRPC or workspace body kind carries a plugin payload yet, so nothing is pushed for the manifest. The watcher watches pack roots and their declared containers so pack changes re-resolve, and ~/.coder/plugins joins the default scan roots for installed packs. * chore(coderd/apidoc): regenerate for the fork-plugins experiment Adds fork-plugins to the Experiment enum in the generated spec, the schemas.md value list and the site Experiment type, matching the constant added in the parent commit. The enum entries are inserted at the committed position; swag's map-order nondeterminism across deployment.go and fork_experiments.go is not committed. * fix: gate pack contributions in agent types, stamp pack roots, watch manifest edits Codex review follow-ups on PR #156: - Custom agent types now flow through the fork-plugin gate, so pack agents are not offered while fork-plugins is off (the prompt and the context popup already were). - isPackContribution splits on both path separators: the source path is stamped by the workspace agent, which may run on Windows while coderd runs on Linux. - A scan root that is itself a pack now routes through the pack walk, so its resources carry the manifest path and the gate can drop them; ordinary container discovery would have claimed the same files unstamped. - The watcher re-resolves on plugin manifest edits, which fsnotify reports as writes that the recognized-name list did not cover. * fix(agent/agentcontext): bound manifest reads, enforce pack symlink boundary, cap pack resources last Codex round-2 follow-ups on PR #156: - readPluginManifest stats the manifest and rejects files over the 64 KiB per-resource payload cap before reading, so a multi-gigabyte plugin.json cannot be pulled into memory during resolve or watcher synchronization. - Pack skills and agents resolve symlinks against the pack directory instead of the enclosing scan root, so a pack cannot import resources from outside its own boundary. - applyCaps sorts pack contributions last within each kind, so the count cap cuts hidden pack rows before ordinary workspace resources and the chatd fork-plugin filter never leaves an ordinary resource excluded on behalf of a pack. Covers codex threads 4530856974, 4530856958, 4530856947. * fix(coderd/x/chatd): drop unused filepath import from the fork-plugin gate The round-1 gate fix left the import behind; go build fails the package and every package that imports it (fork-ci run 42906095273). * fix(agent/agentcontext): reject special and nameless manifests, keep pack rows out of drift Codex round-3 follow-ups on PR #156: - readPluginManifest Lstats the manifest and requires a regular file, so a checked-in plugin.json symlink (even to /dev/zero) or a FIFO is never read, whatever its apparent size. - A manifest that parses but declares no name is not a pack: the directory keeps ordinary discovery instead of being stamped with the pack marker the fork-plugin gate filters. - driftResources drops pack rows, so installing or editing a pack cannot change the drift hash that hash-comparing subscribers read as a prompt change while fork-plugins is off. Covers codex threads 4531571858, 4531571869, 4531571863. * test(agent/agentcontext): make the round-3 pack tests match resolver discovery Three round-3 tests were written against a wrong mental model and their first execution was the first container validation run: - TestResolver_PluginPacksExcludedFromDrift resolved two different TempDirs and required equal AggregateHashes. The hash covers absolute ID and Source strings, so snapshots of different directories can never hash equal; a stream diff showed the first differing byte was the TempDir serial digit. Resolve one root before and after the pack appears instead: identical paths, so the only way the hash can move is a pack row leaking into the drift set, which is what the test must catch. - TestResolver_PluginPacksNamelessManifest expected a nested pstack/AGENTS.md to be discovered, but ordinary discovery only recognizes instruction files at the scan root's top level. Give the root a top-level AGENTS.md as the positive control and a pack-style skills container under pstack that would be stamped if a nameless manifest were accepted, then require nothing from pstack to appear. - TestResolver_PluginPacksManifestSymlinkRejected passed only vacuously: with no pack containers in its layout, even an accepted symlink emits nothing. Add the skills container and require nothing from pstack to appear. * fix: keep pack rows in the chat drift hash when fork-plugins is on Codex round-4 follow-ups on PR #156: - The agent excludes pack contributions from its pushed aggregate hash unconditionally because it has no experiment knowledge. With fork-plugins on, pack rows are pinned prompt content, so editing one must mark bound chats dirty; the pushed hash never changed and live-sync covers only MCP and ACP, leaving chats on stale pack content. chatd now derives the drift hash itself from the pushed rows via an optional ContextDriftHasher capability: agentapi stores the derived hash on the snapshot row and hydrates and dirties chats against it, so the create-time and refresh pinning paths, which re-read the snapshot row, stay consistent with the push path by construction. With the experiment off the derivation reproduces the agent's exclusion, making the derived hash byte-identical to the pushed one. - addPackWatchDirs arms the deepest existing ancestor of each declared pack container path: a manifest declaring "skills": "components/skills" while only components/ exists got no watch that fires when components/skills is created later (fsnotify is non-recursive), leaving the pack undiscovered until an unrelated resync. Covers codex threads 4532602312 and 4532602321. * test(coderd/agentapi): cover the ContextDriftHasher push path The derived drift hash must land on the snapshot row and return to the dirty marker so create-time and refresh pinning stay consistent with the push path. * fix: negotiate pack emission and keep derived drift parity Round 5 of the codex review loop on PR #156 (threads 4533498689, 4533498695, 4533498700. Emission negotiation (P1, 4533498700): pack rows reached the shared context tables on the agent's first push, so a rolling upgrade with a newer agent behind an older coderd replica could persist pack skills that the old replica pins without a pack gate. PushContextStateResponse now carries a fork_plugin_packs capability (field 100, fork convention), agentapi sets it from a server option wired to the fork-plugin-packs experiment, and the agent's resolver only emits pack rows once a server advertised it; the Manager triggers a resync whenever the advertised value flips in either direction, so retraction applies on the next push. Drift hash (P2, 4533498689): with fork-plugin-packs on but fork-agent-definitions off, pack subagent rows stayed in the derived drift hash although ContextResources removes every subagent entry, so pack agent edits dirtied chats without changing their prompt, tools or visible inventory. DriftHash now skips KindSubagent pack rows unless agent definitions are enabled; ordinary subagent rows stay hashed. Live sync (P2, 4533498695): SyncAgentChatsContextLiveResources compared only bodies, so an unchanged .mcp.json that gains or loses a plugin.json manifest reclassified its MCP rows without ever reaching chat pins. Both change comparisons now include source_path (IS NOT DISTINCT FROM). Rename (lead decision): experiment fork-plugins -> fork-plugin-packs, const ExperimentForkPlugins -> ExperimentForkPluginPacks, with swagger/apidoc/site types regenerated accordingly; fork_plugin_* file names are unchanged. Validated in containers w6-r3val5/r3val5b/r3val5c (protoc 23.4 + pinned plugins, sqlc fork 337309bfb9524f38466a5090e310040fc7af0203 with SKIP_DUMP_SQL=1): agentcontext suite, targeted chatd and agentapi tests, and builds of agent/... agentapi/... chatd/... codersdk/... all green. EOF ) * fix: start every push connection unadvertised and gate pack roots Round 6 of the codex review loop on PR #156 (threads 4534564265, 4534564269, 4534564274). Reconnect leak (P1, 4534564265): a long-lived agent that re-established its dRPC connection against an older replica reused the Manager with the previous connection's advertised flag still set, so the initial push of the new connection led with the pack-bearing snapshot before the new peer's response could reset the capability. RunPush now resets the advertised flag at entry and re-resolves before the first push, so every connection starts pack-free and earns the capability back from its own peer. Root-pack leak (P1, 4534564269): a scan root that is itself a pack stamped its top-level AGENTS.md and .mcp.json before the gated emitPacks call, so an older replica received pack-provided instructions and MCP configuration marked with a marker it ignores. The capability gate now covers the whole root-pack branch: without the advertisement nothing is discovered from a pack root, top-level files included. API artifacts (P2, 4534564274): the round-5 rename missed the x-enum-varnames line in swagger.json (ExperimentForkPlugins) and the value-list row in docs/reference/api/schemas.md (fork-plugins); both now carry the canonical fork-plugin-packs spelling, matching the committed insertion style of 7f5983b without swag's map-order churn. Validated in container w6-r3val6 (no network, warm caches): agentcontext suite, targeted chatd and agentapi tests, and builds of agent/... agentapi/... chatd/... codersdk/... all green. * fix: negotiate pack capabilities and bound pack sources Round 7 of the codex review loop on #156 (threads 4534780508, 4534780514, 4534780521): - Reconnection reset republishes a non-mutating negotiation snapshot: Snapshot gains CapabilityGeneration, resyncNegotiating bumps it and re-publishes with SnapshotError "plugin-pack capability renegotiating", PushContextStateRequest carries capability_generation (proto field 7), and PushContextState skips HydrateAndMarkChatsDirty while it is nonzero. A no-op reconnect can no longer dirty chats pinned to the pack-inclusive hash; the settling push (generation 0) re-pins normally. - Pack agent rows are omitted entirely while the fork-agent-definitions capability is unadvertised. applyCaps count cap is index-based, so previously excluded rows still consumed slots and could starve live MCP/ACP provider rows. PushContextStateResponse gains fork_agent_definitions (field 101), wired from the experiment via agentapi Options and workspaceagentsrpc. - Pack manifests whose SourcePath exceeds the 1024-byte transport limit (coderd/agentapi rejects the whole snapshot, and pushWithRetry would retry a permanently-invalid request) are dropped before emission. Validated in containers w6-r3val8 (proto regen + steps green) and w6-r3val9c (steps green); w6-r3val9b step 1 failed on a wrong Source path in a new test, disclosed to ops and fixed. * fix: forward the definitions capability and settle negotiation pushes Round 8 of the codex review loop on #156 (threads 4535979811, 4535979823): - The DRPC push adapter now maps resp.GetForkAgentDefinitions() into PushResponse, so the production path advertises the capability the peer reported instead of only the in-memory test path. - RunPush settles a negotiation push (nonzero capability generation) with a generation-zero successor resync even when neither capability flipped: a no-flip reconnect previously left the non-mutating negotiation snapshot in place, so chats created while disconnected stayed unhydrated and MCP/ACP live-sync stalled until an unrelated resolver event. Validated in container w6-r3val10 (agentcontext, chatd, agentapi steps and build all green). * fix: make negotiation pushes capability probes and keep capabilities on rejects Round 9 of the codex review loop on #156 (threads 4536229387, 4536229396): - A negotiation push (capability_generation != 0) now persists nothing: no snapshot row, no resource upserts, no stale deletes, no chat state. The previous persist-but-skip-hydration behavior left the temporary pack-free snapshot as the agent's latest, so a chat created or refreshed during the reconnect window pinned a hash the settling push immediately dirtied. Create- and refresh-time hydration now keep consuming the last settled snapshot and its resources as one consistent pair; the settling push (generation 0, guaranteed by the round-8 settle resync) persists the settled inventory and defines the baseline. - The rejected (replay or out-of-order) response now carries both advertised capability fields, not just fork_plugin_packs: the agent reads a zero capability as a retraction and would resync without pack rows until the next accepted response. Agent-side doc comments updated to the probe design; no agent behavior change. Validated in container w6-r3val11 (agentcontext, chatd, agentapi steps and build all green). * fix: harden capability negotiation against reset failures and concurrent resolves Round-10 codex review findings on 7a9736d: - agent/agentcontext/push.go: the connection-start capability reset now also fires while a negotiation window is already open (sticky flag), and a failed reset resync returns an error instead of only logging, so a connection whose rebuild failed never pushes the retained pack-bearing snapshot as settled inventory and the still-open window makes the next connection retry the reset. advertise() gains a negotiated argument that closes the window once the probe was processed, even when the response carries no capabilities, and a single settle trigger covers window close and capability flips. (codex 4536654735) - agent/agentcontext/manager.go: every snapshot published while the negotiation window is open carries a nonzero capability generation. Both publish sites (Resync and resolveAndBroadcast) capture the flag when the resolve starts, so a watcher- or provider-triggered resolve that starts inside the window publishes a probe even if it finishes after the window closes; the first generation-zero publish after the close is capability-complete. (codex 4536654704) - agent/agentcontext/fork_plugins.go: addPackWatchDirs also watches the directory containing a nested manifest (.claude-plugin/plugin.json), which fsnotify cannot see from the pack root; without it manifest edits went unnoticed until an unrelated event. Watcher regression test TestWatcher_FiresOnNestedPackManifestEdit. (codex 4536654717) - agent/proto/agent.proto (+ regenerated agent.pb.go, comment-only): the capability_generation contract now states the negotiation push is a non-persisting capability probe; only its generation-zero successor is stored. (codex 4536654727) Validation: container w6-r3val12 (golang:1.26.10-bookworm, protoc 23.4 regen + go test agentcontext, chatd targeted, agentapi push, build) STEP0-4 all rc=0; regenerated agentsocket.pb.go byte-identical. Closes codex review threads 4536654735, 4536654704, 4536654717, 4536654727. * fix(agent/agentcontext): reject superseded resets, settle synchronously, watch manifest candidates Round-11 codex review findings on 85cb26b: - push.go: a capability reset whose resync pass was superseded by a concurrent resolve gets the previously published snapshot back from Resync's stale-epoch path, which can be the retained pack-bearing generation-zero inventory. RunPush now fails the connection when the reset returns a settled (generation-zero) snapshot; the negotiation window stays open, so the next connection retries the reset. (codex 4537198965) - push.go: advertise swaps the response's capabilities in while the window is still open, then closes the window and settles with a synchronous Resync instead of an asynchronous Trigger, so no resolve can publish a generation-zero snapshot from the reset defaults in the gap between window close and the settling pass. (codex 4537198976) - fork_plugins.go: addPackWatchDirs also watches existing nested manifest candidate directories (.claude-plugin/, .cursor-plugin/) of the scan root and its child directories, whether or not a manifest parses there, so creating or restoring plugin.json fires an event. (codex 4537198982) Tests: TestRunPush_SupersededResetFailsConnection (deterministic gate on Resolver.MCPResources parks the reset resolve behind a newer manual resync) and TestWatcher_FiresWhenNestedPackManifestAppears. Also moves TestWatcher_FiresWhenDeclaredPackContainerAppears' doc comment back onto its function. Validation: container w6-r3val13 STEP1-4 all rc=0 (agentcontext suite, chatd targeted, agentapi push, build). * fix(coderd/x/chatd): gate pack agents in the agent type catalog The agent type catalog from main (#188) parses workspace agent context rows directly and copied only BodyKind, Body and Status, so it bypassed the fork-plugin-packs filter: with the experiment off it listed pack agent types that spawn_agent does not offer. agentRowDefinitions now carries SourcePath into the converted rows and runs filterPackResources before parsing, matching workspaceAgentDefinitions. TestAgentRowDefinitionsGatesPackAgents covers both experiment states. * fix: probe capabilities on first connection, watch declared agent dirs, skip subagent drift when definitions are off - agentcontext: track whether a push connection has been established and reset capability negotiation on the first connection after an agent restart, so the probe runs even when the manager already published a settled snapshot. Only the generation-0 push clears the initial flag, and an unimplemented push RPC closes the negotiation window. - agentcontext: treat writes inside a pack's declared agents container as relevant watcher events and watch those directories. - chatd: exclude every subagent row from the drift hash while fork-agent-definitions is disabled, matching the catalog, context and listing gates. Addresses Codex review comments 4537652618, 4537652671 and 4537652692. Validated in containers w6-r3val15 (agentcontext, chatd, agentapi tests, build) and w6-r3val15b (agent tests on an internal network). * test(agent/agentcontext): resync explicitly in advertised-packs push test Capability negotiation now settles synchronously on the first connection, so TestRunPush_AdvertisedPacksTriggerResync could write its file before Run's watcher registered its watches and then wait forever for a watcher-driven push (fork-ci agent-sdk on 8d940e5). Drive the re-resolve with Manager.Resync like the sibling push tests. Validated in container w6-r3val16: the fork-ci agent-sdk command and -count=20 over every TestRunPush_ test.
Part of #187 (S2, the agent type catalog). Stacked on #185; review only the commits after the merges of #185.
The composer picker (F3) and the Available agents page (F2) need one list of the agent types a user can use, named the way
spawn_agentandPOST /chatsagent_typeaccept them. Behind thefork-agent-definitionsexperiment,GET /api/v2/chats/fork/organizations/{organization}/agent-typesreturns it:spawn_agentoffers (general,explore, andcomputer_usewhen the owner has a computer-use model, by the same predicate), then the caller's enabled personal definitions and the organization definitions the caller can read.project=<id>adds that project's enabled definitions, andworkspace=<id>adds the definitions the workspace's chat agent reports (none when it has no chat agent).name(bare, or qualified such aspersonal/reviewerwhen several sources define it, from the same mergespawn_agentuses),source(builtin,personal,org,project,workspace),description,model,base_type, androot_availablewithroot_unavailable_reason.POST /chats. Workspace rows are never root-available (the workspace isn't bound when a chat is created), and neither is a definition whose model can't be resolved.computer_useis never root-available. An optionalmodel_config_id=picks the root model likePOST /chatsdoes (explicit model, else the personal override, else the default model), which also breaks ties when a definition's model alias matches several providers.project=is checked withvalidateChatProjectSelectionlikePOST /chats(404 for a project the caller can't use, 400 for another organization's);workspace=is checked withvalidateChatWorkspaceSelectionlikePOST /chats(400 for a workspace the caller can't read or SSH into, 404 for one in another organization); 409 when the workspace has several chat agents.@x-apidocgen {"skip": true}like the other fork chat routes; the pstack adapter doc gets a paragraph.Tests:
TestForkAgentTypeschecks the owner's full list (qualification, model, base type,computer_use, unavailable reasons), that a member sees only the built-ins and the shared organization definition, the 404s for another user's workspace, an unknown project and a project the member can't use, the 409 for a workspace with two chat agents, and an alias shared by two providers being available with and withoutmodel_config_id.TestForkAgentTypesExperimentOffchecks the 403. Deliberate breaks (no workspace reason, bare names, system-access org listing, no experiment gate, no 404 for an unreadable workspace, no default root model, read-only project check, ignored multiple chat agents) each fail the test.Checks: targeted
./coderd/(TestForkAgentTypes|TestForkCreateChatAgentType|TestForkChatRoutes) and./coderd/x/chatd/(TestForkRootAgent|TestForkAgentDefinition) tests pass on this head, plusgo build,go vetandgofmt.typesGenerated.tsmatchesscripts/apitypings, and the apidoc matches swag output. The coderdtest Swagger tests run in CI.