Skip to content

feat(coderd/x/chatd): offer project agent definitions to spawn_agent - #90

Merged
ibetitsmike merged 2 commits into
mainfrom
mike/custom-agent-types-9c-project-catalog
Nov 10, 2026
Merged

ibetitsmike merged 2 commits into
mainfrom
mike/custom-agent-types-9c-project-catalog

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #7

With fork-agent-definitions on, spawn_agent now offers the enabled agent definitions of the chat's project, next to the workspace, personal and organization types. #72 added the project-tier queries and #77 adds their routes, but chatd never read the project tier, so a project's types could be stored and never spawned.

Change

  • storedAgentTypes resolves the chat's project with resolveUsableChatProjectID, the check project instructions and skills use. A child chat uses its root chat's project, and a project the owner can no longer use (not owned, not shared) contributes no types.
  • Project definitions are listed with ListProjectAgentDefinitionMetadata and loaded on spawn with GetProjectAgentDefinitionByName. Both run as chatd after the usable-project check, like project skills, so role grants alone do not expose a project's types. Disabled rows are skipped.
  • The merge order is personal, organization, project, workspace, and the skill alias rules apply: a name in more than one tier is only reachable as project/<name> and the other tier-qualified names.
  • docs/fork/pstack-adapter.md describes the project tier.

Tests

  • TestForkAgentDefinitionProjectTier: a project reviewer and projbot sit next to a workspace reviewer. The tool description lists project/reviewer, workspace/reviewer and bare projbot, both project types spawn with their own prompts, and a child chat, which carries no project, still offers projbot from its root chat's project.
  • TestForkAgentDefinitionProjectTierUsable: the project owner and a user the project is shared with see projbot; an unshared member and a site owner see nothing.
  • Negative controls: resolveChatProjectID instead of the usable check turns ProjectTierUsable red; dropping the project tier from the merge turns both red.
  • Ran in Colima: go test ./coderd/x/chatd/, ok on the merge with main 873db0e. golangci-lint and go vet found nothing.

Size

About 165 changed lines: about 45 implementation, about 120 tests, and a few doc lines.

@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 10, 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-10T01:01:39.410130Z e39e97e 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: e39e97e249

ℹ️ 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 (d02b59ef24) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 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 (d02b59ef24), 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 reopened this Nov 10, 2026
@ibetitsmike
ibetitsmike merged commit 1ef5ccc into main Nov 10, 2026
21 of 28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/custom-agent-types-9c-project-catalog branch November 10, 2026 01:27
@ibetitsmike

Copy link
Copy Markdown
Owner Author

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

Merge evidence for head e39e97e249f3712e91f97512bf997b5d12d54144:

  • fork-ci pull_request run 42733937738 passed; its build job checked out Merge e39e97e249 into d02b59ef24 (current main, deployed and healthy at 01:25Z). All checks green.
  • Codex review on this exact head: no major issues. 0 unresolved review threads. Merge state CLEAN.
  • UAT on this head merged with main (fresh DB, mock provider): a chat in a project offers that project's enabled definitions, qualified as project/<name> when a name collides, and leaves out disabled ones. Each spawn gets its own definition prompt. A chat outside the project does not offer them. A user with shared use access can spawn them, and loses that on the next turn after removal from the ACL.

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