Revert "refactor: remove unused and methods from (#5172)"#5243
Merged
lucasgomide merged 2 commits intomainfrom Apr 2, 2026
Merged
Revert "refactor: remove unused and methods from (#5172)"#5243lucasgomide merged 2 commits intomainfrom
lucasgomide merged 2 commits intomainfrom
Conversation
This reverts commit bb9bcd6.
greysonlalonde
approved these changes
Apr 2, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| return sanitize_tool_name( | ||
| func_info.get("name", "") or tool_call.get("name", "unknown") | ||
| ) | ||
| return "unknown" |
There was a problem hiding this comment.
Reverted method _extract_tool_name is unused dead code
Low Severity
The _extract_tool_name method is defined but never called anywhere in the codebase — not in production code, not in tests. The similar utility extract_tool_call_info (imported and used throughout the file) already handles tool call info extraction. This is dead code that adds maintenance burden. The original PR (#5172) correctly identified it as unused; reverting it reintroduces the same dead code.
3 tasks
royzhz
pushed a commit
to royzhz/crewAI
that referenced
this pull request
Apr 3, 2026
…rewAIInc#5243) * Revert "refactor: remove unused and methods from (crewAIInc#5172)" This reverts commit bb9bcd6. * test: fix tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This reverts commit bb9bcd6.
The AgentExecutor is a Flow — its execution is driven by state transitions defined via @router decorators. Here's exactly what happens:
The deleted check_native_todo_completion was the router for the execute_native_tool state:
When the agent uses native tool calling (which gpt-5.4-mini does), the execution path is:
With check_native_todo_completion present, the flow continues:
With it deleted, the Flow has no router registered for the execute_native_tool output. The flow simply stops — it has nowhere to go. At that point, state.current_answer is still an AgentAction (a tool call), not an AgentFinish, so the check at line 2591 raises:
The _extract_tool_name helper was also deleted — it's used by other routing logic to figure out which tool was called. Without it, any code path that tries to identify tool calls by name would also break.
In short: deleting these methods broke the Flow's state machine by removing a critical routing node. The agent successfully called a tool, but the Flow had no transition defined for what to do after the tool executed, so it silently exited the loop without a final answer.
Note
Medium Risk
Touches
AgentExecutorflow routing for the native tool-calling path; mistakes here could cause executions to stop early or mark todos incorrectly, but the change is small and covered by a targeted unit test.Overview
Restores missing
AgentExecutorFlow nodes for the native tool-calling execution path by re-adding_extract_tool_nameand a@router(execute_native_tool)method (check_native_todo_completion).This ensures that after
execute_native_toolruns, the Flow can transition totodo_satisfied/todo_not_satisfied(instead of dead-ending) when todos are active. Adds a regression test validatingcheck_native_todo_completionbehavior with and without an active todo.Written by Cursor Bugbot for commit f121f79. This will update automatically on new commits. Configure here.