🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

feat: allow spawn_agent model and reasoning effort override - #27385

Merged
ibetitsmike merged 8 commits into
mainfrom
mike/spawn-agent-model-override
Jul 22, 2026
Merged

feat: allow spawn_agent model and reasoning effort override#27385
ibetitsmike merged 8 commits into
mainfrom
mike/spawn-agent-model-override

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Adds explicit model selection to subagent spawning. A parent agent can now discover which chat model configs are usable and spawn a child subagent on a specific model and reasoning effort, instead of always inheriting the configured default chain. The transcript shows the selection on the spawn row.

Changes

  • New list_subagent_models chatd tool: returns the caller-usable model configs (UUID, display name, model, provider, context limit, default flag, selectable reasoning efforts). Hidden for delegated child chats, same gating as spawn_agent.
  • New optional spawn_agent args:
    • model_config_id (UUID from list_subagent_models): the child chat is created on that config. Wins over personal and deployment overrides and over parent inheritance.
    • reasoning_effort (none/minimal/low/medium/high/xhigh/max): pins the child's effort, clamped to the selected model's supported range at generation time. Independent of model_config_id.
  • Hard failures, never silent fallback: malformed or unknown UUID, disabled config, disabled or deleted provider, credential-unusable config, and invalid effort values are rejected with distinct tool errors before any child chat is created.
  • type: "computer_use" rejects both args with a documented error; its model routing stays specialized.
  • Spawns without the new args are byte-for-byte unchanged (personal override, deployment override, inheritance, explore current-turn fallback).
  • Transcript: spawn rows with an explicit selection render Spawned {title} with {model display name}, {effort} thinking. Effort display mirrors backend resolution (requested wins over the config default, clamped to the config max, omitted for models without effort settings). Spawns without explicit args are unchanged. Resolution uses the current model config catalog, so later admin edits to a config can shift historic labels.
  • Docs: docs/ai-coder/agents/{architecture,index,models}.md updated to describe spawn-time model selection.

No DB migrations, codersdk, or HTTP API changes; the selection reuses the existing LastModelConfigID persistence and enabled-config resolver.

Testing

  • New internal tests in coderd/x/chatd/subagent_internal_test.go covering explicit selection, precedence over overrides, effort-only and combined spawns, all rejection paths, computer_use rejection, and list_subagent_models visibility filtering.
  • Frontend: spawnModelDisplay.test.ts unit tests for the label resolver (default fallback, clamping, unknown config, none, out-of-scale values) plus Storybook play-function stories for the four label variants.
  • go test ./coderd/x/chatd/ green; make lint, pnpm lint, and formatting clean.
  • Manual UAT against a live develop.sh deployment: all six plan flows plus edge cases passed (children verified via DB last_model_config_id and initial-message reasoning effort).

This PR was written by Mux, an AI coding agent, acting on Mike's behalf.

…erride

Adds optional model_config_id and reasoning_effort arguments to
spawn_agent for general and explore subagents. Explicit selections win
over personal and deployment subagent overrides but still require an
enabled config, an enabled provider, and usable owner credentials;
unusable selections fail the tool call instead of falling back.

Adds a list_subagent_models tool so agents can discover the enabled,
credential-usable model configs and their selectable reasoning efforts.

computer_use keeps its dedicated provider routing and rejects both
arguments.
…bing

Threads the explicit model selection into buildOptions so configured
override resolution is skipped instead of resolved and discarded, caches
provider keys per provider in list_subagent_models, and reuses
chatprovider.IsValidReasoningEffort for effort validation.
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: c910457b42

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 77c666f075

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

@codex review

@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: ec01037d51

ℹ️ 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 site/src/pages/AgentsPage/components/ChatElements/tools/spawnModelDisplay.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 35bc2e94ce

ℹ️ 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/subagent_catalog.go
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8fa4f18f02

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

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review of the frontend side of things

Comment thread site/src/pages/AgentsPage/components/ChatElements/tools/spawnModelDisplay.ts Outdated
@ibetitsmike
ibetitsmike merged commit 02fd1cc into main Jul 22, 2026
52 of 55 checks passed
@ibetitsmike
ibetitsmike deleted the mike/spawn-agent-model-override branch July 22, 2026 16:43
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants