Skip to content

🤖 feat: allow model and thinking overrides on sub-agent launch#3484

Merged
ammario merged 1 commit into
mainfrom
feat/subagent-model-thinking-overrides
Jun 7, 2026
Merged

🤖 feat: allow model and thinking overrides on sub-agent launch#3484
ammario merged 1 commit into
mainfrom
feat/subagent-model-thinking-overrides

Conversation

@ammar-agent
Copy link
Copy Markdown
Collaborator

Summary

Adds optional model and thinking parameters to the task (sub-agent launch) tool so a launching agent can override the spawned sub-agent's model and thinking level. Both default to the existing inherit semantics, and the param descriptions instruct the model to omit them unless explicitly told otherwise (and to never assume a particular model is available).

Background

Previously a sub-agent's model/thinking were always inherited (parent live runtime env → parent workspace AI settings → per-agent config defaults → global default). There was no way for a launching agent to request a specific model/thinking for a delegated task. The override slots (TaskCreateArgs.modelString / thinkingLevel) already existed at the top of resolveTaskAISettings' precedence chain but were never wired to the tool.

Implementation

  • Schema (toolDefinitions.ts): new model and thinking fields on the task tool, both .nullish() (strict-mode convention). thinking is preprocessed to coerce a JSON number to a string before parsing.
  • Handler (tools/task.ts): parseTaskAiOverrides parses the inputs reusing the exact UI logic and forwards them to taskService.create. Invalid input throws a descriptive tool error before any task is spawned. The parent runtime fallback hint is still forwarded so unspecified fields keep inheriting.
  • DRY model parsing: relocated normalizeModelInput from src/browser/utils/models/ to src/common/utils/ai/ (history preserved via git mv; its only deps were already in common), updated the browser importers, and collapsed the duplicate ACP normalizeModelForCommand onto the shared helper.
  • DRY thinking parsing: handler uses parseThinkingInput (named levels OR numeric indices). Numeric indices stay deferred as ParsedThinkingInput and are resolved against the chosen model's policy via resolveThinkingInput inside resolveTaskAISettings (so 2 means the same thing it does for /model+level in the UI). TaskCreateArgs.thinkingLevel was widened from ThinkingLevel to ParsedThinkingInput; existing concrete-level callers are unaffected (named levels pass through unchanged).

Validation

  • make static-check green (lint, typecheck, docs sync regenerated for the two new tool params).
  • New tests: task-tool handler forwards an alias + named thinking, forwards a numeric thinking as a deferred index, and rejects an invalid model before spawning; taskService resolves a numeric thinking override against the inherited model's policy. Full taskService.test.ts (150) and task.test.ts (23) pass.

Risks

Low. Behavior is opt-in; omitting both params preserves the prior inherit path exactly. The thinkingLevel type widening is backward-compatible (named levels are a subset of ParsedThinkingInput and pass through resolveThinkingInput unchanged). The ACP refactor is a straight delegation to an already-tested helper.


Generated with mux • Model: anthropic:claude-opus-4-8 • Thinking: xhigh

Expose optional `model` and `thinking` params on the `task` tool so a
launching agent can override the spawned sub-agent's model and thinking
level. Both default to the existing inherit semantics (parent runtime →
parent workspace → config defaults) and are omitted unless explicitly
instructed.

- Parse `model` with the same alias logic as the UI by relocating
  `normalizeModelInput` from src/browser to src/common (and collapsing the
  duplicate ACP `normalizeModelForCommand` onto it).
- Parse `thinking` with `parseThinkingInput` (named levels OR numeric
  indices); numeric indices stay deferred as ParsedThinkingInput and
  resolve against the chosen model's policy in resolveTaskAISettings.
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Jun 7, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Jun 7, 2026, 8:12 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

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

@ammario ammario merged commit 237efbe into main Jun 7, 2026
24 checks passed
@ammario ammario deleted the feat/subagent-model-thinking-overrides branch June 7, 2026 22:03
@mux-bot mux-bot Bot mentioned this pull request Jun 8, 2026
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.

2 participants