fix: hash callback args correctly to ensure caching works
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled

This commit is contained in:
Greyson LaLonde
2025-11-05 07:19:09 -05:00
committed by GitHub
parent 5abf976373
commit 54710a8711
3 changed files with 161 additions and 8 deletions

View File

@@ -62,18 +62,23 @@ class TestAgentEvaluator:
agents=mock_crew.agents, evaluators=[GoalAlignmentEvaluator()]
)
task_completed_event = threading.Event()
task_completed_condition = threading.Condition()
task_completed = False
@crewai_event_bus.on(TaskCompletedEvent)
async def on_task_completed(source, event):
# TaskCompletedEvent fires AFTER evaluation results are stored
task_completed_event.set()
nonlocal task_completed
with task_completed_condition:
task_completed = True
task_completed_condition.notify()
mock_crew.kickoff()
assert task_completed_event.wait(timeout=5), (
"Timeout waiting for task completion"
)
with task_completed_condition:
assert task_completed_condition.wait_for(
lambda: task_completed, timeout=5
), "Timeout waiting for task completion"
results = agent_evaluator.get_evaluation_results()