fix(tools): avoid double counting tool usage#5837
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR removes manual tool usage count incrementing and verbose logging from both synchronous and asynchronous tool execution paths in ChangesTool Usage Counting Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Root cause
CrewStructuredTool.invoke() already increments current_usage_count and syncs the original BaseTool. ToolUsage._use() and _ause() then incremented the same structured tool again after successful execution, causing tools with max_usage_count=2 to be exhausted after one agent invocation.
Validation
Contributor note
This PR was AI-authored. I attempted to apply the required
llm-generatedlabel, but GitHub denied label permissions for the fork author.Summary by CodeRabbit
Bug Fixes
Tests