🤖 feat: allow model and thinking overrides on sub-agent launch#3484
Merged
Conversation
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ 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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional
modelandthinkingparameters to thetask(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 ofresolveTaskAISettings' precedence chain but were never wired to the tool.Implementation
toolDefinitions.ts): newmodelandthinkingfields on the task tool, both.nullish()(strict-mode convention).thinkingis preprocessed to coerce a JSON number to a string before parsing.tools/task.ts):parseTaskAiOverridesparses the inputs reusing the exact UI logic and forwards them totaskService.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.normalizeModelInputfromsrc/browser/utils/models/tosrc/common/utils/ai/(history preserved viagit mv; its only deps were already incommon), updated the browser importers, and collapsed the duplicate ACPnormalizeModelForCommandonto the shared helper.parseThinkingInput(named levels OR numeric indices). Numeric indices stay deferred asParsedThinkingInputand are resolved against the chosen model's policy viaresolveThinkingInputinsideresolveTaskAISettings(so2means the same thing it does for/model+levelin the UI).TaskCreateArgs.thinkingLevelwas widened fromThinkingLeveltoParsedThinkingInput; existing concrete-level callers are unaffected (named levels pass through unchanged).Validation
make static-checkgreen (lint, typecheck, docs sync regenerated for the two new tool params).taskService.test.ts(150) andtask.test.ts(23) pass.Risks
Low. Behavior is opt-in; omitting both params preserves the prior inherit path exactly. The
thinkingLeveltype widening is backward-compatible (named levels are a subset ofParsedThinkingInputand pass throughresolveThinkingInputunchanged). The ACP refactor is a straight delegation to an already-tested helper.Generated with
mux• Model:anthropic:claude-opus-4-8• Thinking:xhigh