Repository navigation
[Bug] 只有 reasoning 没有正文的一轮被当成正常完成,EMPTY_RESPONSE 从未触发 #14334
Rewrite-skw
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
When a model finishes a turn with
finish_reason=stopand emits only a reasoning block (no text block, no tool call), the adapter treats it as a successful completion. The UI shows "completed" with an empty transcript, while the actual answer sits entirely insidereasoning. Because no error is raised, the built-inEMPTY_RESPONSEretry never runs.中文摘要:模型以
stop结束、只产出 reasoning 块(无 text、无 tool-call)时,适配器把它当成正常完成——界面上显示「已完成」但正文空白,而内容全在 reasoning 里。由于没有抛错,内置的EMPTY_RESPONSE重试从未触发。根因 / Root cause
dsh-llm-deepseek的 Messages 适配器,在message_stop分支判空用的是「内容块数量为零」:问题在于
reasoning块也计入blocks。 所以「只有 reasoning、没有 text、没有 tool-call」的一轮,blocks.size === 1,throw这条分支永远不会走到。同一条链路上还有第二处相同判据(pi-ai 适配器的
mapStopReason):同样是「数块数」,不是「数可见的字」。
结果:这一轮被
agent-loop记成completed,重试机制完全没被触发。为什么重试救不了 / Why the retry never fires
EMPTY_RESPONSE是内置重试码表里的第一项,normal 模式 最多重试 5 次(500ms 起、10s 封顶、带抖动)。但重试的前提是先抛
EMPTY_RESPONSE。 判空条件漏掉 reasoning,错误就永远抛不出来——重试一次都不会发生。我们试过、失败的路 / What we tried and ruled out
按时间顺序,都被数据否掉了:
特别值得注意:那 23 次用户在界面上一次都没察觉——守卫拦下、重发、几秒后出字,用户只看到「用时 X 秒」。
已知代价:被拦那几轮的 reasoning 不进对话(我们单独存了原文)。连拦 5 次时,第 6 次出来的那一版可能不是「最厚的那一版」。
环境信息 / Environment
deepseek-account,modeldeepseek-flash,reasoningEffort: max/high建议 / Suggestion
最小修复:把判空条件从「内容块数量为零」改成「没有非空白 text 块、也没有 tool-call 块」——reasoning 不应算作「可见回复」。
我们已经在插件层验证了这条判据可行(23 次全部命中,无误报)。
All reactions