Repository navigation
[Bug / patch available] Third-party plugins can rewrite the deployment default through session.selectModel (dsh-im case) #10784
yingyu4451
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
session.selectModelapplies the acceptedModelSelectionto the addressed session and callssaveDefaultModelSelection()for the shared Agent default (see.agents/notes/archived/feature/2026-08-07-default-model-follows-the-picker.md). For the Web picker this is intended: the picker is the editor of the deployment default.The same Remote is also the only way for integrations to apply a model to a session they created. So a third-party plugin that sets "the model this bot should use" silently rewrites the deployment default for every session created afterwards, in every workspace, including sessions the plugin has nothing to do with. The design note's justification — the picker and the future-session default are one user preference — does not hold for that caller: the user never touched the picker.
Concrete effect: a Feishu bot model card set to
deepseek-flash/Highflipped the GUI default for new conversations fromMaxtoHigh; for the next ~28 hours every new conversation in my workspaces started at High. I hit the same thing earlier through the QQ bot card.Environment
dsh-v0.2.1-rc.2), web profile, Windows 11@xmanrui/dsh-im5.4.0 (community IM bridge; applies its bot model setting throughsession.selectModel)~/.dsh/profiles/web/cordis.patch.yml→agent-default-model.reasoningEffortReproduction (from session logs, +08:00)
2026-10-23 18:55:21— Feishu bot model card set todeepseek-flash/high. dsh-im only writes~/.dsh/integrations/dsh-feishu/workspaces.json; the DSH profile is untouched at this point.18:56:01.716— dsh-im creates a new Feishu session (session-f077d147).18:56:01.759—model/selection {provider: deepseek-official, model: deepseek-flash, reasoningEffort: high}recorded in that session: the bot card applied throughsession.selectModel.18:56:02—agent-default-model.reasoningEffortincordis.patch.ymlbecomeshigh.request/headercarriesreasoningEffort: higheven though nobody opened the picker. Sessions that already logged a request keep their own selection (as designed).Expected
A programmatic caller should be able to apply a model to the session it owns without moving the deployment default, while the GUI picker keeps being that default's editor.
Patch available
SessionSelectModelRequestgets an optionalsaveDefault?: boolean; the backgroundsaveSelection()runs only when it istrue.packages/client/ui-model-selection/src/client/directory.tspassessaveDefault: truefor both entry points (composer control and/modelpopup), so the picker behavior and the design note stay intact; integrations that omit the flag become session-local.805a2c54d9— "fix(session): keep model switches Session-local unless requested"packages/api/session-controller/src/{types,commands,index}.ts,packages/client/ui-model-selection/src/client/directory.tssession-models.host.spec.ts— the two existing default-save specs now passsaveDefault: true; a new spec proves an omitted flag leavesagent-default-modeluntouched while the selection still applies to the session.docs/subsystems/session.mdand Cordis catalog, upgrade guidedocs/upgrade-guide/v0.2.1-rc.2/session-model-selection-local-by-default/.vitest run packages/api/session-controller/tests packages/client/ui-model-selection→ 46 files / 1070 passed / 1 skipped;pnpm run typecheck→ 5 gates passed;verify-cordis-catalog,verify-md-links,verify-upgrade-guidesgreen.Tradeoff
This changes the Remote contract for callers that relied on the implicit default save: they must pass
saveDefault: true. Session format, credentials and permissions are unchanged; the GUI behavior is unchanged.Related: #10316 (the same coupling reached through the picker), #10597 (community patch format).
Maintainers are welcome to review or cherry-pick it.
中文摘要
session.selectModel在把选择应用到目标会话的同时,还会把它写成部署默认(agent-default-model)。对 Web 选择器而言这是设计意图(选择器就是默认值的编辑器),但第三方插件也通过这个 RPC 给会话设模型:飞书机器人卡片设为 High 后,新建 IM 会话的那一次selectModel把部署默认一并改成 High,此后所有新对话都从 High 起步(约 28 小时)。补丁给请求加可选saveDefault:仅在true时后台保存默认;GUI 两个入口传true,插件不传即只影响本会话、不改动其他对话。维护者可 review / cherry-pick。All reactions