Skip to content

fix(agents): strip replayed reasoning_content when the model lacks a reasoning adapter - #2740

Open
wxhking wants to merge 5 commits into
TencentCloud:developfrom
wxhking:fix/groq-reasoning-content-replay
Open

wxhking wants to merge 5 commits into
TencentCloud:developfrom
wxhking:fix/groq-reasoning-content-replay

Conversation

@wxhking

@wxhking wxhking commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Issue [bug] groq model reply:property 'reasoning_content' is unsupported #2498:groq(llama 等非推理模型)报 400: property 'reasoning_content' is unsupported。根因链路:上一轮助手回复把推理文本写进 additional_kwargs.reasoning_content(history/projection.py、recorder.py),下一轮 LangGraph 把整段消息历史原样回放给模型;harness 侧 _attach_reasoning_to_payload 无条件把该字段回贴到 assistant payload(octop-harness/llm/factory.py),对不支持 reasoning 的 OpenAI 兼容端点直接 400。
  • 本修复在 Octop 侧(不动 harness 依赖版本):
    • harness_request.build_harness_request 新增 reasoning_gate 参数 → configurable["octop_reasoning_roundtrip"];
    • processor._resolve_reasoning_overrides 现在总是知道能力有无:capability 为 None 时给 {"_roundtrip": False},有能力时 True,并在调用点拆出为 gate(IM 通道路径同理单独解析);
    • ReasoningRequestMiddleware._scrub_replayed_reasoning 在调用模型前把历史 AIMessage 的 reasoning_content 剥离(model_copy 不可变方式),gate 缺失/为 True 时不干预,DeepSeek 等 reasoning 模型的思考链回放不受影响。

Target branch

develop

Type

Bug fix

Test plan

  • tests/unit/agents/test_reasoning_middleware.py 新增 4 例:gate=False 剔除、gate=True 保留、历史无字段时跳过、gate 缺失时默认不动(历史行为兼容)。
  • tests/unit/gateway 全量 549 passed(含 IM 通道路径回归)。

Checklist

  • CHANGELOG.md 已更新([Unreleased] 中文条目)
  • 相关测试已运行

@wxhking
wxhking force-pushed the fix/groq-reasoning-content-replay branch 2 times, most recently from e01e8ab to f248def Compare November 3, 2026 02:47
@wxhking
wxhking force-pushed the fix/groq-reasoning-content-replay branch from f248def to f55aaa5 Compare November 4, 2026 02:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant