[BUG] Crew.test crashes or misattributes scores when a ConditionalTask is skipped
Description
Crew.test() can raise IndexError after all iterations have completed when a ConditionalTask is skipped. Scores for subsequent tasks are shifted into the wrong rows; a trailing skip in only one run also omits another run's trailing score from the crew average.
Steps to Reproduce
- Create a crew with a regular task, a
ConditionalTaskwhose condition sometimes returnsFalse, and another regular task. - Call
crew.test(2, eval_llm=...)so the conditional task is skipped in at least one iteration. The regression tests in PR #7996 use mocked model calls and execute the realCrew.test()/kickoff()path. - Observe
IndexError: list index out of rangeinCrewEvaluator.print_crew_evaluation_result()or scores attributed to the wrong task.
Expected behavior
Skipped tasks display -; tasks that ran retain their scores; per-task and crew averages only include existing scores.
Screenshots/Code snippets
The evaluator assigns a callback to every task, but skipped ConditionalTasks never invoke it. print_crew_evaluation_result() indexes per-run score lists by every task position; a skipped task leaves a shorter list.
Operating System
Windows 11
Python Version
3.13 (local regression test environment)
crewAI Version
Repository main at 140bfcb (October 9, 2026)
crewAI Tools Version
Not needed to reproduce
Virtual Environment
Venv (uv-managed)
Evidence
Regression tests using the real Crew.test() path reproduce an IndexError before the fix. Targeted evaluator tests pass afterward (7 passed). A separate trailing-skip case demonstrates an incorrectly low overall average before the fix.
Possible Solution
Store scores at their task indices with placeholders for skipped tasks, and compute averages from actual scores. Proposed fix and regression tests: #7996.
Additional context
This issue and the linked PR were prepared with AI assistance; no external model calls are required for the regression tests.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.