[BUG] CrewOutput.json rejects valid JSON when a final conditional task is skipped
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza con CrewOutput.json en crewai/crews/crew_output.py y compara su selección de tareas con Crew._create_crew_output. La reproducción del issue crea una tarea JSON seguida de una tarea vacía omitida; úsala para comprobar el comportamiento. Se considera terminado cuando result.json devuelve el JSON de la tarea anterior y el comportamiento existente de json_dict is None permanece sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
When the last ConditionalTask is skipped, it appends an empty TaskOutput in RAW format. Crew._create_crew_output correctly selects the last non-empty task output, so a preceding task's JSON becomes the crew's final json_dict. CrewOutput.json checks tasks_output[-1] instead and raises ValueError even though the returned crew output contains valid JSON.
Steps to Reproduce
Use a crew whose first task produces JSON via output_json, followed by a ConditionalTask whose condition returns False. After Crew.kickoff(), access result.json.
The same state can be reproduced without an LLM:
from crewai.crews.crew_output import CrewOutput
from crewai.tasks.output_format import OutputFormat
from crewai.tasks.task_output import TaskOutput
produced = TaskOutput(
description="Produce JSON", agent="Writer", raw='{"answer": 42}',
output_format=OutputFormat.JSON, json_dict={"answer": 42},
)
skipped = TaskOutput(description="Skipped", agent="Reviewer", raw="")
result = CrewOutput(
raw=produced.raw, json_dict=produced.json_dict,
tasks_output=[produced, skipped],
)
print(result.json)
On main at 77237aec, the last line raises ValueError: No JSON output found in the final task....
Expected behavior
result.json returns {"answer": 42}, matching the final non-empty task selected for result.raw and result.json_dict.
Screenshots/Code snippets
Crew._create_crew_output uses [t for t in task_outputs if t.raw][-1]; CrewOutput.json currently checks self.tasks_output[-1].output_format.
Environment
- Operating System: Windows 11
- Python Version: 3.13.7 (not listed in the issue form's dropdown)
- crewAI Version: 1.15.45 from this source checkout
- crewAI Tools Version: not used in this reproduction
- Virtual Environment: Venv
Evidence
On the patched branch, the focused regression and existing JSON-none control both pass (2 passed), and Ruff passes. A broader VCR-marked test was not run successfully because the Windows event loop could not create a socket in this environment.
Possible Solution
Have CrewOutput.json inspect the last task output with non-empty raw, as Crew._create_crew_output does. The existing json_dict is None behavior can remain unchanged.
Additional context
This differs from #8737 / #8741, which cover an empty tasks_output list, and from #8483, which concerns downstream context after a skipped conditional task.
- Lenguaje dominante
- Python
- Estrellas
- 61.2k
- Forks
- 9.2k
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 180
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crewAIInc/crewAI
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerPosiblemente ocupada @HashimSyedUBC la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native Azure provider ignores the seed settingPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
crewAIInc/crewAI#9787 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native OpenAI async streaming does not send response_model as response_formatPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de crewAIInc/crewAI
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fedora-infra/anitya#2272 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
unitaryfoundation/mitiq#3205 ·
Los mantenedores suelen responder en 6 días
-
[Bug]: Index worker test drops empty Git config values on WindowsPosiblemente ocupada @xiaoyesoso la tomó hoy. Abiertotriage/confirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
agentscope-ai/agentscope#4377 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
area/config comp/agent P2 type/perf
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NousResearch/hermes-agent#161039 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
astral-sh/ty-pre-commit#46 ·