[BUG] CrewOutput.json rejects valid JSON when a final conditional task is skipped
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia da CrewOutput.json in crewai/crews/crew_output.py e confronta la selezione delle attività con Crew._create_crew_output. La riproduzione nell’issue crea un’attività JSON seguita da un’attività vuota ignorata; usala per verificare il comportamento. Il lavoro è completato quando result.json restituisce il JSON dell’attività precedente e il comportamento esistente di json_dict is None rimane invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 61.2k
- Fork
- 9.2k
- Merge medio
- 1g 14h
- PR unite (30g)
- 180
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crewAIInc/crewAI
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerForse già presa @HashimSyedUBC l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingForse già presa @basil-k-aji-dev l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Native Azure provider ignores the seed settingForse già presa @basil-k-aji-dev l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
crewAIInc/crewAI#9787 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryForse già presa @basil-k-aji-dev l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Native OpenAI async streaming does not send response_model as response_formatForse già presa @basil-k-aji-dev l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di crewAIInc/crewAI
Issue simili
-
[Bug]: Index worker test drops empty Git config values on WindowsForse già presa @xiaoyesoso l’ha presa oggi. Apertatriage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
agentscope-ai/agentscope#4377 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
area/config comp/agent P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#161039 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
astral-sh/ty-pre-commit#46 ·
-
Fast and light shell approval "Always allow" button shows raw English backticks and scrambles commands in ArabicForse già presa @tylerbea l’ha presa oggi. Apertaagent-ui bug p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
verl-project/verl#8893 ·
I maintainer di solito rispondono entro 1 giorno