Skip to content

feat(coderd/x/chatd): offer stored personal and organization agent types to spawn_agent - #69

Merged
ibetitsmike merged 2 commits into
mainfrom
mike/custom-agent-types-7-stored-catalog
Nov 9, 2026
Merged

ibetitsmike merged 2 commits into
mainfrom
mike/custom-agent-types-7-stored-catalog

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #7

spawn_agent now offers stored agent definitions next to the workspace ones, behind fork-agent-definitions. Before this PR, it offered only the types pinned from the workspace's agent files.

What spawn_agent offers

Tier Source Who sees it
workspace the chat's pinned subagent context resources (unchanged) the chat
personal the chat owner's enabled user-tier rows in the chat's organization the owner, while they are a member
org the organization's enabled rows members the row's ACL shares it with (Everyone by default)
  • Stored tiers are read as the chat owner (chatOwnerSubject, the same subject org skills use), so dbauthz from feat(coderd/database): store agent definitions for users and organizations #62 applies organization membership and ACLs. A probe confirmed that this subject carries the owner's organization roles.
  • Collisions follow the skill rules (skillspkg.MergeSkills and Lookup). A name that several tiers define is listed only as personal/reviewer, org/reviewer and workspace/reviewer, and the bare name is rejected. A name that one tier defines is listed bare, and its qualified form also works.
  • Built-in names (general, explore) stay reserved in every tier.
  • The catalog uses the stored description. The content is read and parsed only when the type spawns, so a turn does not load every definition body. At that point the row must still be enabled, and its front-matter name must match the row name, so a row cannot spawn as a built-in type.
  • Read and parse failures drop types instead of failing the turn, as before.

Tests

  • TestForkAgentDefinitionStoredTiers: a name in three tiers is listed only qualified, and the bare name is rejected. Each qualified form and a single-tier name spawn with the right prompt and record the plain name on chat_subagents. Disabled rows and built-in names are hidden, and a row whose content names general fails to spawn.
  • TestParseStoredAgentDefinitionDisabled: a row disabled after listing does not load.
  • TestForkAgentDefinitionStoredTiersAuthz (dbauthz-wrapped store): a member sees their own personal type and the Everyone-shared org type, but not another member's type or an org type with an empty ACL. A non-member sees nothing.
  • Negative controls, each run against the tests: reading as the system instead of the owner, removing the enabled filter, matching bare names directly instead of Lookup, removing the built-in reservation, dropping the stored tiers, or removing the load-time enabled or name check makes a test fail.
  • Ran in Colima: go test ./coderd/x/chatd/... (20 packages ok) and golangci-lint on ./coderd/x/chatd/... (no findings in the changed files).

ARCHITECTURE.md gets a TODO for the owner to describe the stored tiers.

Size

About 375 changed lines: about 195 implementation, about 180 tests and 1 doc TODO.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T21:26:51.338872Z 4c1c8cd Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4c2375553

ℹ️ 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".

Comment thread coderd/x/chatd/ARCHITECTURE.md Resolved
A stored definition disabled after the catalog listed it no longer spawns,
and its content must keep the row's name, so a row cannot spawn as a
built-in type.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 4c1c8cd0d2

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (25f19f624d) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike closed this Nov 9, 2026
@ibetitsmike ibetitsmike reopened this Nov 9, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (25f19f624d), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike closed this Nov 9, 2026
@ibetitsmike ibetitsmike reopened this Nov 9, 2026
@ibetitsmike
ibetitsmike merged commit e6cd44a into main Nov 9, 2026
21 of 28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/custom-agent-types-7-stored-catalog branch November 9, 2026 23:36
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head 4c1c8cd0d2f5e81f79b8644ab8df12d2631aa2db:

  • fork-ci pull_request run 42719499545 passed; its build job checked out Merge 4c1c8cd0d2 into 25f19f624d (current main, deployed and healthy at 23:33Z). All checks green.
  • Codex review on this exact head: no major issues. 0 unresolved review threads. Merge state CLEAN.
  • UAT on a server-only build of this head merged with 25f19f6 (fresh DB, mock OpenAI provider): spawn_agent offers the right stored personal and organization types per user, spawns of each succeed, collisions, disabled rows, empty ACLs and the experiment-off case are rejected or hidden as expected, and each child's system prompt carries the right definition body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant