fix(agents): stop dropping self-paired tool messages during sanitation#5792
Conversation
When a request contains an unpaired tool block (which triggers _sanitize_tool_messages to repair ordering/pairing), any valid AgentScope 2.0 "self-paired" assistant message -- one that carries its own tool_call and matching tool_result in the same Msg ([text, tool_call, tool_result]) -- was silently deleted, losing the text and the whole turn from the model request. Two causes: - _reorder_tool_results treated every result-bearing message as a movable result carrier, skipping it and expecting to re-insert it after a tool_call in another message; for a self-paired message the call is in the same (skipped) message, so it was never re-inserted. - _remove_unpaired_tool_messages only scanned *following* messages for a tool_call's results, so a self-paired message's own result never satisfied its own use and the message was treated as unpaired. Fix: keep messages that carry their own tool_call in place during reordering, satisfy a message's tool_calls from its own tool_results first (and don't consume a following self-paired message as a result provider), and let a message's own tool_calls pair its own tool_results in the final unpaired-result sweep. Adds a regression test.
|
Hi @Osamaali313, thank you for your first Pull Request! 🎉 📋 About PR TemplateTo help maintainers review your PR faster, please make sure to include:
Complete PR information helps speed up the review process. You can edit the PR description to add these details. 🙌 Join Developer CommunityThanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page: We truly appreciate your enthusiasm—and look forward to your future contributions! 😊 We'll review your PR soon. |
The explanatory comment in _reorder_tool_results exceeded the 79-char limit; rewrap it. No behavior change.
Welcome to QwenPaw! 🎉Thank you @Osamaali313 for your first contribution! Your PR has been merged. 🚀 We'd love to give you a shout-out in our release notes! If you're comfortable sharing, please reply to this comment with your social media handles using the format below:
Thanks again for helping make QwenPaw better! |
commit e936dd4 Author: Qin Xiaoming <xiaoming.qxm@gmail.com> Date: Wed Jul 8 21:21:25 2026 +0800 fix(mcp): apply runtime approval level to driver policy (agentscope-ai#5864) Co-authored-by: Xiaoming Qin <xiaoming.qxm@alibaba-inc.com> commit adceab9 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Wed Jul 8 17:36:13 2026 +0800 feat(cron): add tool safety toggle for cron jobs to control approval … (agentscope-ai#5847) commit 717aa4d Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Wed Jul 8 16:35:14 2026 +0800 feat(console): enhance approval card UI and UX (agentscope-ai#5855) commit 2cf61c5 Author: Keefe Wong <595751021@qq.com> Date: Wed Jul 8 16:21:45 2026 +0800 feat(console): enable long text upload (agentscope-ai#5854) commit 691724c Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Wed Jul 8 15:19:23 2026 +0800 fix(runtime): persist interrupted turn state and suppress empty cancel messages (agentscope-ai#5838) commit 1178097 Author: zhijianma <zhijian.mzj@alibaba-inc.com> Date: Wed Jul 8 15:18:50 2026 +0800 Revert "feat(console): enable long text upload regression config and optimize message rendering (agentscope-ai#5845)" (agentscope-ai#5851) commit 5d335fe Author: hehuang139 <ox48@qq.com> Date: Wed Jul 8 14:58:03 2026 +0800 fix(providers): retry streaming OpenAI APIError with body status codes (agentscope-ai#5799) commit c1ff7bc Author: Syed Osama Ali Shah <86572800+Osamaali313@users.noreply.github.com> Date: Wed Jul 8 09:57:52 2026 +0300 fix(agents): stop dropping self-paired tool messages during sanitation (agentscope-ai#5792) commit a3be71b Author: Jinglin Peng <jlpengcs@gmail.com> Date: Wed Jul 8 14:55:42 2026 +0800 feat: Bundle Node runtime for ACP desktop (agentscope-ai#5814) commit dc4f50c Author: Keefe Wong <595751021@qq.com> Date: Wed Jul 8 14:17:35 2026 +0800 feat(console): enable long text upload regression config and optimize message rendering (agentscope-ai#5845) commit 41755a6 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Wed Jul 8 11:13:55 2026 +0800 fix(packaging): add static project.urls for GitHub dependency graph (agentscope-ai#5839) commit 69ff31d Author: Irene Lin <yin.lin@alibaba-inc.com> Date: Tue Jul 7 19:53:00 2026 -0700 fix(scroll): protect the active turn, add graduated pressure relief, and make recall failures unmistakable (agentscope-ai#5765) commit 7e86404 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Tue Jul 7 19:06:30 2026 +0800 chore(version): bump version 2.0.0b4 (agentscope-ai#5837) commit 9dae676 Author: jinliyl <6469360+jinliyl@users.noreply.github.com> Date: Tue Jul 7 16:41:54 2026 +0800 feat(memory): add usage-aware auto search and backend-specific embeddings (agentscope-ai#5820) commit b113eea Author: hongxicheng <1003394729@qq.com> Date: Tue Jul 7 16:37:40 2026 +0800 feat(plugin): support plugin-registered custom channels with schema-driven config UI (agentscope-ai#4693) commit bd8e8b9 Author: zhijianma <zhijian.mzj@alibaba-inc.com> Date: Tue Jul 7 16:26:29 2026 +0800 feat(console, chat): remove default mode of session approval level (agentscope-ai#5832) commit 3dfef8a Author: Mo xi <i@morxi.com> Date: Tue Jul 7 16:09:52 2026 +0800 feat(channels): matrix Add Streaming Mode Like Discord in Matrix (agentscope-ai#5585) commit 88b662f Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Tue Jul 7 16:00:09 2026 +0800 fix: sanitize const Schema Field for Gemini Tool Parameters (agentscope-ai#5827) commit ed2fe73 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Tue Jul 7 15:59:23 2026 +0800 fix(offloader): handle TextBlock objects in offload_tool_result (agentscope-ai#5831) commit 6aff001 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Tue Jul 7 15:52:15 2026 +0800 feat(coding-mode): allow selecting hidden folders in project browser (agentscope-ai#5828) commit fc7b64e Author: sidiluo <wb-lsd703406@alibaba-inc.com> Date: Tue Jul 7 15:48:15 2026 +0800 docs (website): add new blog (agentscope-ai#5825) commit 5d27c3e Author: Osier-Yi <njuyaoliuyi@gmail.com> Date: Tue Jul 7 15:47:20 2026 +0800 fix (plugin): pet approval bug (agentscope-ai#5830) commit e80860c Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Tue Jul 7 11:54:04 2026 +0800 feat(desktop): hidden 8-click logo gesture to open DevTools (agentscope-ai#5805) commit ae36f4e Author: jinliyl <6469360+jinliyl@users.noreply.github.com> Date: Tue Jul 7 11:47:31 2026 +0800 refactor(memory): simplify auto-memory search state and context handling (agentscope-ai#5815) commit 085d6b2 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Mon Jul 6 18:18:47 2026 +0800 feat(ci): add QwenPaw review bot (agentscope-ai#5736) commit 58ad207 Author: VectorPeak <garrufariw@gmail.com> Date: Mon Jul 6 17:25:56 2026 +0800 fix(console): route plugin market details through link guard (agentscope-ai#5750) commit c872d7c Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 16:00:58 2026 +0800 fix(providers): restore OpenRouter OAuth router dropped in Runtime 2.0 (agentscope-ai#5806) commit 6ff2f02 Author: wangxhu <wananing@outlook.com> Date: Mon Jul 6 15:48:32 2026 +0800 fix(crons): record run timestamps in job timezone (agentscope-ai#5783) commit dd93efb Author: hongxicheng <1003394729@qq.com> Date: Mon Jul 6 15:44:48 2026 +0800 fix(yuanbao): prevent connection failures from empty api_domain and missing proto descriptors (agentscope-ai#5804) commit 6e62383 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 15:22:57 2026 +0800 fix(runtime): remove stale language arg from _process_memory_section call (agentscope-ai#5803) commit c1de2ba Author: Eric Zhu <320302+ekzhu@users.noreply.github.com> Date: Sun Jul 5 23:29:39 2026 -0700 fix(runtime): respect configured workspace prompt files (agentscope-ai#5396) commit 7a0a6bd Author: ManJieqi <40858189+manjieqi@users.noreply.github.com> Date: Mon Jul 6 14:18:05 2026 +0800 fix: add timezone.utc to datetime.fromtimestamp in AgentMdManager (agentscope-ai#5768) commit 6769fba Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 13:55:46 2026 +0800 chore(dep): pin ACP version to avoid breaking change (agentscope-ai#5798) commit 91b0b16 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Mon Jul 6 13:53:50 2026 +0800 Fix: timestamp always visible && Double /api prefix (agentscope-ai#5802) commit 0bc68ed Author: Jinglin Peng <jlpengcs@gmail.com> Date: Mon Jul 6 11:49:56 2026 +0800 feat: switch desktop release to Tauri (agentscope-ai#5734) commit cc6303a Author: VectorPeak <garrufariw@gmail.com> Date: Mon Jul 6 11:48:51 2026 +0800 fix(utils): recover JSON after leading whitespace (agentscope-ai#5766) commit bb313ac Author: Jinglin Peng <jlpengcs@gmail.com> Date: Mon Jul 6 11:31:53 2026 +0800 fix: Include ACP modules in desktop bundle (agentscope-ai#5794) commit 7052644 Author: y1y5 <105190237+y1y5@users.noreply.github.com> Date: Mon Jul 6 10:51:39 2026 +0800 docs(plugins-migration): update v1 to v2 migration guides (agentscope-ai#5752) * docs(plugins-migration): update v1 to v2 migration guides * docs(plugins): address migration guide review comments * add migration guide navigation entry commit f5b1203 Author: mi1k7 <75235876+ustc-mkh@users.noreply.github.com> Date: Sat Jul 4 00:28:22 2026 +0800 feat(sandbox): implement windows native sandbox (agentscope-ai#5525) Co-authored-by: cuiyuebing <cuipaofu@gmail.com> commit f69e61d Author: wangfei010313 <wangfei01219@126.com> Date: Fri Jul 3 18:19:30 2026 +0800 fix(providers): update GitHub Models to new endpoint and support fine-grained PAT (agentscope-ai#5735) commit e228026 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Fri Jul 3 17:16:00 2026 +0800 feat: add request timeout, retry and AbortSignal support (agentscope-ai#5764) commit 66051e6 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Fri Jul 3 16:12:46 2026 +0800 refactor(session list): unify session item into SessionItem component(agentscope-ai#5754) commit 856f0ce Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Fri Jul 3 16:11:04 2026 +0800 fix(config): make agent resilient to invalid MCP client config (agentscope-ai#5755) commit 13af342 Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Fri Jul 3 15:18:32 2026 +0800 fix: show stream completion time instead of first-chunk time for assistant messages (agentscope-ai#5742) commit 456cbf9 Author: sidiluo <wb-lsd703406@alibaba-inc.com> Date: Fri Jul 3 14:57:40 2026 +0800 fix(website): update blog developer day collection and add blog GA tracking (agentscope-ai#5758) commit 150c1d9 Author: yaozy2020 <88593746+yaozy2020@users.noreply.github.com> Date: Fri Jul 3 14:38:48 2026 +0800 fix(console): mobile chat history panel shows empty session list (agentscope-ai#5744) commit 65b4a04 Author: Runlin Lei <lei_runlin@163.com> Date: Fri Jul 3 14:34:43 2026 +0800 refactor(skill): skill-related UI (agentscope-ai#5753) commit f0cc70f Author: wangfei010313 <wangfei01219@126.com> Date: Fri Jul 3 14:33:58 2026 +0800 feat: add 'none' memory backend to disable long memory system (agentscope-ai#5732) commit f0d2279 Author: Yue Cui <39703217+cuiyuebing@users.noreply.github.com> Date: Fri Jul 3 14:17:27 2026 +0800 chore(version): bump version to 2.0.0b3 (agentscope-ai#5760)
|
Thanks so much, and glad it landed! 🎉 Happy to be shouted out — here are the handles I'm comfortable sharing: x: @OsamaAli_72 (https://x.com/OsamaAli_72) (No Discord/Xiaohongshu.) Thanks again — looking forward to contributing more! |
commit b0d9d49 Author: Irene Lin <yin.lin@alibaba-inc.com> Date: Wed Jul 8 20:51:25 2026 -0700 fix(scroll): anchor the live turn with a seam banner in the eviction index (agentscope-ai#5871) commit 9c3a20e Author: Irene Lin <yin.lin@alibaba-inc.com> Date: Wed Jul 8 19:34:25 2026 -0700 fix(scroll): label un-headlined evicted spans in the eviction index (agentscope-ai#5848) commit e936dd4 Author: Qin Xiaoming <xiaoming.qxm@gmail.com> Date: Wed Jul 8 21:21:25 2026 +0800 fix(mcp): apply runtime approval level to driver policy (agentscope-ai#5864) Co-authored-by: Xiaoming Qin <xiaoming.qxm@alibaba-inc.com> commit adceab9 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Wed Jul 8 17:36:13 2026 +0800 feat(cron): add tool safety toggle for cron jobs to control approval … (agentscope-ai#5847) commit 717aa4d Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Wed Jul 8 16:35:14 2026 +0800 feat(console): enhance approval card UI and UX (agentscope-ai#5855) commit 2cf61c5 Author: Keefe Wong <595751021@qq.com> Date: Wed Jul 8 16:21:45 2026 +0800 feat(console): enable long text upload (agentscope-ai#5854) commit 691724c Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Wed Jul 8 15:19:23 2026 +0800 fix(runtime): persist interrupted turn state and suppress empty cancel messages (agentscope-ai#5838) commit 1178097 Author: zhijianma <zhijian.mzj@alibaba-inc.com> Date: Wed Jul 8 15:18:50 2026 +0800 Revert "feat(console): enable long text upload regression config and optimize message rendering (agentscope-ai#5845)" (agentscope-ai#5851) commit 5d335fe Author: hehuang139 <ox48@qq.com> Date: Wed Jul 8 14:58:03 2026 +0800 fix(providers): retry streaming OpenAI APIError with body status codes (agentscope-ai#5799) commit c1ff7bc Author: Syed Osama Ali Shah <86572800+Osamaali313@users.noreply.github.com> Date: Wed Jul 8 09:57:52 2026 +0300 fix(agents): stop dropping self-paired tool messages during sanitation (agentscope-ai#5792) commit a3be71b Author: Jinglin Peng <jlpengcs@gmail.com> Date: Wed Jul 8 14:55:42 2026 +0800 feat: Bundle Node runtime for ACP desktop (agentscope-ai#5814) commit dc4f50c Author: Keefe Wong <595751021@qq.com> Date: Wed Jul 8 14:17:35 2026 +0800 feat(console): enable long text upload regression config and optimize message rendering (agentscope-ai#5845) commit 41755a6 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Wed Jul 8 11:13:55 2026 +0800 fix(packaging): add static project.urls for GitHub dependency graph (agentscope-ai#5839) commit 69ff31d Author: Irene Lin <yin.lin@alibaba-inc.com> Date: Tue Jul 7 19:53:00 2026 -0700 fix(scroll): protect the active turn, add graduated pressure relief, and make recall failures unmistakable (agentscope-ai#5765) commit 7e86404 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Tue Jul 7 19:06:30 2026 +0800 chore(version): bump version 2.0.0b4 (agentscope-ai#5837) commit 9dae676 Author: jinliyl <6469360+jinliyl@users.noreply.github.com> Date: Tue Jul 7 16:41:54 2026 +0800 feat(memory): add usage-aware auto search and backend-specific embeddings (agentscope-ai#5820) commit b113eea Author: hongxicheng <1003394729@qq.com> Date: Tue Jul 7 16:37:40 2026 +0800 feat(plugin): support plugin-registered custom channels with schema-driven config UI (agentscope-ai#4693) commit bd8e8b9 Author: zhijianma <zhijian.mzj@alibaba-inc.com> Date: Tue Jul 7 16:26:29 2026 +0800 feat(console, chat): remove default mode of session approval level (agentscope-ai#5832) commit 3dfef8a Author: Mo xi <i@morxi.com> Date: Tue Jul 7 16:09:52 2026 +0800 feat(channels): matrix Add Streaming Mode Like Discord in Matrix (agentscope-ai#5585) commit 88b662f Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Tue Jul 7 16:00:09 2026 +0800 fix: sanitize const Schema Field for Gemini Tool Parameters (agentscope-ai#5827) commit ed2fe73 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Tue Jul 7 15:59:23 2026 +0800 fix(offloader): handle TextBlock objects in offload_tool_result (agentscope-ai#5831) commit 6aff001 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Tue Jul 7 15:52:15 2026 +0800 feat(coding-mode): allow selecting hidden folders in project browser (agentscope-ai#5828) commit fc7b64e Author: sidiluo <wb-lsd703406@alibaba-inc.com> Date: Tue Jul 7 15:48:15 2026 +0800 docs (website): add new blog (agentscope-ai#5825) commit 5d27c3e Author: Osier-Yi <njuyaoliuyi@gmail.com> Date: Tue Jul 7 15:47:20 2026 +0800 fix (plugin): pet approval bug (agentscope-ai#5830) commit e80860c Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Tue Jul 7 11:54:04 2026 +0800 feat(desktop): hidden 8-click logo gesture to open DevTools (agentscope-ai#5805) commit ae36f4e Author: jinliyl <6469360+jinliyl@users.noreply.github.com> Date: Tue Jul 7 11:47:31 2026 +0800 refactor(memory): simplify auto-memory search state and context handling (agentscope-ai#5815) commit 085d6b2 Author: lalaliat <78087788+lalaliat@users.noreply.github.com> Date: Mon Jul 6 18:18:47 2026 +0800 feat(ci): add QwenPaw review bot (agentscope-ai#5736) commit 58ad207 Author: VectorPeak <garrufariw@gmail.com> Date: Mon Jul 6 17:25:56 2026 +0800 fix(console): route plugin market details through link guard (agentscope-ai#5750) commit c872d7c Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 16:00:58 2026 +0800 fix(providers): restore OpenRouter OAuth router dropped in Runtime 2.0 (agentscope-ai#5806) commit 6ff2f02 Author: wangxhu <wananing@outlook.com> Date: Mon Jul 6 15:48:32 2026 +0800 fix(crons): record run timestamps in job timezone (agentscope-ai#5783) commit dd93efb Author: hongxicheng <1003394729@qq.com> Date: Mon Jul 6 15:44:48 2026 +0800 fix(yuanbao): prevent connection failures from empty api_domain and missing proto descriptors (agentscope-ai#5804) commit 6e62383 Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 15:22:57 2026 +0800 fix(runtime): remove stale language arg from _process_memory_section call (agentscope-ai#5803) commit c1de2ba Author: Eric Zhu <320302+ekzhu@users.noreply.github.com> Date: Sun Jul 5 23:29:39 2026 -0700 fix(runtime): respect configured workspace prompt files (agentscope-ai#5396) commit 7a0a6bd Author: ManJieqi <40858189+manjieqi@users.noreply.github.com> Date: Mon Jul 6 14:18:05 2026 +0800 fix: add timezone.utc to datetime.fromtimestamp in AgentMdManager (agentscope-ai#5768) commit 6769fba Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Mon Jul 6 13:55:46 2026 +0800 chore(dep): pin ACP version to avoid breaking change (agentscope-ai#5798) commit 91b0b16 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Mon Jul 6 13:53:50 2026 +0800 Fix: timestamp always visible && Double /api prefix (agentscope-ai#5802) commit 0bc68ed Author: Jinglin Peng <jlpengcs@gmail.com> Date: Mon Jul 6 11:49:56 2026 +0800 feat: switch desktop release to Tauri (agentscope-ai#5734) commit cc6303a Author: VectorPeak <garrufariw@gmail.com> Date: Mon Jul 6 11:48:51 2026 +0800 fix(utils): recover JSON after leading whitespace (agentscope-ai#5766) commit bb313ac Author: Jinglin Peng <jlpengcs@gmail.com> Date: Mon Jul 6 11:31:53 2026 +0800 fix: Include ACP modules in desktop bundle (agentscope-ai#5794) commit 7052644 Author: y1y5 <105190237+y1y5@users.noreply.github.com> Date: Mon Jul 6 10:51:39 2026 +0800 docs(plugins-migration): update v1 to v2 migration guides (agentscope-ai#5752) * docs(plugins-migration): update v1 to v2 migration guides * docs(plugins): address migration guide review comments * add migration guide navigation entry commit f5b1203 Author: mi1k7 <75235876+ustc-mkh@users.noreply.github.com> Date: Sat Jul 4 00:28:22 2026 +0800 feat(sandbox): implement windows native sandbox (agentscope-ai#5525) Co-authored-by: cuiyuebing <cuipaofu@gmail.com> commit f69e61d Author: wangfei010313 <wangfei01219@126.com> Date: Fri Jul 3 18:19:30 2026 +0800 fix(providers): update GitHub Models to new endpoint and support fine-grained PAT (agentscope-ai#5735) commit e228026 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Fri Jul 3 17:16:00 2026 +0800 feat: add request timeout, retry and AbortSignal support (agentscope-ai#5764) commit 66051e6 Author: zhaozhuang521 <71918264+zhaozhuang521@users.noreply.github.com> Date: Fri Jul 3 16:12:46 2026 +0800 refactor(session list): unify session item into SessionItem component(agentscope-ai#5754) commit 856f0ce Author: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Fri Jul 3 16:11:04 2026 +0800 fix(config): make agent resilient to invalid MCP client config (agentscope-ai#5755) commit 13af342 Author: qbc <qianbingchen.qbc@alibaba-inc.com> Date: Fri Jul 3 15:18:32 2026 +0800 fix: show stream completion time instead of first-chunk time for assistant messages (agentscope-ai#5742) commit 456cbf9 Author: sidiluo <wb-lsd703406@alibaba-inc.com> Date: Fri Jul 3 14:57:40 2026 +0800 fix(website): update blog developer day collection and add blog GA tracking (agentscope-ai#5758) commit 150c1d9 Author: yaozy2020 <88593746+yaozy2020@users.noreply.github.com> Date: Fri Jul 3 14:38:48 2026 +0800 fix(console): mobile chat history panel shows empty session list (agentscope-ai#5744) commit 65b4a04 Author: Runlin Lei <lei_runlin@163.com> Date: Fri Jul 3 14:34:43 2026 +0800 refactor(skill): skill-related UI (agentscope-ai#5753) commit f0cc70f Author: wangfei010313 <wangfei01219@126.com> Date: Fri Jul 3 14:33:58 2026 +0800 feat: add 'none' memory backend to disable long memory system (agentscope-ai#5732) commit f0d2279 Author: Yue Cui <39703217+cuiyuebing@users.noreply.github.com> Date: Fri Jul 3 14:17:27 2026 +0800 chore(version): bump version to 2.0.0b3 (agentscope-ai#5760)


Description
When a model request contains an unpaired tool block,
_sanitize_tool_messagesruns_reorder_tool_results+_remove_unpaired_tool_messagesto repair ordering/pairing. In that path, a valid AgentScope 2.0 self-paired assistant message — one that carries its owntool_calland matchingtool_resultin the sameMsg([text, tool_call, tool_result]) — was silently dropped, losing the text and the whole turn from the request sent to the model.Root cause (two functions):
_reorder_tool_resultstreated every result-bearing message as a movable result-carrier, skipping it to re-insert after atool_callin another message; for a self-paired message the call is in the same (skipped) message, so it was never re-inserted._remove_unpaired_tool_messagesonly scanned following messages for atool_call's results, so a self-paired message's owntool_resultnever satisfied its own use and the message was judged unpaired.Fix: keep messages that carry their own
tool_callin place during reordering; satisfy a message'stool_calls from its owntool_results first (and don't consume a following self-paired message as a result provider); and let a message's owntool_calls pair its owntool_results in the final sweep.Type of Change
Component(s) Affected
src/qwenpaw/agents/utils/tool_message_utils.py)Checklist
pre-commit run --all-files(on the changed files — see evidence)pytest)Testing
Added
TestSanitizeToolMessages::test_self_paired_message_kept_when_another_block_unpaired: a batch with an unrelated unpairedtool_callplus a valid self-paired[text, tool_call, tool_result]message. Before the fix the self-paired message is dropped; after, it is preserved (and the unpaired orphan is still removed). Classic separatetool_call/tool_resultpairs, result-before-call reordering, and orphan removal remain unchanged.Local Verification Evidence