DeepSeek-Reasonix
DeepSeek-Reasonix copied to clipboard
Fix false-positive missing tool-call reasoning warning
warnMissingToolCallReasoning 之前将 thinking 模式下每个缺少 reasoning_content 的工具调用轮都视为兼容性事故。DeepSeek 的 thinking 模式是机会式的:像 deepseek-v4-flash 这类模型可能直接调用工具而不产生推理内容(usage.reasoning_tokens == 0),API 接受这种情况且无需客户端回放——这是正常行为,并非推理内容丢失。
现在警告仅在服务端报告产生了思考 token(reasoning_tokens > 0)但 reasoning_content 未送达时触发;当缺少 usage 遥测时,保留原有保守告警路径(#6259、#7059 的事故仍会被捕获)。
Summary
- 修复误报:thinking 模式下模型自主跳过思考直接调用工具(reasoning_tokens == 0)时,不再弹出 "returned tool calls without replayable thinking content" 警告
- 判别依据:provider usage 的 reasoning_tokens;为 0 表示模型未思考(正常),大于 0 但无内容才是真事故
- 不改变请求序列化、system prompt、工具 schema 与写入会话的消息,prompt-cache 前缀字节不变
Issues
Verification
- go build ./...
- go vet ./internal/agent/
- go test ./internal/agent/... ./internal/provider/...(全绿,含新增测试 TestRunSkipsMissingToolCallReasoningWarnWhenModelSkippedThinking)
Cache impact
- Cache-impact: none - Diagnostic-only change in warnMissingToolCallReasoning (agent.go); request serialization, system prompt, tool schemas, and session messages are untouched, so the prompt-cache prefix is byte-identical.
- Cache-guard: go test ./internal/agent/ -run TestRunWarnsAndContinuesOnMissingToolCallReasoning -count=1