mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-16 04:18:35 +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:
|
||||
sig = inspect.signature(self.task_ordering_callback)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
else:
|
||||
if len(sig.parameters) != 3:
|
||||
raise ValueError(
|
||||
"task_ordering_callback must accept exactly 3 parameters: (tasks, outputs, current_index)"
|
||||
)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
return self
|
||||
|
||||
|
||||
Reference in New Issue
Block a user