Skip to content

fix(tasks): rename json property to json_output to avoid BaseModel method conflict - #6553

Open
bunnysayzz wants to merge 1 commit into
crewAIInc:mainfrom
bunnysayzz:main
Open

fix(tasks): rename json property to json_output to avoid BaseModel method conflict#6553
bunnysayzz wants to merge 1 commit into
crewAIInc:mainfrom
bunnysayzz:main

Conversation

@bunnysayzz

Copy link
Copy Markdown

Description

Both TaskOutput and CrewOutput inherit from Pydantic's BaseModel, which provides a built-in .json() method. Both classes defined a @property named json which shadowed BaseModel.json(), causing serialization conflicts.

This was acknowledged by a TODO comment in task_output.py.

Changes

  • task_output.py: Renamed @property def json to @property def json_output, removed the TODO comment and # type: ignore[override]
  • crew_output.py: Renamed @property def json to @property def json_output, removed the # type: ignore[override], added a docstring
  • test_task.py: Updated 4 references from result.json to result.json_output, renamed test for consistency

Testing

  • All existing tests pass with the updated property name
  • The renamed property still returns the same JSON string as before
  • Pydantic's native BaseModel.json() method is now accessible again

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 39f1cb5c-01f0-41b7-b4e2-b98a0e6830cb

📥 Commits

Reviewing files that changed from the base of the PR and between 143e902 and 92fdcfb.

📒 Files selected for processing (3)
  • lib/crewai/src/crewai/crews/crew_output.py
  • lib/crewai/src/crewai/tasks/task_output.py
  • lib/crewai/tests/test_task.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • lib/crewai/src/crewai/crews/crew_output.py
  • lib/crewai/tests/test_task.py
  • lib/crewai/src/crewai/tasks/task_output.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Renames CrewOutput.json() to json_output(), changes TaskOutput.json() to a json_output property, and updates task tests for sequential, hierarchical, missing-configuration, and cross-task JSON output.

Changes

JSON output API

Layer / File(s) Summary
JSON output accessors
lib/crewai/src/crewai/crews/crew_output.py, lib/crewai/src/crewai/tasks/task_output.py
Crew output exposes json_output(). Task output exposes json_output as a property. JSON validation and serialization remain unchanged.
Task JSON output tests
lib/crewai/tests/test_task.py
Task tests now read result.json_output for sequential, hierarchical, missing-configuration, and cross-task scenarios.

Merge Risk: ⚪ Minimal · up to c608b

This change moves JSON output access to json_output while restoring the inherited Pydantic json() method. No unresolved risk remains for the current change.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the conflict, lists the affected files, and describes testing. It does not follow the repository template because it omits the Related issue section, the Verification checklis… Add the required Related issue entry, complete the Verification checklist with the relevant test and quality-check results, and add an Additional context section with compatibility notes or "None".
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: renaming the json property to json_output to avoid the BaseModel method conflict.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the conflict, lists the affected files, and describes testing. It does not follow the repository template because it omits the Related issue section, the Verification checklist, and the Additional context section.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

…thod conflict

The TaskOutput and CrewOutput classes inherit from Pydantic's BaseModel,
which provides a built-in .json() method. Both classes defined a @Property
named 'json' which shadowed BaseModel.json(), causing serialization
conflicts. This renames the property to 'json_output' and updates all
references.

Closes the TODO comment in task_output.py that acknowledged this issue.
@bunnysayzz

Copy link
Copy Markdown
Author

Synced back onto latest upstream main (was behind), no conflicts. JSON task tests pass, 8 of 9, the one failure is the live-OpenAI kickoff test that needs network access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant