fix: replace bare raise outside except block with explicit ToolUsageError#6512
fix: replace bare raise outside except block with explicit ToolUsageError#6512gautamkishore wants to merge 2 commits into
Conversation
…rror In _original_tool_calling, a bare raise on the non-dict branch is outside any active exception handler. Python raises RuntimeError instead of ToolUsageError. Fixes crewAIInc#6430
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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 (1)
📝 WalkthroughWalkthroughThe non-dictionary argument branch in ChangesTool usage error handling
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…c#6430) Covers the _original_tool_calling non-dict branch: with raise_error=True it must raise ToolUsageError, not RuntimeError from a bare raise outside an except block.
ErenAta16
left a comment
There was a problem hiding this comment.
Same one-line fix as #6486, #6512, #6511, #6499 — this is one of five open PRs (added this one to the tally) independently fixing the same bare-raise-outside-except bug in _original_tool_calling. Reproduced the bug standalone: the bare raise here raises RuntimeError: No active exception to reraise rather than the intended ToolUsageError, since it is outside any except block. This PR's fix is correct and equivalent to the others. Left a fuller comparison on #6486, which constructs the error once and reuses it for both branches rather than twice — noting the duplication here so only one lands.
In
_original_tool_calling, the bareraiseon the non-dict branch (line 853) is outside any active exception handler — Python raisesRuntimeError: No active exception to re-raiseinstead of the intendedToolUsageError.The other bare
raise(line 848) is inside theexcept Exception:block and is correct.Fixes #6430