crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] crewai test misaligns evaluation rows when iteration count is not three

Open Timotty opened this issue 1 month ago • 0 comments

Description

crewai test -n N renders malformed task-score rows when N is not 3 and a task was processed by more than one agent. The table creates 3 + N columns dynamically, but continuation-agent and separator rows always pass six cells to Rich.

For one or two runs, Rich silently creates extra unnamed columns and the agent name is no longer under the Agents header. For five runs, the continuation agent appears under Run 5 instead of Agents.

Steps to reproduce

  1. Run a crew evaluation with a non-default iteration count, for example crewai test -n 2.
  2. Use a task whose processed_by_agents contains at least two agents.
  3. Inspect the Tasks Scores table.

The same behavior can be reproduced without model calls by populating a CrewEvaluator with two score runs and a task with two processed_by_agents, then calling print_crew_evaluation_result().

Expected behavior

Every row should contain exactly the number of cells declared by the table. Continuation agent names should always appear under Agents, independently of the number of evaluation runs.

Screenshots / code snippets

The columns are defined dynamically:

table.add_column("Tasks/Crew/Agents", style="cyan")
for run in range(1, len(self.tasks_scores) + 1):
    table.add_column(f"Run {run}", justify="center")
table.add_column("Avg. Total", justify="center")
table.add_column("Agents", style="green")

But these rows are fixed at six cells:

for agent in agents[1:]:
    table.add_row("", "", "", "", "", f"- {agent}")

if task_index < len(self.crew.tasks) - 1:
    table.add_row("", "", "", "", "", "")

For N=2, the table declares five columns but these calls pass six values. For N=5, it declares eight columns but the continuation-agent call passes only six values.

Operating system

Windows 11

Python version

3.13

crewAI version

1.15.27 / main at 6b93fa0e25a926215ca7bb52a95d4db7d9d7262d

crewAI Tools version

Not involved

Virtual environment

Venv (uv)

Evidence

A focused regression test with two score runs and two processed agents fails because the expected five-cell continuation row is never emitted. The implementation instead calls add_row("", "", "", "", "", "- Agent 2").

The issue is deterministic and does not require an LLM or network access.

Possible solution

Build padding from the run count. There should be len(tasks_scores) + 1 empty cells between the leading task-name cell and the final Agents cell:

empty_score_columns = [""] * (len(self.tasks_scores) + 1)
table.add_row("", *empty_score_columns, f"- {agent}")
table.add_row("", *empty_score_columns, "")

Additional context

This is in the same renderer as #7997 / PR #7998, but it is a separate defect: #7997 concerns skipped conditional tasks and score alignment, while this report concerns fixed-width Rich rows when the user chooses an iteration count other than three.

Timotty avatar Oct 10 '26 11:10 Timotty