Repository navigation
[Bug] Subagents inherit session-start options.model instead of the current UI-selected model (causes unexpected v4-pro billing) #1472
Replies: 6 comments
|
在官方修复合入前,如果主要诉求是避免子代理继续偷偷走 session-start 的 Pro,可以换用 Pi 子代理运行时作为立即可用的规避路径: dsh plugin --profile web add pi2dsh@0.11.0
dsh plugin --profile web add @tintinweb/pi-subagents
如果费用边界必须绝对固定,还可以在 model: deepseek-official/deepseek-v4-flash然后让主 Agent 用 这不是模拟 child:我们已验证 |
|
Adding a reproduction from dsh 0.1.1-rc.2 on macOS Web UI. The parent session active request route was: provider: toolcode-dsh I started a continuable in-process spawn subagent without any per-call agentOptions override. However, the child descriptor recorded: agentProvider: command-code The child then sent its requests through command-code/stealth/ox-alpha, even though the parent was actively using toolcode-dsh/gpt-5.6-sol. The child subsequently encountered 429 rate limits, empty responses, and stream transport failures. This appears consistent with the current implementation: continuation.js: child-agent.js: The important distinction is that parent.options appears to contain the session-start or agent-creation route, while the Web UI current model selection is reflected in per-request configuration. New subagents therefore inherit a stale route after the parent model is switched. Could you clarify the intended semantics here? Possible fixes:
No session identifiers or credentials are included in this report. 补充一个来自中文用户的复现说明: 在 macOS Web UI 的 dsh 0.1.1-rc.2 中,父会话当前请求使用 toolcode-dsh/gpt-5.6-sol,但新建的 continuable spawn 子代理却使用了 command-code/stealth/ox-alpha。创建调用没有传入 agentOptions 覆盖。 这说明子代理读取的是父 Agent 创建时保存的固定 options,而不是父会话当前请求使用的模型选择。随后子代理出现 429、空响应和流中断。 希望确认这是有意设计,还是应该让新子代理跟随父会话当前模型,或者提供单次 provider/model 覆盖参数。 |
|
Confirmed against the
Note the continuation path calls both: the descriptor snapshot at On the intended semantics. This is now the 6th independent report in the same family, and the costs are concrete in every one of them: #2904 (401s), #3552 (billing misroute), #4077 (429 weekly-quota burn), #4065 (router fan-out + quota), and here — #1472 (v4-pro billing; your rc.2 repro showing
Workaround confirmed end-to-end (duoartisan on #4065): opening a fresh session after switching the default re-stamps the seed, so parent and children agree again — resuming an existing session does not. Until the fix lands, that plus the workflow override are the reliable paths. 中文摘要:已对照 rc.2 源码确认两处快照读取(child-agent.ts:73-78 与 continuation.ts:420-421); |
|
Following up my earlier comment with the verifiable artifact: the workaround's core claim — unpinned Pi-subagent children follow the current model after a UI switch, not the session-start snapshot — is now pinned in e2e on stock Evidence: community/subagents-lifecycle-0.22.0.json. Same boundary as before: a different runtime as mitigation — not a fix of the native creation-time-snapshot bug you traced. |
|
Update: natively fixed in v0.1.2-alpha.1 (yesterday's GitHub release; not on npm yet). |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When the user switches the main conversation model in the Web UI (e.g. to deepseek-v4-flash), subagents spawned afterwards still use deepseek-v4-pro, because they inherit the parent session's CREATION-TIME options.model snapshot instead of the current UI-selected model. This caused unexpected, large v4-pro billing while the UI clearly showed flash.
Evidence
Root cause (code)
packages/.../dsh-subagent/lib/types/child-agent.js -> resolveChildAgentOptions() (lines ~52-57):
const parentProvider = parent.options.provider;
const parentModel = parent.options.model; // session-creation snapshot, NOT the current UI selection
...
...(parentModel !== undefined ? { model: parentModel } : {})
The parent's per-request model comes from the live model-selection mechanism (dsh-agent/lib/types/model-selection.js), but parent.options.model is NOT updated when the UI selection changes, so subagents inherit a stale model.
Expected behavior
Subagents should inherit the model selected for the CURRENT turn/conversation (e.g. if flash is selected now, a subagent/workflow triggered by this turn should run on flash).
Suggested fix
Workarounds (user side)
DSH version: 0.1.0-rc.6 (Windows, Web)
中文附注:普通 subagent 继承会话创建时的 options.model(本会话为 v4-pro),UI 切换模型不传导,导致 pro 意外计费;期望子代理跟随当前对话所选模型。
All reactions