Repository navigation
Replies: 2 comments
|
Your source reading holds up on The serializer has exactly one place that can emit
|
|
A plugin form of the runtime layer is now available: npm publication is pending credentials on my side, so the repository is what is installable today: dsh plugin add github:argszero/dsh-thinking-roundtrip-guardWhat it does: it listens on the
The default route allowlist is Why it is a workaround rather than the fix: a plugin cannot see a connection's thinking defaults (the serializer reads Verification: 52 assertions against a real cordis context and the real Relation to the rest of the thread: this is your #1780 remedy — synthesize the cross-provider block — applied where the requirement is enforced rather than merely convenient, and it composes with the empty-block guard from #9239: a turn that already carries a reasoning block is never rewritten, empty or not. |
Uh oh!
There was an error while loading. Please reload this page.
环境
deepseek-official(Anthropic Messages 兼容端点https://api.deepseek.com/anthropic/v1/messages),适配器@deepseek-ai/dsh-llm-deepseek@0.2.1-rc.2deepseek-official/deepseek-flash、workbuddy/deepseek-v4.1-flash、agent2api/deepseek-v4.1-flash、deepseek-account/deepseek-flash、xiaomi/mimo-v2.6-flash现象
会话切回
deepseek-official后,任何一条消息都失败(包括纯文本续聊):服务端原文:
新开会话直接用
deepseek-official正常;切到xiaomi/workbuddy/agent2api也正常。只有「混合历史 + 切回官方」这个组合必挂。复现
deepseek-official跑几轮带工具调用的对话(历史里产生 reasoning + tool_use)。llm-pi-ai路由(workbuddy / agent2api / xiaomi)继续跑几轮工具调用。deepseek-official,发任意一条消息 → 400,且此后每一轮都 400。最小对照矩阵(同一会话内实测,请求体直接打端点)
由此收敛:该端点(thinking enabled)要求历史中每条带
tool_use的 assistant 消息都回传thinking块;signature 缺失与否不是问题(第 1、2 行都 200)。当前 DSH 在历史来自其他 provider(其 assistant 消息没有 reasoning 块)时,序列化不出 thinking 块,于是 400。源码定位
打包产物
packages/llm/llm-deepseek/lib/index.js(0.2.1-rc.2):assistant()(约 1551-1573 行)只在历史块block.type === "reasoning"时输出{ type:"thinking", thinking: block.text, ...signature };tool-call→tool_use。对「有 tool-call 但无 reasoning 块」的历史消息,不补 thinking 块,也不做兼容降级。readReplay()/validateReplay()(约 1504-1533 行)在response.model !== 当前 model时返回undefined(跨模型签名不可移植),这与本次 400 无关——无签名 thinking 照样 200(矩阵第 1 行)。INVALID_REQUEST前置检查(约 1699-1706 行)只校验 tool id 配对,不校验 thinking 回传。与已有讨论的关系
@argszero/dsh-empty-block-guard与空块清洗对本问题无效。llm-pi-ai的reasoning_text签名丢失(OpenAI Responses 方言),与本案不同端点,但修法可借鉴:对跨 provider 的 tool-call 轮合成 thinking/signature。期望
deepseek-official(或任何要求 thinking 回传的 Anthropic Messages 端点)时,对「带 tool-call 且无 reasoning 块」的历史消息做兜底:合成 thinking 块(参考 Bug:切到第三方模型后,多轮对话报 400:reasoning_text must be passed back #1780 的foreignAssistant),或INVALID_REQUEST)。影响
长会话中途换模型是常见用法。一旦历史被「污染」,该会话就永久无法再用
deepseek-official,只能换 provider 或丢历史新开。0.2.1-rc.2 上可稳定复现。All reactions