Repository navigation
feat: discover custom agent definitions and persist them as subagent context resources - #38
Conversation
…context resources
…ted MCP servers Claude Code names the reasoning level `effort`; accept it, with `reasoning_effort` taking precedence. Claude Code's `mcpServers` adds servers to the inherited set instead of restricting it, so it no longer switches the definition to a named allowlist.
…t-types-2-discovery
coderd rejects a whole PushContextState request when any resource error exceeds 4096 bytes. A definition with many unknown front-matter fields, or a long invalid name quoted in the parse error, produced an unbounded error and stopped every context resource from syncing. Truncate agent definition errors to 1024 bytes on a rune boundary.
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fbea907d7
ℹ️ 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".
- Skip agent containers that resolve outside their scan root, since definitions are shipped whole. - Watch the existing parent of a missing container (such as .claude) so creating the container later is picked up. - Skip a definition whose source is already a resource (an AGENTS.md in an agents scan root); coderd rejects pushes with duplicate sources. - Reject inline mcpServers definitions, which often carry credentials, instead of shipping them with a warning.
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d557af4af
ℹ️ 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
|
|
Codex Review: Didn't find any major issues. 🎉 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". |
Merge evidence at head
|
Part of #7 (second PR of the custom agent types stack, on top of #31).
The workspace agent now discovers custom agent definition files and pushes each one to coderd as a
subagentcontext resource. coderd stores it inworkspace_agent_context_resourceswithbody_kind = 'subagent'. Nothing reads these rows yet; the next PR lets chats spawn them by name.agents/,.agents/agents/,.claude/agents/and.cursor/agents/, so~/.coder/agents/works through the~/.coderroot. A scan root that is itself anagents/directory also works..claude/agents, for example) is skipped, because definitions are shipped whole. When.claude,.cursoror.agentsexists but itsagents/directory does not, the watcher watches the parent so the directory is picked up when created.*.mdfile goes throughworkspacesdk.ParseAgentDefinition(feat(codersdk/workspacesdk): parse custom agent definition files #31). A file without front-matter is skipped. A parse error gives statusinvalid. Warnings for unknown keys go in the row'serrorcolumn, and the status staysok. Symlinks that escape the scan root, unreadable files and oversize files get the same statuses as skills.AGENTS.mdwith front-matter in anagentsscan root) is skipped, since coderd rejects pushes with duplicate sources.mcpServersserver definitions instead of ignoring them with a warning: they often carry credentials inenvor headers, and an invalid file's bytes are never shipped. Server names inmcpServersstill work.SubagentBody(proto tag 100, clear of upstream tags) carries the whole file plus the parsed name and description, so coderd can later use the body as a system prompt without dialing the workspace.Hooks in upstream files are one line each (
resolve.go,watcher.go,drpc.go,agentapi/context.go); the logic lives infork_agents.goandfork_context.go.agent.pb.gois generated.Validation:
go test ./agent/agentcontext/ ./codersdk/workspacesdk/,go vet,gofmt. The new error-cap test fails with the truncation removed and fails with the rune-boundary loop removed.poteto-agent,comment-sicko) checked byte for byte. Round 1 on 8071f13 passed every criterion and found the error-cap defect above. Round 2 on 65edd5c, which has the same diff against feat(codersdk/workspacesdk): parse custom agent definition files #31 that this PR had against main before the Codex fixes, re-tests the fix. The Codex fixes in 9d557af get a short follow-up round.Known gaps, tracked on #7: user-level
~/.claude/agentsand~/.cursor/agentsare not scan roots, and more than 500 definitions can push other definitions intoexcludedunder the existing resource cap.