fix: 关 qwen 思考模式(消除 reasoning 回退) + 修 bounce 死锁 (BUG-A/BUG-B) #26

Merged
xiaohei merged 1 commits from fix/qwen-thinking-and-bounce-deadlock into main 2026-06-22 05:55:05 +00:00
Owner

影响范围

  • agent_swarm: 改动(agent 执行 + orchestrator 收敛)
  • Client/Manager/Agnet 接口/CodeGW/计费/密钥/审计/发布链路: 不影响
  • Manager-Swarm 契约: 未改(4 契约测试全绿)

BUG-A (agent/task_executor.py)

_complete 两处 chat.completions.create 注入 extra_body={"enable_thinking": False}(env AGENT_ENABLE_THINKING=1 可 opt-in)。关思考后 reasoning_content 恒为 0,消除 content 为空时回退到思考散文导致 json.loads 失败的路径,结构化输出确定化。已在真实网关 api.heicode.cc 验证:接受该参数不报 400,出干净 JSON。

BUG-B (orchestrator/main.py)

bounce 仅重开含 impl 文件任务;impl 失败(0文件)+test 成功时 reopens=0 -> run 永远 running 空转。兜底:reopens==0 重开 FAILED 任务(受 MAX_REVIEW_CYCLES 约束);仍无可重开则 accept_no_rework 走正常收敛终结。

验证

py_compile + 4 契约测试(runtime-contract/merge-smoke/workflow-e2e/contract-freeze)全绿;BUG-A 真实网关验证通过。

风险/未完成

未在真实 8 轮工具循环端到端复现 content 空;待部署 heicode-test 跑单题。

## 影响范围 - agent_swarm: 改动(agent 执行 + orchestrator 收敛) - Client/Manager/Agnet 接口/CodeGW/计费/密钥/审计/发布链路: 不影响 - Manager-Swarm 契约: 未改(4 契约测试全绿) ## BUG-A (agent/task_executor.py) _complete 两处 chat.completions.create 注入 extra_body={"enable_thinking": False}(env AGENT_ENABLE_THINKING=1 可 opt-in)。关思考后 reasoning_content 恒为 0,消除 content 为空时回退到思考散文导致 json.loads 失败的路径,结构化输出确定化。**已在真实网关 api.heicode.cc 验证:接受该参数不报 400,出干净 JSON。** ## BUG-B (orchestrator/main.py) bounce 仅重开含 impl 文件任务;impl 失败(0文件)+test 成功时 reopens=0 -> run 永远 running 空转。兜底:reopens==0 重开 FAILED 任务(受 MAX_REVIEW_CYCLES 约束);仍无可重开则 accept_no_rework 走正常收敛终结。 ## 验证 py_compile + 4 契约测试(runtime-contract/merge-smoke/workflow-e2e/contract-freeze)全绿;BUG-A 真实网关验证通过。 ## 风险/未完成 未在真实 8 轮工具循环端到端复现 content 空;待部署 heicode-test 跑单题。
xiaohei added 1 commit 2026-06-22 05:54:02 +00:00
fix(agent+orchestrator): 关 qwen 思考模式出干净 JSON + 修 bounce 死锁
CI / guardrails (push) Successful in 6s
CI / tests (push) Successful in 45s
CI / guardrails (pull_request) Successful in 8s
CI / tests (pull_request) Successful in 43s
cdb17a0d73
BUG-A: qwen3.7-max 默认思考模式,重 impl 子任务把预算花在 reasoning_content
上不出最终 content JSON → json.loads("") 失败。task_executor._complete 两处
chat.completions.create 注入 extra_body={"enable_thinking": False}(env
AGENT_ENABLE_THINKING=1 可opt-in)。对齐 Qwen 官方结构化输出用法。

BUG-B: bounce 仅重开含 impl 文件的任务;impl 失败(0文件)+test成功时
reopens=0 → run 永远 running 空转。加兜底:reopens==0 时重开 FAILED 任务
(受 MAX_REVIEW_CYCLES 约束);仍无可重开则 accept_no_rework 走正常收敛终结。

契约测试全绿(runtime-contract/merge-smoke/workflow-e2e/contract-freeze)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
xiaohei merged commit 85e6ea6dfb into main 2026-06-22 05:55:05 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaohei/Agentswarm#26