Repository navigation
feat: serve project-tier agent definitions behind fork-agent-definitions - #77
Conversation
…initions
Add CRUD routes for a member's stored agent definitions under
/api/v2/chats/fork/organizations/{organization}/members/{user}/agent-definitions,
the SDK types and client methods, and the generated API docs. Content is
parsed with workspacesdk.ParseAgentDefinition and the front-matter names the
definition. Writes are not audited.
Part of #7.
Add CRUD routes for organization-tier stored agent definitions under
/api/v2/chats/fork/organizations/{organization}/agent-definitions and the
SDK methods. A new definition grants read to the Everyone group, like a new
organization skill, and the list is filtered by each row's ACL.
Part of #7.
…erence The routes are gated by an experiment, so mark them with @x-apidocgen skip like the fork chat todo routes.
…es-6-agent-definition-routes
… mike/custom-agent-types-6b-org-agent-definition-routes
Project readers can list and read a chat project's agent definitions; callers who can update the project can create, update and delete them. Everyone else gets 404, like the project skill routes.
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. |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
…es-9-project-queries # Conflicts: # coderd/database/forkdb/agent_definitions.sql.go # coderd/database/forkdb/sqlc.yaml # coderd/database/migrations/chatdmig/nodes/01a1c242-decb-7db2-b52e-38c2843c434c_agent_definition_acl_org_member_delete.up.sql # coderd/fork_agent_definitions_test.go # coderd/fork_organization_agent_definitions_acl.go
…t-queries' into mike/custom-agent-types-9b-project-routes
…es-9b-project-routes
|
@codex review
|
|
Codex Review: Didn't find any major issues. Hooray! 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". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
Part of #7
Stacked on #72. Second of three project-tier PRs: this one adds the fork routes for project-tier agent definitions on top of the queries in #72. The last PR resolves project-tier rows into the spawn catalog behind the usable-project check, after #69 lands.
Routes
Under
/api/v2/chats/fork/organizations/{organization}/projects/{project}/agent-definitions, behind thefork-agent-definitionsexperiment:///{agentDefinition}/{agentDefinition}/{agentDefinition}ExtractChatProjectParamreturns 404 when the project is not in the path's organization. The handler then checks the action on the project before it reads the body, likestartChatProjectSkillWrite, and returns 404 when the check fails. With the project ACL, theuserole can read definitions and theadminrole can also change them. Request parsing, the name check on update and the error mapping are shared with the user and organization tiers; the mapping now also coversagent_definitions_project_name_idx(409) andagent_definitions_per_project_limit(409). The routes carry@x-apidocgen {"skip": true}like the other fork routes, so onlyswagger.jsonanddocs.gochange.The SDK gets
ForkProjectAgentDefinitions,ForkProjectAgentDefinition,CreateForkProjectAgentDefinition,UpdateForkProjectAgentDefinitionandDeleteForkProjectAgentDefinition.Tests
TestForkProjectAgentDefinitions/Enabled: owner CRUD, 409 on a duplicate name, 400 on a front-matter rename, 404 through another organization's path. A member without project access gets 404 on all five routes. With theuserole the member reads and gets 404 on every write, and the definition is unchanged. With theadminrole the member updates and deletes it.TestForkProjectAgentDefinitions/ExperimentOff: 403.Authorizecheck removed, the project unique index dropped from the 409 mapping, and the experiment gate removed.TestForkProjectAgentDefinitions,TestForkUserAgentDefinitions,TestForkOrganizationAgentDefinitions,TestForkChatRoutes,TestEndpointsDocumented,TestSwaggerParametersValid,TestSDKFieldsFormatted,TestEnterpriseEndpointsDocumented, and golangci-lint (no findings in the changed files).Size
346 non-generated lines added: 190 handlers, 12 routes, 34 SDK, 3 error mapping and 107 tests. The rest is swagger output.