Skip to content

Conversation

@linw1995
Copy link
Owner

Summary

Fixes the bug where only the last ToolResult was reported when executing multiple tools concurrently. Now all tool results are collected and batched together before sending to the LLM.

Changes

  • Added PendingToolExecutions event to notify when concurrent tool executions start
  • Introduced CollectedToolResult struct to hold collected results
  • Added pending_tool_ids and collected_tool_results fields to track concurrent execution state
  • Modified ToolResult handling to batch results when concurrent execution is detected
  • Only sends results to LLM after all pending tool executions complete

Technical Details

When multiple tools are executed in parallel:

  1. The system receives a PendingToolExecutions event with the list of tool IDs
  2. Each tool result is collected in collected_tool_results as it arrives
  3. Results are tracked in pending_tool_ids to know when all are complete
  4. Once all results are collected, they are sent together as a single message to the LLM

This ensures no tool results are lost during concurrent execution.

Resolves #149

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.76%. Comparing base (a46f02c) to head (111628f).
⚠️ Report is 7 commits behind head on dev.

Files with missing lines Patch % Lines
crates/coco-tui/src/components/chat.rs 0.00% 48 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #151      +/-   ##
==========================================
- Coverage   50.22%   48.76%   -1.47%     
==========================================
  Files          93       95       +2     
  Lines       25033    26153    +1120     
==========================================
+ Hits        12574    12753     +179     
- Misses      12459    13400     +941     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linw1995 linw1995 merged commit 4b27118 into dev Jan 28, 2026
3 checks passed
@linw1995 linw1995 added the bug Something isn't working label Jan 28, 2026
@linw1995 linw1995 deleted the fix/concurrent-tool-results branch January 30, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Only the last ToolResult is reported when executing multiple tool uses concurrently

3 participants