Skip to content

feat: resolve custom agent types in spawn_agent - #51

Merged
ibetitsmike merged 7 commits into
mainfrom
mike/custom-agent-types-3-lookup
Nov 9, 2026
Merged

ibetitsmike merged 7 commits into
mainfrom
mike/custom-agent-types-3-lookup

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

With the fork-agent-definitions experiment on, spawn_agent accepts the custom agent types that #38 discovers in the chat's workspace.

A chat pins its agent's context resources when it is created. Each pinned subagent resource with status ok is parsed with workspacesdk.ParseAgentDefinition and becomes a spawn_agent type named after the definition (coderd/x/chatd/fork_agent_definitions.go).

  • The tool description lists custom types after the built-in types. Each description is whitespace-collapsed and cut to 256 bytes on a rune boundary; the custom descriptions share a 2048-byte budget, and later types then show custom agent.
  • Built-in names win: a definition named general, explore or computer_use is dropped, and duplicate names keep the first. Definitions that fail to decode or parse are skipped, and a failed resource read logs a warning and lists only the built-in types, so a bad file never breaks a turn.
  • The child chat gets the definition body as a system message and builds on the definition's base type (general or explore).
  • The definition's model is matched case-insensitively against the spawnable model configs by config ID, then model, then display name. If nothing matches, the spawn fails and the error points at list_subagent_models. A definition without a model (or with model: inherit) runs on the parent's current model, not the deployment's subagent model override. The definition's effort/reasoning_effort must be a valid reasoning effort. An explicit model_config_id or reasoning_effort argument still wins.
  • The child's chat_subagents row stores the custom type. createSubagentChatWithID now writes that row for custom types even with fork-nested-subagents off.
  • With the experiment off nothing changes, and no extra query runs while the tool list is built.

tools, readonly, mcp and disallowedTools are not enforced yet: a custom type gets its base type's tools until the next PR in the stack. Upstream files get only call-site hooks in subagent_catalog.go and subagent_operations.go.

Part of #7.

Xum opened this PR on behalf of @ibetitsmike.

Behind the fork-agent-definitions experiment, spawn_agent resolves custom
agent types from the chat's pinned subagent context resources after the
built-in types. A custom child runs with the definition body as a system
message and the definition's model and reasoning effort unless the call
passes explicit ones, and its chat_subagents row records the custom type.
The spawn_agent description lists the custom types within a byte budget.
@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-09T13:03:01.589785Z 2b8f29f 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.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@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: 209c6a7813

ℹ️ 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
@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. You're on a roll.

Reviewed commit: d30ea68d28

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

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 2b8f29fbe5

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

This was referenced Nov 9, 2026
@ibetitsmike
ibetitsmike merged commit 1a00411 into main Nov 9, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/custom-agent-types-3-lookup branch November 9, 2026 14:27
@ibetitsmike

Copy link
Copy Markdown
Owner Author

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

Merged at 7f355e8 after these checks:

  • 7f355e8 merges main (e7ecf55) into the accepted head 2b8f29f. With index and @@ lines removed, git diff origin/main...7f355e8621 matches the accepted patch byte for byte, so the Codex review and the UAT still apply.
  • fork-ci run 42632199812 passes all checks on the exact head.
  • Codex review at 13:03:00Z on 2b8f29f found no major issues, and 0 review threads are unresolved.
  • UAT round 5 passed on the accepted patch. The lead reviewed the diff against the W1 brief: custom types are gated by the new fork-agent-definitions experiment and resolve with the chat owner's access.
  • git merge-tree against main e7ecf55 is clean. The local deployment of f0e3940 (feat(coderd): cascade interrupts and archive active nested subagent families #42) is healthy, so the merge slot is open.

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