You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] 使用 DeepSeek V4.1 Flash 有概率报错 The reasoning_text in the thinking mode must be passed back to the API. #296
Activity
vastsa commentedon Sep 13, 2026
请问一下是接入的官方的吗
muzimu217 commentedon Sep 13, 2026
帮你定位了一下,这个 400 的触发链路应该清楚了 👇
根因:上下文压缩把 assistant 消息里的
reasoning_content摘掉了,而 DeepSeek 思考模式要求把它回传。patches/@[email protected]):当历史里出现reasoning_content时,给缺失的 assistant 消息补空串,维持「全有或全无」——这是修 [Bug] 修复 reasoning_content 传回错误 #223 的方案;reasoning_text必须回传」:全空也不行,它要的是真实推理内容;修复方向(二选一,前者更彻底):
reasoning_content(或至少最后一轮),让思考模式的历史连续性不断;@vastsa 顺带回应你的问题:报告人如果走的是中转/官方不同端点,行为可能不一样——V4.1 的思考回传要求比旧版严,建议按「压缩后回传缺失」这个方向修,和「是否官方接入」无关。
Mxucc commentedon Sep 13, 2026
主要是 opencode 应该,官方的还好,通过第三方接入(反代)和 opencode 接入都会出现
muzimu217 commentedon Sep 14, 2026
感谢补充,这个信息很关键:官方端点正常、第三方反代和 opencode 接入才复现——说明差异出在「该接入方式下 assistant 消息是否携带 / 是否要求回传
reasoning_content」,与上面定位的压缩摘除 + pi-ai 兼容补丁的链路正好吻合(opencode/反代路径对回传校验更严格)。如果方便的话,再提供一项信息可以把范围钉死:出错的两种接入分别用的是什么模型/端点形态(opencode 的哪个 provider 配置、反代转发到的是官方还是聚合网关)。后续修复会按「压缩后保留或补齐 reasoning_content 回传」的方向走,确认后我在验证时把这两种接入都纳入回归。
fix(agent-runtime): keep retained reasoning on the Completions wire
test(agent-runtime): tighten vastsa#296 convertMessages proof
vastsa commentedon Sep 15, 2026
问题已在 PR #400 中修复并合入 main,合并提交为 4e2e005。修复保留了上下文压缩前的 DeepSeek Completions 推理内容,并在重放时补齐 reasoning 字段;同时限制为兼容的 Completions 模型,避免影响 Anthropic 等其他 provider。已通过 agent-runtime 452 项测试、shared 658 项测试、typecheck、build、lint 和集成 E2E。真实 OpenCode/第三方聚合 relay 的 E2E-005E 因缺少对应凭证仍待后续环境验证。
fix(agent-runtime): preserve DeepSeek reasoning across compaction
muzimu217 commentedon Sep 16, 2026
感谢快速修复——#400 的方向与此前定位的链路完全吻合(压缩摘除
reasoning_content→ DeepSeek 思考模式要求回传):保留压缩前推理内容 + 重放时补齐 reasoning 字段,并按 Completions 兼容性收敛影响面,处理得很干净。关于仍待验证的 E2E-005E(真实 OpenCode/第三方聚合 relay):我本地有可用的第三方聚合 relay 与 opencode 接入配置(正是当初复现 400 的环境),如果你需要,我可以按 #400 之后的 main 跑一轮真实 relay 回归,把结果(含 reasoning 字段回传断言)贴回来。
fix(agent-runtime): keep real DeepSeek reasoning in the field relays …