mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
fix: Prevent callback validation ValueError from being suppressed
- Move signature parameter count validation outside try-except block - Only catch exceptions from inspect.signature(), not validation errors - Ensures invalid callbacks properly raise ValueError instead of passing silently - Addresses final Cursor Bugbot issue with callback validation bypass This resolves the remaining CI issue where the try-except block was too broad and caught the ValueError that should propagate for invalid callback signatures. Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -554,12 +554,13 @@ class Crew(FlowTrackable, BaseModel):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
sig = inspect.signature(self.task_ordering_callback)
|
sig = inspect.signature(self.task_ordering_callback)
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
if len(sig.parameters) != 3:
|
if len(sig.parameters) != 3:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"task_ordering_callback must accept exactly 3 parameters: (tasks, outputs, current_index)"
|
"task_ordering_callback must accept exactly 3 parameters: (tasks, outputs, current_index)"
|
||||||
)
|
)
|
||||||
except (ValueError, TypeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user