crewai - ✅(Solved) Fix [BUG] JSON checkpoint listing/info ignores branch subdirectories [3 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#5491Fetched 2026-04-17 08:30:34
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×3referenced ×2assigned ×1closed ×1

JSON checkpoint discovery still assumes a flat location/*.json layout, but branch-aware checkpoint storage now writes JSON checkpoints under branch subdirectories such as:

  • ./.checkpoints/main/...json
  • ./.checkpoints/fork/<branch>/...json

As a result, the JSON checkpoint CLI/TUI discovery path misses valid checkpoints created after the fork-aware storage changes.

Root Cause

checkpoint_cli.py still uses flat globs:

  • _list_json() -> os.path.join(location, "*.json")
  • _info_json_latest() -> os.path.join(location, "*.json")

That no longer matches the branch-aware JSON layout introduced by the checkpoint forking work.

Fix Action

Fixed

PR fix notes

PR #5493: fix(checkpoint): discover branch-based JSON checkpoints

Description (problem / solution / changelog)

Fixes #5491

Summary

  • make JSON checkpoint discovery recursive so it finds both legacy flat files and newer branch-based files
  • reuse the same recursive lookup for _list_json() and _info_json_latest()
  • add focused CLI tests covering branch subdirectory discovery

Why this scope

Recent merged PRs in this area (#5381, #5387) introduced branch-aware JSON checkpoint storage, but the JSON discovery path in checkpoint_cli.py still used location/*.json globs.

That made this a good candidate for a narrow regression fix:

  • one subsystem (checkpoint_cli.py)
  • one behavioral gap (discovery)
  • backward-compatible behavior (flat layout still works)
  • straightforward tests

Test plan

  • uv run pytest lib/crewai/tests/cli/test_checkpoint_cli.py -q
  • uv run ruff check lib/crewai/src/crewai/cli/checkpoint_cli.py lib/crewai/tests/cli/test_checkpoint_cli.py
  • uv run ruff format --check lib/crewai/src/crewai/cli/checkpoint_cli.py lib/crewai/tests/cli/test_checkpoint_cli.py
  • manual CLI/TUI verification against a real project checkpoint directory

This PR was drafted with AI assistance. I could not apply an llm-generated label from my account.

Changed files

  • lib/crewai/src/crewai/cli/checkpoint_cli.py (modified, +15/-4)
  • lib/crewai/tests/cli/test_checkpoint_cli.py (added, +38/-0)

PR #5495: Fix #5491: JSON checkpoint discovery now finds branch subdirectories

Description (problem / solution / changelog)

Summary

Fixes #5491. _list_json() and _info_json_latest() in checkpoint_cli.py used flat globs (location/*.json) which missed checkpoints stored under branch subdirectories (e.g. main/, fork/exp1/) introduced by the fork-aware checkpoint storage (#5381, #5387).

Changed both functions to use recursive globs (location/**/*.json with recursive=True) so they discover checkpoints in branch subdirectories as well as the legacy flat layout.

Review & Testing Checklist for Human

  • Verify _list_json() finds checkpoints in nested branch dirs (e.g. .checkpoints/main/, .checkpoints/fork/exp1/)
  • Verify _info_json_latest() returns the most recent checkpoint across all branches
  • Verify backward compatibility: checkpoints in the legacy flat layout (directly in location/) are still discovered

Notes

  • The fix is a two-line change in checkpoint_cli.py — both _list_json and _info_json_latest now use os.path.join(location, "**", "*.json") with glob.glob(..., recursive=True)
  • Added 9 new tests covering: single branch, multiple branches, flat layout, mixed layout, empty directory, and latest-across-branches selection
  • The TUI (checkpoint_tui.py) delegates to _list_json, so it is also fixed by this change

Link to Devin session: https://app.devin.ai/sessions/00eb94f76b3f4597b577fb27ad6abac1

<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Small, localized change to CLI file discovery plus tests; primary risk is unintentionally picking up unrelated nested .json files under the checkpoint directory.

Overview Fixes JSON checkpoint discovery in checkpoint_cli.py by switching _list_json and _info_json_latest from flat *.json globs to recursive **/*.json searches, so checkpoints stored under branch/fork subdirectories are included alongside the legacy flat layout.

Adds a focused test suite in test_checkpoint.py covering recursive discovery across main/ and nested fork/... directories, mixed layouts, empty directories, and “latest checkpoint” selection across branches.

<sup>Reviewed by Cursor Bugbot for commit d3911d4c0cfef797665a07c57e04eb01d13a1b86. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai/src/crewai/cli/checkpoint_cli.py (modified, +8/-4)
  • lib/crewai/tests/test_checkpoint.py (modified, +128/-0)

PR #5501: fix: JSON checkpoint discovery ignores branch subdirectories

Description (problem / solution / changelog)

Summary

  • Use recursive glob (**/*.json) in _list_json() and _info_json_latest() so JSON checkpoints stored under branch subdirectories (e.g. main/, fork/exp1/) are discovered correctly
  • Maintains backward compatibility with the legacy flat layout

Closes #5491

Test plan

  • Verify _list_json() discovers checkpoints in branch subdirectories
  • Verify _info_json_latest() returns the most recent checkpoint across all branches
  • Verify legacy flat-layout checkpoints are still discovered
<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Small, localized change to filesystem globbing in the CLI; main risk is slight performance impact or unintended inclusion of extra .json files under the checkpoint directory.

Overview Checkpoint CLI JSON discovery now searches recursively (via **/*.json) when listing checkpoints and when computing the latest checkpoint, so checkpoints stored under branch/subdirectories are picked up alongside the legacy flat layout.

<sup>Reviewed by Cursor Bugbot for commit 0de4ef9d1206aa819be84170fa0255c0258b32a9. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai/src/crewai/cli/checkpoint_cli.py (modified, +8/-4)

Code Example

provider.checkpoint('{"entities": [], "event_record": {}}', root, branch='main')
provider.checkpoint('{"entities": [], "event_record": {}}', root, branch='fork/exp1')

---

main/<timestamp>_<id>_p-none.json
fork/exp1/<timestamp>_<id>_p-none.json

---

_list_json(root)
# => []

_info_json_latest(root)
# => None
RAW_BUFFERClick to expand / collapse

Summary

JSON checkpoint discovery still assumes a flat location/*.json layout, but branch-aware checkpoint storage now writes JSON checkpoints under branch subdirectories such as:

  • ./.checkpoints/main/...json
  • ./.checkpoints/fork/<branch>/...json

As a result, the JSON checkpoint CLI/TUI discovery path misses valid checkpoints created after the fork-aware storage changes.

Why this seems important

The recent checkpoint work (#5381, #5387) adds lineage, forking, and a richer checkpoint TUI. That makes JSON discovery correctness important for the current product direction, especially because the README positions Flows/checkpointing as production-ready control/state-management infrastructure.

Reproduction

Using the current source, write two JSON checkpoints:

provider.checkpoint('{"entities": [], "event_record": {}}', root, branch='main')
provider.checkpoint('{"entities": [], "event_record": {}}', root, branch='fork/exp1')

Filesystem result:

main/<timestamp>_<id>_p-none.json
fork/exp1/<timestamp>_<id>_p-none.json

Then inspect discovery:

_list_json(root)
# => []

_info_json_latest(root)
# => None

Root cause

checkpoint_cli.py still uses flat globs:

  • _list_json() -> os.path.join(location, "*.json")
  • _info_json_latest() -> os.path.join(location, "*.json")

That no longer matches the branch-aware JSON layout introduced by the checkpoint forking work.

Expected behavior

JSON checkpoint listing/info should discover checkpoints in the current branch-aware layout as well as the legacy flat layout.

Actual behavior

Valid JSON checkpoints exist on disk, but they are invisible to _list_json() / _info_json_latest() when they live under branch subdirectories.

Related

  • #5381
  • #5387

This report was drafted with AI assistance. I was not able to apply an llm-generated label from my account.

extent analysis

TL;DR

Update the glob patterns in _list_json() and _info_json_latest() to match the new branch-aware JSON layout.

Guidance

  • Modify the checkpoint_cli.py file to use recursive glob patterns that can find JSON files in subdirectories, such as os.path.join(location, "**/*.json").
  • Verify that the updated glob patterns correctly discover JSON checkpoints in both the legacy flat layout and the new branch-aware layout.
  • Consider adding a test case to ensure that the JSON checkpoint discovery works as expected for different branch scenarios.
  • Review the provider.checkpoint function to ensure it is correctly writing JSON checkpoints to the expected branch subdirectories.

Example

import glob

def _list_json(location):
    return glob.glob(os.path.join(location, "**/*.json"), recursive=True)

def _info_json_latest(location):
    json_files = glob.glob(os.path.join(location, "**/*.json"), recursive=True)
    # ... rest of the function remains the same ...

Notes

The solution assumes that the glob module is available and compatible with the Python version being used. Additionally, the recursive glob pattern may have performance implications for very large directories, but it should be sufficient for most use cases.

Recommendation

Apply the workaround by updating the glob patterns in checkpoint_cli.py to use recursive matching, as this will allow the JSON checkpoint discovery to work correctly with the new branch-aware layout.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

JSON checkpoint listing/info should discover checkpoints in the current branch-aware layout as well as the legacy flat layout.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING