Skip to content
This repository was archived by the owner on Aug 24, 2026. It is now read-only.

fix: route Pro/Flash persona by the session-selected model (assembled.variables), not agent.options (issue #9) - #21

Open
baka-world wants to merge 1 commit into
yjh051108:mainfrom
baka-world:fix/session-model
Open

fix: route Pro/Flash persona by the session-selected model (assembled.variables), not agent.options (issue #9)#21
baka-world wants to merge 1 commit into
yjh051108:mainfrom
baka-world:fix/session-model

Conversation

@baka-world

Copy link
Copy Markdown

问题

router 判断 Pro/Flash 时读 agent.options?.model,但 DSH 中这是启动默认模型;会话里手动切换模型后,实际请求走的是会话选择,agent.options 不会更新。结果:全局默认 Flash、会话选 Pro 时,weak 模式的 persona 仍按 Flash 选(issue #9 已给出稳定复现与 request/header 证据)。

根因

DSH rc.6 的 dsh-agent 里,会话级模型选择由 installModelSelectionsystem-prompt/assemble 阶段写入 assembled.variables.provider/model,并在 agent/request 应用。router 没读这个来源。

修复

四个 bootstrap 文件(router-standard/router-spec-v1.mjs 与旧 router-bootstrap.mjs)统一改为:

  • assemble 时:sessionModels 记录 assembled.variables 中的 {provider, model}personaForselected.model ?? agent.options.model
  • dev_router_status:显示会话实际模型(fallback agent.options);
  • dev_mode_subagent:子调用路由用会话实际 provider/model(fallback agent.options)。
const selectedModel = assembled.variables?.model
  ? { provider: assembled.variables?.provider, model: assembled.variables.model }
  : undefined
if (selectedModel?.model) sessionModels.set(session.id, selectedModel)
const modelId = selectedModel?.model ?? agent.options?.model

回归测试(17/17)

新增 2 条插件层测试:

  • weak persona follows the session-selected model, not agent.options (issue #9)——launch 默认 Pro、会话实际 Flash 时,persona 必须是 WEAK_FLASH;
  • weak persona falls back to agent.options when no session selection is present

红→绿:修复前 16/17(新测试红),修复后 17/17。

说明

本 PR 与 #8 同文件不同行,互补;与 #16 的测试 import 路径修复重叠(本分支同样修正该路径,npm test 才能运行)。

Closes #9

huozhetiaozhehuopopo added a commit to huozhetiaozhehuopopo/dsh-router-standard that referenced this pull request Aug 16, 2026
- yjh051108#17.1: agent/inbox/claimed 监听——首轮路由不再依赖 user/message 事件时序
  (claim 先于 assemble,首轮即真实分类),过滤 kind=user
- yjh051108#17.2: sessionMode 只分类真实用户消息(插件注入不再钉死 weak);
  并修复上游过滤对嵌套形状(issue yjh051108#1)的回归——兼容 data.message.source
- yjh051108#21: 会话选择模型(assembled.variables)优先于 agent.options 用于
  persona/dev_router_status/dev_mode_subagent(issue yjh051108#9)
- yjh051108#5: 子代理(parentSession)跳过 router 组装,修复 shell-less 崩溃
- 回归测试 6 项先红后绿(负向验证:吸收前 17/23,吸收后 23/23)

(由 DSH 生成:model=deepseek-v4-flash · router-mode=spec(band=weak) · harness=dsh web · preset=router-spec v0.2.1-local)
huozhetiaozhehuopopo added a commit to huozhetiaozhehuopopo/dsh-router-standard that referenced this pull request Aug 16, 2026
- version 0.2.1 → 0.2.2(吸收 yjh051108#17/yjh051108#21/yjh051108#5 后的版本)
- README 新增「Fork 版本说明」:0.2.1(吸收前,5 项修复,17/17)vs
  0.2.2(吸收后,23/23)差异表 + 版本语义 + 与上游关系
- CHANGELOG.md 新建:两版完整变更记录 + 上游互证/观察项

(由 DSH 生成:model=deepseek-v4-flash · router-mode=spec(band=weak) · harness=dsh web · preset=router-spec v0.2.1-local)
huozhetiaozhehuopopo added a commit to huozhetiaozhehuopopo/dsh-router-standard that referenced this pull request Aug 16, 2026
- yjh051108#17.1: agent/inbox/claimed 监听——首轮路由不再依赖 user/message 事件时序
  (claim 先于 assemble,首轮即真实分类),过滤 kind=user
- yjh051108#17.2: sessionMode 只分类真实用户消息(插件注入不再钉死 weak);
  并修复上游过滤对嵌套形状(issue yjh051108#1)的回归——兼容 data.message.source
- yjh051108#21: 会话选择模型(assembled.variables)优先于 agent.options 用于
  persona/dev_router_status/dev_mode_subagent(issue yjh051108#9)
- yjh051108#5: 子代理(parentSession)跳过 router 组装,修复 shell-less 崩溃
- 回归测试 6 项先红后绿(负向验证:吸收前 17/23,吸收后 23/23)

(由 DSH 生成:model=deepseek-v4-flash · router-mode=spec(band=weak) · harness=dsh web · preset=router-spec v0.2.1-local)
huozhetiaozhehuopopo added a commit to huozhetiaozhehuopopo/dsh-router-standard that referenced this pull request Aug 16, 2026
- version 0.2.1 → 0.2.2(吸收 yjh051108#17/yjh051108#21/yjh051108#5 后的版本)
- README 新增「Fork 版本说明」:0.2.1(吸收前,5 项修复,17/17)vs
  0.2.2(吸收后,23/23)差异表 + 版本语义 + 与上游关系
- CHANGELOG.md 新建:两版完整变更记录 + 上游互证/观察项

(由 DSH 生成:model=deepseek-v4-flash · router-mode=spec(band=weak) · harness=dsh web · preset=router-spec v0.2.1-local)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug:Router 使用 agent.options.model 而不是当前会话实际选择的模型,导致 V4 Pro / Flash 识别错误

1 participant