agentscope-ai / agentscope-ai/QwenPaw
[Bug]: Heartbeat query handler 取消时未清理工具调用状态,导致无限重试循环
- Lingua principale
- Python
- Stelle
- 34.9k
- Fork
- 3.1k
- Merge medio
- 1g 15h
- PR unite (30g)
- 225
Descrizione
## CoPaw Version
CoPaw v0.0.7
## Description
- Query handler 被取消时,未完成的工具调用(tool_calls)没有被清理
- 无效工具调用(name='')被保存到 session 文件
- 后续加载 session 时无限重试,导致 Agent 卡死
**Related PR(s):** #(optional)
**Security considerations:** [If applicable, e.g. auth, env/config exposure]
## Component(s) Affected
- [ ] Core / Backend (app, agents, config, providers, utils, local_models)
- [x] Console (frontend web UI)
- [x] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [x] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy
## Environment
- **CoPaw version:** v0.0.7
- **OS:** Windows 11
- **Install method:** irm https://copaw.agentscope.io/install.ps1 | iex
- **Python version (if applicable):** Python 3.13.5
## Steps to Reproduce
1. 启用 Heartbeat (agents.defaults.heartbeat.enabled=true)
2. 等待 Heartbeat 触发(每 30 分钟)
3. 在 Agent 处理工具调用时强制取消(重启/取消查询)
4. 再次发送消息触发 session 加载
5. 观察到无限循环错误:Removing tool_use with invalid name: id='call_xxx', name=''
## Actual vs Expected
- **Actual:** 所有指令没响应,界面卡死,发送的消息切换页面后再回来就消失了(界面上看不到)
- **Expected:** 能正常使用工具。
## Logs / Screenshots
```
09:54:23 | Removing tool_use with invalid name: id='call_d34ba34ff7d3443bb37bb92a', name=''
09:54:37 | Removing tool_use with invalid name: id='call_d34ba34ff7d3443bb37bb92a', name=''
09:54:41 | Removing tool_use with invalid name: id='call_d34ba34ff7d3443bb37bb92a', name=''
... (一直重复)
11:21:20 | Removing tool_use with invalid name: id='call_d34ba34ff7d3443bb37bb92a', name=''
```
## Additional Notes
修复建议:
- 取消时清理工具调用状态(cancel_query() 中添加 tool_calls.clear())
- 添加工具调用验证逻辑(验证 name 不为空)
- 限制重试次数(MAX_RETRIES=3)
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.