feat(core): subagents inherit the parent session's model and thinking level (#38)

Co-authored-by: Alice <alice@prismshadow.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-07-23 00:27:58 +08:00
1 parent cf27b13880
commit 1514cd66b2
12 files changed
+353 -28

No files matched your search

@@ -5,7 +5,7 @@
* The tool itself doesn't depend on Agent/Session, only holding an injected `SubagentRunner`
* (breaking the circular dependency). The model may freely choose the child Agent (`agent_id`)
* and model (`model_id`) via arguments; if omitted, it falls back to reusing the current Agent
* and the Project's default Model respectively. The spawned child session is managed by
* and inheriting the parent session's model respectively. The spawned child session is managed by
* `ManagedSubagentSession` (sharing the `SubagentSessionManager` injected by Environment with
* `input_subagent`).
*
@@ -87,7 +87,7 @@ export function createSubagentTool(
// Caught here rather than in createSession so the model is told which half it left out.
if ((modelId === undefined) !== (provider === undefined)) {
yield* fail(
"[run_subagent error: `model_id` and `provider` must be given together (a model reference is the pair), or both omitted to use the Project default model]",
"[run_subagent error: `model_id` and `provider` must be given together (a model reference is the pair), or both omitted to inherit the parent session's model]",
);
return { stopReason: "failed" };
}