diff --git a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.i18n.yaml b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.i18n.yaml
index 56a6053125..3bf69cb835 100644
--- a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.i18n.yaml
+++ b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.i18n.yaml
@@ -9,8 +9,8 @@
en: 63a11d729aada846
zh: a54b5069bb176440
/agent-note-live-subagent-model-selection-setting/decision:
- en: cd2ca56a777537fa
- zh: dd334fc1c8f8e9df
+ en: e6ea827eaf115283
+ zh: 994dd77261bc9f4c
/agent-note-live-subagent-model-selection-setting/alternatives-considered:
en: 864544c31f8f92bc
zh: 3fbab0d1567228eb
diff --git a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.md b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.md
index 5dae3bf73a..eb5cc14813 100644
--- a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.md
+++ b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.md
@@ -10,9 +10,9 @@ English | [中文](2026-11-17-live-subagent-model-selection-setting.zh.md)
## Decision
-`SubagentModelSelectionConfig.allowedRoutes()` reads the volatile `enabled` and `allowedModels` values at each call and returns a detached route list, or `undefined` when selection is disabled. The `subagent` executor and `list_subagent_models` call it through `ctx.get('subagentModelSelection')` for every delegation and discovery call, so an edit applies to the next call in every running, restored, and child Session. When the service is absent or the setting is disabled, explicit selection permits only the current parent route, as before.
+`SubagentModelSelectionConfig.allowedRoutes()` reads the volatile `enabled` value at each call and returns `undefined` immediately when selection is disabled; otherwise it validates `allowedModels` and returns a detached route list. The `subagent` executor and `list_subagent_models` call it through `ctx.get('subagentModelSelection')` for explicit route selection by model-selectable tools and for every discovery call, so an edit applies to the next call in every running, restored, and child Session. When the service is absent or the setting is disabled, explicit selection permits only the current parent route, as before.
-No Session event is appended and no projection is registered. The `subagent/model-selection-policy` declaration remains so released Session logs still validate, but no code reads it; a Session that recorded a policy follows the current setting. An enabled setting with an empty or repeated route list fails each call that reads it rather than Agent creation.
+No Session event is appended and no projection is registered. The `subagent/model-selection-policy` declaration remains so released Session logs still validate, but no code reads it; a Session that recorded a policy follows the current setting. An enabled setting with an empty, malformed, or repeated route list fails each call that reads it with `INVALID_MODEL_SELECTION_SETTINGS` rather than rejecting Agent creation. Ordinary delegation and tools with model selection disabled do not read the list.
## Alternatives considered
diff --git a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.zh.md b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.zh.md
index 1e2a1ec6ab..a6ebc06b1a 100644
--- a/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.zh.md
+++ b/.agents/notes/implemented/feature/2026-11-17-live-subagent-model-selection-setting.zh.md
@@ -10,9 +10,9 @@ Status: implemented
## Decision
-`SubagentModelSelectionConfig.allowedRoutes()` 在每次调用时读取 volatile 的 `enabled` 与 `allowedModels`,返回独立的路由列表;选择关闭时返回 `undefined`。`subagent` 执行器和 `list_subagent_models` 在每次委派和发现调用时通过 `ctx.get('subagentModelSelection')` 调用它,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。服务缺失或设置关闭时,显式选择与之前一样只允许当前父级路由。
+`SubagentModelSelectionConfig.allowedRoutes()` 在每次调用时读取 volatile 的 `enabled`;选择关闭时立即返回 `undefined`,否则校验 `allowedModels` 并返回独立的路由列表。`subagent` 执行器和 `list_subagent_models` 在允许模型选择的工具显式选择路由时、每次发现调用时通过 `ctx.get('subagentModelSelection')` 调用它,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。服务缺失或设置关闭时,显式选择与之前一样只允许当前父级路由。
-不追加 Session 事件,也不注册投影。`subagent/model-selection-policy` 声明保留,使已发布的 Session 日志仍能通过校验,但没有代码读取它;记录过策略的 Session 遵循当前设置。启用但路由列表为空或重复的设置会使读取它的每次调用失败,而不是使 Agent 创建失败。
+不追加 Session 事件,也不注册投影。`subagent/model-selection-policy` 声明保留,使已发布的 Session 日志仍能通过校验,但没有代码读取它;记录过策略的 Session 遵循当前设置。启用但路由列表为空、格式无效或重复时,读取该设置的每次调用都会以 `INVALID_MODEL_SELECTION_SETTINGS` 失败,而不是使 Agent 创建失败。普通委派和关闭模型选择的工具不读取该列表。
## Alternatives considered
diff --git a/docs/subsystems/subagent.md b/docs/subsystems/subagent.md
index 2e66d1b8f8..5fbb567931 100644
--- a/docs/subsystems/subagent.md
+++ b/docs/subsystems/subagent.md
@@ -437,7 +437,8 @@ Host settings owner whose current value authorizes explicit child routes in ever
* Read the routes the setting currently authorizes. Each call samples the
* live setting, so an edit applies to the next delegation in every Session.
* @returns a detached route list, or undefined when the setting is disabled.
- * @throws {Error} when the setting is enabled with no route, or its routes are malformed or repeated.
+ * @throws {SubagentError} `INVALID_MODEL_SELECTION_SETTINGS` when the enabled setting has no route,
+ * or its routes are malformed or repeated. Disabled settings do not read or validate routes.
*/
allowedRoutes(): AllowedModelRoute[] | undefined
```
diff --git a/docs/subsystems/subagent.zh.md b/docs/subsystems/subagent.zh.md
index 9791384dce..ee630a59a6 100644
--- a/docs/subsystems/subagent.zh.md
+++ b/docs/subsystems/subagent.zh.md
@@ -439,7 +439,8 @@ Host settings owner whose current value authorizes explicit child routes in ever
* Read the routes the setting currently authorizes. Each call samples the
* live setting, so an edit applies to the next delegation in every Session.
* @returns a detached route list, or undefined when the setting is disabled.
- * @throws {Error} when the setting is enabled with no route, or its routes are malformed or repeated.
+ * @throws {SubagentError} `INVALID_MODEL_SELECTION_SETTINGS` when the enabled setting has no route,
+ * or its routes are malformed or repeated. Disabled settings do not read or validate routes.
*/
allowedRoutes(): AllowedModelRoute[] | undefined
```
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.i18n.yaml
index efdd3fef0d..c71e668775 100644
--- a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.i18n.yaml
+++ b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.i18n.yaml
@@ -9,8 +9,8 @@
en: 174cf7d70925bf18
zh: 131b70ee8fd64bfa
/read-subagent-model-selection-from-the-current-setting/change:
- en: fadb94bccfd97826
- zh: ecf6fd728fe9c9f7
+ en: 5b79350815f34fec
+ zh: 45fef7ddb31103d5
/read-subagent-model-selection-from-the-current-setting/migration:
en: e5b9d6ad303cc734
zh: 79568d41c1072fc0
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.md b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.md
index 56b30723ae..b488355cbf 100644
--- a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.md
+++ b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.md
@@ -9,9 +9,9 @@ English | [中文](guide.zh.md)
## Change
-The Host `@deepseek-ai/dsh-tool-subagent/model-selection-settings` service no longer appends `subagent/model-selection-policy` when an Agent is created. `subagent` and `list_subagent_models` read `ctx.subagentModelSelection.allowedRoutes()` at each call, so a settings edit applies to the next call in every running, restored, and child Session. When the setting is disabled or the service is not mounted, explicit selection permits only the current parent route. Sessions that recorded a policy in an earlier release ignore it and follow the current setting.
+The Host `@deepseek-ai/dsh-tool-subagent/model-selection-settings` service no longer appends `subagent/model-selection-policy` when an Agent is created. Model-selectable `subagent` tools read `ctx.subagentModelSelection.allowedRoutes()` for explicit route selection, and `list_subagent_models` reads it at each call, so a settings edit applies to the next call in every running, restored, and child Session. When the setting is disabled or the service is not mounted, explicit selection permits only the current parent route. Sessions that recorded a policy in an earlier release ignore it and follow the current setting.
-An enabled setting with an empty or repeated route list no longer rejects Agent creation; each delegation or discovery call that reads it fails instead. The service no longer injects `sessions` or `sessionProjections`, and `@deepseek-ai/dsh-tool-subagent` no longer injects `sessionProjections`. The `subagentModelSelectionProjectionDefinition`, `subagentModelSelectionPolicy`, and `SubagentModelSelectionSettings` exports are removed.
+An enabled setting with an empty, malformed, or repeated route list no longer rejects Agent creation; explicit selection and discovery calls that read it fail with `SubagentError` code `INVALID_MODEL_SELECTION_SETTINGS`. Ordinary delegation and tools with model selection disabled do not read the route list. A disabled Host setting returns before reading or validating the list. The service no longer injects `sessions` or `sessionProjections`, and `@deepseek-ai/dsh-tool-subagent` no longer injects `sessionProjections`. The `subagentModelSelectionProjectionDefinition`, `subagentModelSelectionPolicy`, and `SubagentModelSelectionSettings` exports are removed.
## Migration
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.zh.md
index 9d4d50e563..d3a062a2e1 100644
--- a/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.zh.md
+++ b/docs/upgrade-guide/v0.2.2-rc.3/subagent-model-selection-live-setting/guide.zh.md
@@ -9,9 +9,9 @@ description: "Subagent 模型选择在每次调用时读取当前 Host 设置,
## 变更
-Host 的 `@deepseek-ai/dsh-tool-subagent/model-selection-settings` 服务在创建 Agent(智能体)时不再追加 `subagent/model-selection-policy`。`subagent` 和 `list_subagent_models` 在每次调用时读取 `ctx.subagentModelSelection.allowedRoutes()`,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。设置关闭或服务未挂载时,显式选择只允许当前父级路由。早期版本中记录过策略的 Session 会忽略该策略,改用当前设置。
+Host 的 `@deepseek-ai/dsh-tool-subagent/model-selection-settings` 服务在创建 Agent(智能体)时不再追加 `subagent/model-selection-policy`。允许模型选择的 `subagent` 工具在显式选择路由时读取 `ctx.subagentModelSelection.allowedRoutes()`,`list_subagent_models` 在每次调用时读取它,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。设置关闭或服务未挂载时,显式选择只允许当前父级路由。早期版本中记录过策略的 Session 会忽略该策略,改用当前设置。
-启用但路由列表为空或重复的设置不再使 Agent 创建失败,而是使读取它的每次委派或发现调用失败。该服务不再注入 `sessions` 或 `sessionProjections`,`@deepseek-ai/dsh-tool-subagent` 也不再注入 `sessionProjections`。已移除 `subagentModelSelectionProjectionDefinition`、`subagentModelSelectionPolicy` 和 `SubagentModelSelectionSettings` 导出。
+启用但路由列表为空、格式无效或重复的设置不再使 Agent 创建失败;读取它的显式选择和发现调用会抛出错误码为 `INVALID_MODEL_SELECTION_SETTINGS` 的 `SubagentError`。普通委派和关闭模型选择的工具不读取路由列表。Host 设置关闭时会在读取或校验列表之前返回。该服务不再注入 `sessions` 或 `sessionProjections`,`@deepseek-ai/dsh-tool-subagent` 也不再注入 `sessionProjections`。已移除 `subagentModelSelectionProjectionDefinition`、`subagentModelSelectionPolicy` 和 `SubagentModelSelectionSettings` 导出。
## 迁移
diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts
index afddfdc4c5..e94db63583 100644
--- a/packages/extensions/tool-cordis/src/api-catalog.ts
+++ b/packages/extensions/tool-cordis/src/api-catalog.ts
@@ -4037,7 +4037,7 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [
description: 'Read the routes the setting currently authorizes. Each call samples the live setting, so an edit applies to the next delegation in every Session.',
parameters: [],
returns: 'a detached route list, or undefined when the setting is disabled.',
- throws: ['{Error} when the setting is enabled with no route, or its routes are malformed or repeated.'],
+ throws: ['{SubagentError} `INVALID_MODEL_SELECTION_SETTINGS` when the enabled setting has no route, or its routes are malformed or repeated. Disabled settings do not read or validate routes.'],
},
],
},
diff --git a/packages/subagent/subagent/src/error.ts b/packages/subagent/subagent/src/error.ts
index 8e62d33c58..89100005b5 100644
--- a/packages/subagent/subagent/src/error.ts
+++ b/packages/subagent/subagent/src/error.ts
@@ -27,7 +27,9 @@ export type SubagentErrorCode =
| 'PRESET_NOT_ALLOWED'
/** The tool instance does not accept child model selection. */
| 'MODEL_SELECTION_DISABLED'
- /** The Session's model-selection policy does not authorize the requested child provider or route. */
+ /** The enabled Host model-selection setting has invalid routes; correct the setting before retrying. */
+ | 'INVALID_MODEL_SELECTION_SETTINGS'
+ /** The current Host model-selection setting does not authorize the requested child provider or route. */
| 'MODEL_ROUTE_NOT_ALLOWED'
/** The requested LLM provider is not registered with the LLM runtime. */
| 'LLM_PROVIDER_NOT_FOUND'
diff --git a/packages/subagent/tool-subagent/README.i18n.yaml b/packages/subagent/tool-subagent/README.i18n.yaml
index 5e47c3f793..489e4aae20 100644
--- a/packages/subagent/tool-subagent/README.i18n.yaml
+++ b/packages/subagent/tool-subagent/README.i18n.yaml
@@ -27,8 +27,8 @@
en: e28a206c65151ec0
zh: 1372242076549ca4
/deepseek-ai-dsh-tool-subagent/use-this-package/selecting-a-child-llm:
- en: 60f7e2cf330e7d86
- zh: e5c85475f4ed5abc
+ en: c8b91471fb12f907
+ zh: 5086e6c62df65b3b
/deepseek-ai-dsh-tool-subagent/understand-the-implementation:
en: 6ce5f749256a7e6c
zh: a4f2adb04a70d9cf
@@ -36,8 +36,8 @@
en: 6b531756ba1c2c7c
zh: 4e3f7500c83cf02d
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/activation-ownership:
- en: d18fb9d5b85b111e
- zh: d1664580857a4a62
+ en: 4a65fd2ecf132237
+ zh: eb009d94a0b2501a
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/result-acknowledgement:
en: 3c2d70d479be8e38
zh: 9aebdb72223a086e
@@ -132,8 +132,8 @@
en: f5d5f97a153f7c70
zh: 3d6bc05b9eadfbc2
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work:
- en: daa21df80355bdf1
- zh: 3821c51880b3a900
+ en: 5e62d35a22719e99
+ zh: a2bdcf6ef7e40fa4
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work/dev-note:
en: e67f633dc6fe7773
zh: 3bb0c20c93f16f98
diff --git a/packages/subagent/tool-subagent/README.md b/packages/subagent/tool-subagent/README.md
index 5581937ba3..11c06bee4f 100644
--- a/packages/subagent/tool-subagent/README.md
+++ b/packages/subagent/tool-subagent/README.md
@@ -74,7 +74,7 @@ Compose persona and tools in the [preset plugin list](../../preset/agent-preset-
### Selecting a child LLM
-Set `modelSelection: true` to expose optional `provider`, `model`, and `reasoning_effort` fields; instances without it reject selection fields. Set `modelDiscovery: true` on one instance per tool scope to register `list_subagent_models`; it defaults off independently of `modelSelection`. A second discovery owner in the same scope fails to register. Discovery follows its owning plugin instance, remains available when its delegation provider is absent, and is removed when that instance unloads. Web and Desktop presets enable discovery and route fields on spawn and leave both disabled on fork. Each delegation and discovery call reads the Host’s `/model-selection-settings` service, so a settings edit applies to the next call in every running, restored, and child Session. When enabled, discovery and explicit selection permit its exact route list. When it is disabled or not mounted, they permit only the parent Agent’s current effective provider/model and its supported efforts. An enabled setting with an empty or repeated route list rejects each call that reads it. Sessions record no authorization; earlier `subagent/model-selection-policy` events are ignored. Route fields require a backend that advertises `agentOptions`; in-process Spawn and Fork and DSH SDK qualify, while ACP, Codex, and Claude Code fail the mount.
+Set `modelSelection: true` to expose optional `provider`, `model`, and `reasoning_effort` fields; instances without it reject selection fields. Set `modelDiscovery: true` on one instance per tool scope to register `list_subagent_models`; it defaults off independently of `modelSelection`. A second discovery owner in the same scope fails to register. Discovery follows its owning plugin instance, remains available when its delegation provider is absent, and is removed when that instance unloads. Web and Desktop presets enable discovery and route fields on spawn and leave both disabled on fork. Explicit selection by a model-selectable delegation tool and each discovery call read the Host’s `/model-selection-settings` service, so a settings edit applies to the next call in every running, restored, and child Session. When enabled, discovery and explicit selection permit its exact route list. When it is disabled or not mounted, they permit only the parent Agent’s current effective provider/model and its supported efforts. An enabled setting with an empty, malformed, or repeated route list rejects each call that reads it with `SubagentError` code `INVALID_MODEL_SELECTION_SETTINGS`. Ordinary delegation and tools with model selection disabled do not read the route list; a disabled Host setting also leaves the list unread. Sessions record no authorization; earlier `subagent/model-selection-policy` events are ignored. Route fields require a backend that advertises `agentOptions`; in-process Spawn and Fork and DSH SDK qualify, while ACP, Codex, and Claude Code fail the mount.
A call supplies `provider` and `model` together; `reasoning_effort` requires both fields in the same call. An effort-only call rejects before route lookup or child creation. Omitting all three fields preserves configured child defaults and their existing fallback behavior. Static `provider.agentRouteDefaults`, when present, form the provider/model baseline; tool configuration and model fields overlay it before route-aware effort merging and exact-route preflight. Providers without these defaults use compatible values from the parent's latest logged request, then the parent's creation options before its first request, while retaining the configured `maxTokens`. An explicit provider/model pair without an effort clears configured and inherited effort, even when the route is unchanged, so the selected model resolves its default. The live LLM adapter validates the effective route before child creation. Catalog membership remains advisory, so a model can use an unlisted id when its adapter accepts it.
@@ -94,7 +94,7 @@ One instance is one provider plus one tool name. The plugin registers its defini
### Activation ownership
-The tool calls `ctx.subagents.startActivation()` with parent delivery selected. The runtime owns startup cancellation, execution, outcome reporting, and cleanup. A startup failure is an errored tool result. Rejections before startup are coded: a missing calling Agent, `llm` service, or effective parent route throws `ToolContextUnavailableError`; an unpaired route field throws `ToolArgsError`, and an empty route field counts as omitted; and `SubagentError` reports a disabled selection (`MODEL_SELECTION_DISABLED`, `PRESET_SELECTION_DISABLED`), a preset outside the allowlist (`PRESET_NOT_ALLOWED`), a route the current Host setting does not authorize (`MODEL_ROUTE_NOT_ALLOWED`), an LLM provider unknown to discovery (`LLM_PROVIDER_NOT_FOUND`), or a provider replaced during route preflight (`PROVIDER_CHANGED`). When the caller can call `list_subagent_models`, unpaired-field and unauthorized-route rejections tell the model to call it. Failures after publication arrive through the completion notice, with diagnostics and partial output preserved by the runtime.
+The tool calls `ctx.subagents.startActivation()` with parent delivery selected. The runtime owns startup cancellation, execution, outcome reporting, and cleanup. A startup failure is an errored tool result. Rejections before startup are coded: a missing calling Agent, `llm` service, or effective parent route throws `ToolContextUnavailableError`; an unpaired route field throws `ToolArgsError`, and an empty route field counts as omitted; and `SubagentError` reports a disabled selection (`MODEL_SELECTION_DISABLED`, `PRESET_SELECTION_DISABLED`), a preset outside the allowlist (`PRESET_NOT_ALLOWED`), a route the current Host setting does not authorize (`MODEL_ROUTE_NOT_ALLOWED`), invalid enabled model-selection settings (`INVALID_MODEL_SELECTION_SETTINGS`), an LLM provider unknown to discovery (`LLM_PROVIDER_NOT_FOUND`), or a provider replaced during route preflight (`PROVIDER_CHANGED`). When the caller can call `list_subagent_models`, unpaired-field and unauthorized-route rejections tell the model to call it. Failures after publication arrive through the completion notice, with diagnostics and partial output preserved by the runtime.
### Result acknowledgement
@@ -243,7 +243,7 @@ These limits define what this tool does not return or enforce; they are current
- **This tool does not wait for results** — use the completion notice or child messages. Programmatic result waiting belongs to the subagent service.
- **Preset choices omit descriptions** — `agent_preset` exposes ids and default or inheritance guidance only. The schema does not read candidate preset documents, so registration is independent of their declaration order. Use ids that convey each candidate's purpose.
- **Preset references are checked on delegation** — Host-mounted and preset-mounted tools both resolve the target when starting a child. A target can be declared or replaced after tool registration, so loading the tool cannot establish its availability for a later call. Misspelled or unavailable ids remain undetected until selected; that call returns an error.
-- **Shipped fork tools omit model selection** — their configuration leaves `modelSelection` disabled to preserve inherited-prefix reuse. Custom fork tools may enable it under the same Session authorization and adapter validation as other delegation tools.
+- **Shipped fork tools omit model selection** — their configuration leaves `modelSelection` disabled to preserve inherited-prefix reuse. Custom fork tools may enable it under the same Host authorization and adapter validation as other delegation tools.
- **Depth caps are fixed per instance** — another cap requires another distinctly named tool. Child personas and tools belong to the selected Agent Preset. Explicit LLM selection requires `modelSelection` and is restricted to the routes the Host setting authorizes at call time, or the current parent route when it is disabled.
diff --git a/packages/subagent/tool-subagent/README.zh.md b/packages/subagent/tool-subagent/README.zh.md
index 7d656164fb..f9809571d9 100644
--- a/packages/subagent/tool-subagent/README.zh.md
+++ b/packages/subagent/tool-subagent/README.zh.md
@@ -74,7 +74,7 @@ kind: "package-reference"
### 选择子级 LLM
-设置 `modelSelection: true` 后,该实例公开可选的 `provider`、`model` 和 `reasoning_effort` 字段;未设置的实例拒绝选择字段。在每个工具作用域的一个实例上设置 `modelDiscovery: true`,以注册 `list_subagent_models`;该选项独立于 `modelSelection`,默认关闭。同一作用域的第二个发现工具所有者会注册失败。发现工具随其所属插件实例存续,在委派提供方缺席时仍然可用,并在该实例卸载时移除。Web 与 Desktop preset 为 spawn 启用发现和路由字段,为 fork 保持两者关闭。每次委派和发现调用都读取 Host 的 `/model-selection-settings` 服务,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。启用时,发现和显式选择允许其精确路由列表。设置关闭或未挂载时,只允许父 Agent 当前生效的 provider/model 及其支持的强度。启用但路由列表为空或重复时,读取该设置的每次调用都会被拒绝。Session 不记录授权;忽略早期的 `subagent/model-selection-policy` 事件。路由字段要求后端公布 `agentOptions`;进程内 Spawn、Fork 和 DSH SDK 满足条件,ACP、Codex 和 Claude Code 会使挂载失败。
+设置 `modelSelection: true` 后,该实例公开可选的 `provider`、`model` 和 `reasoning_effort` 字段;未设置的实例拒绝选择字段。在每个工具作用域的一个实例上设置 `modelDiscovery: true`,以注册 `list_subagent_models`;该选项独立于 `modelSelection`,默认关闭。同一作用域的第二个发现工具所有者会注册失败。发现工具随其所属插件实例存续,在委派提供方缺席时仍然可用,并在该实例卸载时移除。Web 与 Desktop preset 为 spawn 启用发现和路由字段,为 fork 保持两者关闭。允许模型选择的委派工具在显式选择路由时、发现工具在每次调用时读取 Host 的 `/model-selection-settings` 服务,因此设置编辑会对所有运行中、已恢复和子 Session 的下一次调用生效。启用时,发现和显式选择允许其精确路由列表。设置关闭或未挂载时,只允许父 Agent 当前生效的 provider/model 及其支持的强度。启用但路由列表为空、格式无效或重复时,读取该设置的每次调用都会抛出错误码为 `INVALID_MODEL_SELECTION_SETTINGS` 的 `SubagentError`。普通委派和关闭模型选择的工具不读取路由列表;Host 设置关闭时也不读取该列表。Session 不记录授权;忽略早期的 `subagent/model-selection-policy` 事件。路由字段要求后端公布 `agentOptions`;进程内 Spawn、Fork 和 DSH SDK 满足条件,ACP、Codex 和 Claude Code 会使挂载失败。
一次调用需同时提供 `provider` 与 `model`;`reasoning_effort` 要求同一次调用包含这两个字段。仅指定强度的调用会在查询路由或创建子级之前被拒绝。省略全部三个字段时,保留配置的子级默认值与现有回退行为。静态的 `provider.agentRouteDefaults` 在存在时构成提供方/模型基线;工具配置与模型字段会在路由相关强度合并和确切路由预检前覆盖它。没有这些默认值的提供方会使用父 agent 最新已记录请求中的兼容值,再使用父级首次请求前的创建选项,并保留配置的 `maxTokens`。显式提供提供方/模型组合但省略强度时,会清除配置及继承的强度,即使路由未变,也由所选模型解析自己的默认值。实时 LLM 适配器在创建子 agent 前校验有效路由。目录成员资格只提供建议,因此适配器接受时,模型可以使用未列出的 id。
@@ -94,7 +94,7 @@ kind: "package-reference"
### Activation 所有权
-工具调用 `ctx.subagents.startActivation()`,并选择向父任务交付。运行时拥有启动取消、执行、结果汇报与清理。启动失败产生出错的工具结果。启动前的拒绝都带 code:缺少调用方 Agent、`llm` 服务或有效的父级路由时抛出 `ToolContextUnavailableError`;路由字段未成对提供时抛出 `ToolArgsError`,空字符串路由字段视为未提供;`SubagentError` 报告选择被禁用(`MODEL_SELECTION_DISABLED`、`PRESET_SELECTION_DISABLED`)、preset 不在允许列表中(`PRESET_NOT_ALLOWED`)、当前 Host 设置未授权该路由(`MODEL_ROUTE_NOT_ALLOWED`)、发现查询的 LLM 提供方未注册(`LLM_PROVIDER_NOT_FOUND`),或路由预检期间提供方被替换(`PROVIDER_CHANGED`)。调用方可以调用 `list_subagent_models` 时,未成对字段和未授权路由的拒绝会提示模型调用它。发布后的失败通过完成通知到达,运行时保留诊断和部分输出。
+工具调用 `ctx.subagents.startActivation()`,并选择向父任务交付。运行时拥有启动取消、执行、结果汇报与清理。启动失败产生出错的工具结果。启动前的拒绝都带 code:缺少调用方 Agent、`llm` 服务或有效的父级路由时抛出 `ToolContextUnavailableError`;路由字段未成对提供时抛出 `ToolArgsError`,空字符串路由字段视为未提供;`SubagentError` 报告选择被禁用(`MODEL_SELECTION_DISABLED`、`PRESET_SELECTION_DISABLED`)、preset 不在允许列表中(`PRESET_NOT_ALLOWED`)、当前 Host 设置未授权该路由(`MODEL_ROUTE_NOT_ALLOWED`)、已启用的模型选择设置无效(`INVALID_MODEL_SELECTION_SETTINGS`)、发现查询的 LLM 提供方未注册(`LLM_PROVIDER_NOT_FOUND`),或路由预检期间提供方被替换(`PROVIDER_CHANGED`)。调用方可以调用 `list_subagent_models` 时,未成对字段和未授权路由的拒绝会提示模型调用它。发布后的失败通过完成通知到达,运行时保留诊断和部分输出。
### 结果确认
@@ -243,7 +243,7 @@ Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do no
- **本工具不等待结果**——使用完成通知或子任务消息。程序化结果等待由 subagent 服务提供。
- **预设选项不含描述**——`agent_preset` 只公开 id 及默认或继承提示。schema 不读取候选预设文档,因此注册不依赖它们的声明顺序。请使用能够表达各候选用途的 id。
- **预设引用在委派时检查**——Host 挂载和预设内挂载的工具都在启动子级时解析目标。目标可以在工具注册后声明或替换,因此加载工具无法确定后续调用时目标是否可用。拼错或不可用的 id 在被选中前不会被发现;选中它的调用会返回错误。
-- **随附 fork 工具省略模型选择**:其配置保持 `modelSelection` 关闭,以保留对继承前缀的复用。自定义 fork 工具可以启用它,并接受与其他委派工具相同的 Session 授权和适配器校验。
+- **随附 fork 工具省略模型选择**:其配置保持 `modelSelection` 关闭,以保留对继承前缀的复用。自定义 fork 工具可以启用它,并接受与其他委派工具相同的 Host 授权和适配器校验。
- **深度上限按实例固定** — 更换上限需要另一个不同名称的工具。子级角色和工具由所选 Agent Preset 配置。显式 LLM 选择需要 `modelSelection`,并受调用时 Host 设置授权的路由限制,设置关闭时只允许当前父级路由。
diff --git a/packages/subagent/tool-subagent/src/index.ts b/packages/subagent/tool-subagent/src/index.ts
index 372e6bee2e..073505ac20 100644
--- a/packages/subagent/tool-subagent/src/index.ts
+++ b/packages/subagent/tool-subagent/src/index.ts
@@ -279,10 +279,12 @@ export function apply(ctx: Context, config: Config): void {
throw new ToolContextUnavailableError('subagent tool requires a calling agent (exec.agent was undefined)')
}
- const routes = ctx.get('subagentModelSelection')?.allowedRoutes()
- const modelSelectionPolicy = routes === undefined ? undefined : { routes }
const agentPreset = presets.resolve(args as PresetSelectionRequest)
const modelRequest = delegationModelRequest(args as DelegationModelRequest)
+ const routes = modelSelectionEnabled && hasDelegationModelRequest(modelRequest)
+ ? ctx.get('subagentModelSelection')?.allowedRoutes()
+ : undefined
+ const modelSelectionPolicy = routes === undefined ? undefined : { routes }
const parentOptions = parentAgentOptionsForDelegation(parent)
const requiresRoutePreflight = hasDelegationModelRequest(modelRequest)
|| hasConfiguredLlmSelection(config.agentOptions)
diff --git a/packages/subagent/tool-subagent/src/list-models.ts b/packages/subagent/tool-subagent/src/list-models.ts
index da875955df..e020506c69 100644
--- a/packages/subagent/tool-subagent/src/list-models.ts
+++ b/packages/subagent/tool-subagent/src/list-models.ts
@@ -71,7 +71,7 @@ async function listSubagentModels(
const allowedRoutes = policy.routes.filter(route => route.provider === request.provider)
const [firstRoute] = allowedRoutes
if (firstRoute === undefined) {
- throw new SubagentError(`LLM provider "${request.provider}" is not allowed for this Session`, 'MODEL_ROUTE_NOT_ALLOWED')
+ throw new SubagentError(`LLM provider "${request.provider}" is not allowed by the current subagent model selection setting`, 'MODEL_ROUTE_NOT_ALLOWED')
}
const provider = registeredProvider(llm, policy, request.provider)
if (request.model === undefined) {
@@ -84,7 +84,7 @@ async function listSubagentModels(
: models.map(model => modelLine(provider.id, model)).join('\n')
}
if (!allowedRoutes.some(route => route.model === request.model)) {
- throw new SubagentError(`child LLM route "${provider.id}/${request.model}" is not allowed for this Session`, 'MODEL_ROUTE_NOT_ALLOWED')
+ throw new SubagentError(`child LLM route "${provider.id}/${request.model}" is not allowed by the current subagent model selection setting`, 'MODEL_ROUTE_NOT_ALLOWED')
}
const model = await llm.resolveModelInfo(provider.id, request.model, signal)
const efforts = model.reasoning?.efforts.map(effort => (
diff --git a/packages/subagent/tool-subagent/src/model-selection-settings.ts b/packages/subagent/tool-subagent/src/model-selection-settings.ts
index 3a13950b1a..07a78bf983 100644
--- a/packages/subagent/tool-subagent/src/model-selection-settings.ts
+++ b/packages/subagent/tool-subagent/src/model-selection-settings.ts
@@ -2,6 +2,7 @@
import type { Volatile } from '@deepseek-ai/cordis'
import { Context, Service } from '@deepseek-ai/cordis'
+import { SubagentError } from '@deepseek-ai/dsh-subagent'
import z from '@deepseek-ai/schemastery'
// Retains the released Session event declaration in emitted declarations.
import './model-selection-state.ts'
@@ -13,7 +14,7 @@ import {
declare module '@deepseek-ai/cordis' {
interface Context {
- /** User preference read at each delegation and route-discovery call. */
+ /** User preference read for explicit child route selection and route discovery. */
subagentModelSelection: SubagentModelSelectionConfig
}
}
@@ -41,15 +42,15 @@ export class SubagentModelSelectionConfig extends Service {
* Read the routes the setting currently authorizes. Each call samples the
* live setting, so an edit applies to the next delegation in every Session.
* @returns a detached route list, or undefined when the setting is disabled.
- * @throws {Error} when the setting is enabled with no route, or its routes are malformed or repeated.
+ * @throws {SubagentError} `INVALID_MODEL_SELECTION_SETTINGS` when the enabled setting has no route,
+ * or its routes are malformed or repeated. Disabled settings do not read or validate routes.
*/
allowedRoutes(): AllowedModelRoute[] | undefined {
- const enabled = this.config.enabled.get()
+ if (!this.config.enabled.get()) return undefined
const allowedModels = this.config.allowedModels.get()
assertAllowedModelRoutes(allowedModels)
- if (!enabled) return undefined
if (allowedModels.length === 0) {
- throw new Error('enabled subagent model selection requires at least one allowed model')
+ throw new SubagentError('enabled subagent model selection requires at least one allowed model', 'INVALID_MODEL_SELECTION_SETTINGS')
}
return allowedModels.map(route => ({ ...route }))
}
diff --git a/packages/subagent/tool-subagent/src/model-selection.ts b/packages/subagent/tool-subagent/src/model-selection.ts
index 28cbd4abc2..cb2ff49291 100644
--- a/packages/subagent/tool-subagent/src/model-selection.ts
+++ b/packages/subagent/tool-subagent/src/model-selection.ts
@@ -41,10 +41,11 @@ export function modelRouteKey(route: AllowedModelRoute): string {
* Reject malformed or duplicate route policy entries at a durable or configuration boundary.
* @param routes - Candidate exact routes to validate.
* @returns an assertion that the candidate is a validated exact-route array.
+ * @throws {SubagentError} `INVALID_MODEL_SELECTION_SETTINGS` for malformed or repeated routes.
*/
export function assertAllowedModelRoutes(routes: unknown): asserts routes is readonly AllowedModelRoute[] {
if (!Array.isArray(routes)) {
- throw new Error('subagent model selection requires an array of routes')
+ throw new SubagentError('subagent model selection requires an array of routes', 'INVALID_MODEL_SELECTION_SETTINGS')
}
const seen = new Set()
const candidates: readonly unknown[] = routes
@@ -53,12 +54,12 @@ export function assertAllowedModelRoutes(routes: unknown): asserts routes is rea
|| !('provider' in candidate) || typeof candidate.provider !== 'string'
|| !('model' in candidate) || typeof candidate.model !== 'string'
|| candidate.provider.length === 0 || candidate.model.length === 0) {
- throw new Error('subagent model selection requires non-empty provider and model ids')
+ throw new SubagentError('subagent model selection requires non-empty provider and model ids', 'INVALID_MODEL_SELECTION_SETTINGS')
}
const route = { provider: candidate.provider, model: candidate.model }
const key = modelRouteKey(route)
if (seen.has(key)) {
- throw new Error(`subagent model selection repeats route "${route.provider}/${route.model}"`)
+ throw new SubagentError(`subagent model selection repeats route "${route.provider}/${route.model}"`, 'INVALID_MODEL_SELECTION_SETTINGS')
}
seen.add(key)
}
@@ -171,7 +172,7 @@ export function assertAllowedModelSelection(
? provider === parentOptions.provider && model === parentOptions.model
: policy.routes.some(route => route.provider === provider && route.model === model)
if (allowed) return
- throw new SubagentError(`child LLM route "${provider}/${model}" is not allowed for this Session`
+ throw new SubagentError(`child LLM route "${provider}/${model}" is not allowed by the current subagent model selection setting`
+ (policy === undefined
? '; while subagent model selection is disabled, explicit selection is limited to the parent route'
: '')
diff --git a/packages/subagent/tool-subagent/tests/list-models.spec.ts b/packages/subagent/tool-subagent/tests/list-models.spec.ts
index a5723ed6c3..7dc3703bb8 100644
--- a/packages/subagent/tool-subagent/tests/list-models.spec.ts
+++ b/packages/subagent/tool-subagent/tests/list-models.spec.ts
@@ -263,7 +263,7 @@ describe('list_subagent_models', () => {
const denied = await call(ctx, { provider: 'alpha', model: 'plain' })
expect(denied.isError).toBe(true)
- expect(text(denied)).toContain('is not allowed for this Session')
+ expect(text(denied)).toContain('is not allowed by the current subagent model selection setting')
expect(denied.error?.info).toEqual({ name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' })
})
@@ -276,7 +276,7 @@ describe('list_subagent_models', () => {
const result = await call(ctx, { provider: 'secret' })
expect(result.isError).toBe(true)
- expect(text(result)).toContain('provider "secret" is not allowed for this Session')
+ expect(text(result)).toContain('provider "secret" is not allowed by the current subagent model selection setting')
expect(result.error?.info).toEqual({ name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' })
expect(listModels).not.toHaveBeenCalled()
})
@@ -385,7 +385,7 @@ describe('list_subagent_models', () => {
it.each([
{ args: { model: 'fast' }, expected: '`model` requires `provider`', info: { name: 'ToolArgsError', code: 'INVALID_ARGS' } },
{ args: { provider: '', model: 'fast' }, expected: '`model` requires `provider`', info: { name: 'ToolArgsError', code: 'INVALID_ARGS' } },
- { args: { provider: 'missing' }, expected: 'is not allowed for this Session', info: { name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' } },
+ { args: { provider: 'missing' }, expected: 'is not allowed by the current subagent model selection setting', info: { name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' } },
])('rejects incomplete or unavailable provider requests', async ({ args, expected, info }) => {
const ctx = await setupListTool()
const result = await call(ctx, args)
diff --git a/packages/subagent/tool-subagent/tests/model-selection-settings.spec.ts b/packages/subagent/tool-subagent/tests/model-selection-settings.spec.ts
index 551cce4a57..433df65b02 100644
--- a/packages/subagent/tool-subagent/tests/model-selection-settings.spec.ts
+++ b/packages/subagent/tool-subagent/tests/model-selection-settings.spec.ts
@@ -105,14 +105,19 @@ describe('SubagentModelSelectionConfig', () => {
await ctx.fiber.dispose()
})
- it('rejects duplicate routes and enabled empty settings when read', async () => {
+ it('ignores disabled routes and rejects duplicate or empty routes only while enabled', async () => {
const ctx = ownContext(new Context())
selectionConfigs.set(ctx, await liveConfig(ctx, SubagentModelSelectionConfig))
await selectionConfigs.get(ctx)!.update({ allowedModels: [...ALLOWED_MODELS, ...ALLOWED_MODELS] })
- expect(() => ctx.subagentModelSelection.allowedRoutes()).toThrow('repeats route "alpha/fast-model"')
+ expect(ctx.subagentModelSelection.allowedRoutes()).toBeUndefined()
+ await selectionConfigs.get(ctx)!.update({ enabled: true })
+ expect(() => ctx.subagentModelSelection.allowedRoutes()).toThrow(expect.objectContaining({
+ name: 'SubagentError', code: 'INVALID_MODEL_SELECTION_SETTINGS',
+ message: 'subagent model selection repeats route "alpha/fast-model"',
+ }))
await selectionConfigs.get(ctx)!.update({ enabled: true, allowedModels: [] })
expect(() => ctx.subagentModelSelection.allowedRoutes())
- .toThrow('enabled subagent model selection requires at least one allowed model')
+ .toThrow(expect.objectContaining({ name: 'SubagentError', code: 'INVALID_MODEL_SELECTION_SETTINGS' }))
await selectionConfigs.get(ctx)!.update({ enabled: false })
expect(ctx.subagentModelSelection.allowedRoutes()).toBeUndefined()
await ctx.fiber.dispose()
@@ -211,7 +216,7 @@ describe('SubagentModelSelectionConfig', () => {
})
expect(result.isError).toBe(true)
- expect(text(result)).toContain('is not allowed for this Session')
+ expect(text(result)).toContain('is not allowed by the current subagent model selection setting')
expect(result.error?.info).toEqual({ name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' })
await ctx.fiber.dispose()
})
diff --git a/packages/subagent/tool-subagent/tests/model-selection.spec.ts b/packages/subagent/tool-subagent/tests/model-selection.spec.ts
index d1202e07c1..63f66a3768 100644
--- a/packages/subagent/tool-subagent/tests/model-selection.spec.ts
+++ b/packages/subagent/tool-subagent/tests/model-selection.spec.ts
@@ -43,15 +43,77 @@ function parentWithRoute(
}
describe('dsh-tool-subagent model selection', () => {
- it('rejects empty route ids at the configuration boundary', () => {
- expect(() => { assertAllowedModelRoutes([{ provider: '', model: 'model' }]) })
- .toThrow('requires non-empty provider and model ids')
- expect(() => { assertAllowedModelRoutes([{ provider: 'provider', model: '' }]) })
- .toThrow('requires non-empty provider and model ids')
- expect(() => { assertAllowedModelRoutes({ provider: 'provider', model: 'model' }) })
- .toThrow('requires an array of routes')
- expect(() => { assertAllowedModelRoutes([{ provider: 1, model: 'model' }]) })
- .toThrow('requires non-empty provider and model ids')
+ it.each([
+ { routes: [{ provider: '', model: 'model' }] },
+ { routes: [{ provider: 'provider', model: '' }] },
+ { routes: { provider: 'provider', model: 'model' } },
+ { routes: [{ provider: 1, model: 'model' }] },
+ ])('classifies malformed route settings (%j)', ({ routes }) => {
+ expect(() => { assertAllowedModelRoutes(routes) }).toThrow(expect.objectContaining({
+ name: 'SubagentError', code: 'INVALID_MODEL_SELECTION_SETTINGS',
+ }))
+ })
+
+ it.each([true, false])('isolates invalid Host settings from ordinary delegation (modelSelection=%s)', async (modelSelection) => {
+ for (const allowedModels of [[], [
+ { provider: 'alpha', model: 'parent-model' },
+ { provider: 'alpha', model: 'parent-model' },
+ ]]) {
+ let starts = 0
+ const ctx = await setup({ provider: 'mock', modelSelection, modelDiscovery: true }, {
+ onStart: () => { starts += 1 },
+ })
+ await ctx.plugin(SubagentModelSelectionConfig, { enabled: true, allowedModels })
+
+ const ordinary = await callSubagent(ctx, { description: 'default route', prompt: 'do it' })
+ expect(ordinary.isError).toBe(false)
+ expect(starts).toBe(1)
+
+ const selected = await callSubagent(ctx, {
+ description: 'selected route', prompt: 'do it', provider: 'alpha', model: 'parent-model',
+ })
+ expect(selected.isError).toBe(true)
+ expect(selected.error?.info).toEqual({
+ name: 'SubagentError',
+ code: modelSelection ? 'INVALID_MODEL_SELECTION_SETTINGS' : 'MODEL_SELECTION_DISABLED',
+ })
+ const discovered = await executeToolFixture(ctx, {
+ signal: new AbortController().signal,
+ callId: brandString('invalid-settings-discovery'),
+ name: 'list_subagent_models',
+ arguments: {},
+ agent: modelSelectionSetupAgent(ctx),
+ })
+ expect(discovered.isError).toBe(true)
+ expect(discovered.error?.info).toEqual({ name: 'SubagentError', code: 'INVALID_MODEL_SELECTION_SETTINGS' })
+ expect(starts).toBe(1)
+ }
+ })
+
+ it('uses the parent route when disabled Host settings retain duplicate routes', async () => {
+ let starts = 0
+ const parentRoute = { provider: 'alpha', model: 'parent-model' }
+ const ctx = await setup({
+ provider: 'mock', modelSelection: true, modelDiscovery: true, parentAgentOptions: parentRoute,
+ }, { onStart: () => { starts += 1 } })
+ await ctx.plugin(SubagentModelSelectionConfig, {
+ enabled: false,
+ allowedModels: [parentRoute, parentRoute],
+ })
+ ctx.llm.registerAdapter(['alpha'], new MockAdapter([]))
+
+ const selected = await callSubagent(ctx, { description: 'parent route', prompt: 'do it', ...parentRoute })
+ expect(selected.isError).toBe(false)
+ expect(starts).toBe(1)
+ const discovered = await executeToolFixture(ctx, {
+ signal: new AbortController().signal,
+ callId: brandString('disabled-settings-discovery'),
+ name: 'list_subagent_models',
+ arguments: parentRoute,
+ agent: modelSelectionSetupAgent(ctx),
+ })
+ expect(discovered.isError).toBe(false)
+ expect(text(discovered)).toContain('parent-model')
})
it('checks complete explicit routes against Session authorization or the current parent route', () => {
@@ -224,7 +286,7 @@ describe('dsh-tool-subagent model selection', () => {
model: 'fast-model',
})
expect(result.isError).toBe(true)
- expect(text(result)).toContain('is not allowed for this Session')
+ expect(text(result)).toContain('is not allowed by the current subagent model selection setting')
expect(text(result)).toContain('Call `list_subagent_models` to see the routes you may select.')
expect(result.error?.info).toEqual({ name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' })
})
@@ -615,7 +677,7 @@ describe('dsh-tool-subagent model selection', () => {
description: 'unauthorized route', prompt: 'do it', provider: 'alpha', model: 'denied-model',
})
expect(denied.isError).toBe(true)
- expect(text(denied)).toContain('is not allowed for this Session')
+ expect(text(denied)).toContain('is not allowed by the current subagent model selection setting')
expect(denied.error?.info).toEqual({ name: 'SubagentError', code: 'MODEL_ROUTE_NOT_ALLOWED' })
const invalidEffort = await callSubagent(ctx, {
diff --git a/snapshots/sdk/subagent-dsh-sdk-empty-route/session.v4.jsonl b/snapshots/sdk/subagent-dsh-sdk-empty-route/session.v4.jsonl
index 8c7ed1f3eb..ccb79166df 100644
--- a/snapshots/sdk/subagent-dsh-sdk-empty-route/session.v4.jsonl
+++ b/snapshots/sdk/subagent-dsh-sdk-empty-route/session.v4.jsonl
@@ -15,7 +15,7 @@
{"type":"session/title","data":{"title":"Delegate once; if the requested","messageSeqs":[8],"source":{"kind":"fallback"}}}
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"unlisted-model\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"mock-delegate"},"id":"{{message:5}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":1794890762378,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1794890762378,"index":0,"dt":[],"id":"call-delegate","name":"subagent","args":["{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"unlisted-model\"}"]},{"type":"chunk","time":1794890762378,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"unlisted-model\"}"}}},{"type":"chunk","time":1794890762378,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":1794890762378,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"unlisted-model\"}"}}
-{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call-delegate"},"toolCallId":"call-delegate","content":[{"type":"text","text":"Error: child LLM route \"mock/unlisted-model\" is not allowed for this Session. Call `list_subagent_models` to see the routes you may select."}],"isError":true,"id":"{{message:6}}"},"error":{"name":"SubagentError","code":"MODEL_ROUTE_NOT_ALLOWED"}},"sourceEventSeqs":[15],"surfaceOp":"append"}
+{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call-delegate"},"toolCallId":"call-delegate","content":[{"type":"text","text":"Error: child LLM route \"mock/unlisted-model\" is not allowed by the current subagent model selection setting. Call `list_subagent_models` to see the routes you may select."}],"isError":true,"id":"{{message:6}}"},"error":{"name":"SubagentError","code":"MODEL_ROUTE_NOT_ALLOWED"}},"sourceEventSeqs":[15],"surfaceOp":"append"}
{"type":"step/end","data":{"turn":1,"step":1}}
{"type":"step/start","data":{"turn":1,"step":2}}
{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call-delegate-2","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"\",\"model\":\"\",\"reasoning_effort\":\"\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"mock-delegate"},"id":"{{message:7}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":1794890762398,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1794890762398,"index":0,"dt":[],"id":"call-delegate-2","name":"subagent","args":["{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"\",\"model\":\"\",\"reasoning_effort\":\"\"}"]},{"type":"chunk","time":1794890762398,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call-delegate-2","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"\",\"model\":\"\",\"reasoning_effort\":\"\"}"}}},{"type":"chunk","time":1794890762398,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":1794890762398,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}