Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the tool execution logic to aggregate multiple results from a single tool call into one message. By collecting partial results in a list and joining them before final processing, the runner now ensures that streamed or multi-yield tool outputs are associated with a single tool call ID. Additionally, a new test case and a mock executor were added to verify this aggregation behavior. I have no feedback to provide.
a4c4a7d to
9bd38ca
Compare
|
Gentle ping on this streamed tool-result fix. The branch is meant to keep partial chunks grouped by tool call while still preserving streaming behavior. The repo checks are green except for the long-running Sourcery review entry, which appears to be an external bot state rather than a test failure. Could a maintainer take a look when convenient? |
|
顶一下~ 这个把同一次 call 的流式 tool 结果按 call 合并,否则多段结果会串在一起。有空麻烦 review 下,需要的话我可以补个用例。 |
|
Third and last nudge on this one. The runner file moved on 08-08, so the May diff probably needs a real rebase rather than a rubber stamp. The issue itself has not changed conceptually: partial chunks of one tool call can still interleave with another call's chunks in the streamed path, and this groups them per call. If a maintainer is interested I will rebase and re-verify against the new structure; otherwise I will close it next pass and keep the branch around for reference. |
|
@camera-2018 9 月 13 号 approve 之后一直没合。现在卡着的只有 Sourcery review 这个 pending 状态,不是真实失败。还需要我这边补什么吗,还是可以直接合? |
|
@camera-2018 批准一个月了。master(48ba71ad)上 runner 仍然按 chunk 直接 append,同一次 tool call 的流式结果分段到达时还是会串。这个补丁的合并逻辑和测试对当前 master 依旧成立。方便的时候合一下?如果项目现在对这块有别的规划,说一声我先关掉。 |
…or-tool-result-continue # Conflicts: # astrbot/core/agent/runners/tool_loop_agent_runner.py
|
Merged current master in Ruff check and format pass on both changed files. Local pytest did not complete because the existing environment hit iCloud read timeouts, and the isolated dependency install was unavailable; I am not claiming a local suite pass. Current-head CI remains the verification gate. |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Supplementing the merge note: the complete |
|
@camera-2018 The current head |
Linked issuesChecked at commit 65bceda #8028 [Bug] 异步生成器工具多次 yield 时 tool_result_id 重复,Anthropic API 报 400 · 1 of 1 met
|
|
Added the missing special-result regressions in The new cases cover a tool returning The new head is running hosted checks now, so the earlier approval still needs to be re-established before merge. |
…or-tool-result-continue # Conflicts: # astrbot/core/agent/runners/tool_loop_agent_runner.py
|
Resolved the current The resolution keeps the current Current-base red check before the resolution: Resolved head: All 23 hosted checks now pass, and the PR is mergeable again. Ruff check passes on the production and test files; the production file also passes Ruff format. The only test-only maintenance was the import ordering required by the current Ruff rule set. |
Fixes #8028.
Modifications / 改动点
Collects multiple
CallToolResultchunks produced by an async-generator tool execution and appends a single tool result block for the originaltool_call_id.Keeps cached image handling and tool hook behavior in the existing flow.
Adds a regression test that yields two
CallToolResultvalues for one tool call and verifies AstrBot stores onetoolmessage with both partial results.This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Verification commands run locally on Windows:
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Consolidate streamed tool execution results into a single provider-facing tool message per call.
Bug Fixes:
Enhancements:
Tests: