Repository navigation
feat(cli): add read-only inspection of a persisted flow state - #9482
Keyi Yu (keyiyu0331) wants to merge 1 commit into
Conversation
Add `crewai flow state DB_PATH FLOW_UUID RECORD_ID [--json]`, which shows one row of the flow_states table written by SQLiteFlowPersistence. The database is opened read-only and is never created or modified. Listing a flow's history depends on crewAIInc#8138 and is left for a follow-up. Part of crewAIInc#8140 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WnKATbxGa5vTLtZffHkGAz
Strix Security Review✅ No open security findings. PR summary: Adds a `crewai flow state DB_PATH FLOW_UUID RECORD_ID [--json]` command that shows a single row of the `flow_states` table written by `SQLiteFlowPersistence`, opening the database with a read-only SQLite URI and never creating or modifying files. Review summaryReviewed the new read-only Ruled out (4)
Review 1 on this PR · Reviewed by Strix |
Related issue
Part of #8140 (AI-assisted; please apply
llm-generatedif I can't set the label).Summary
Adds
crewai flow state DB_PATH FLOW_UUID RECORD_ID [--json], which shows onerow of the
flow_statestable written bySQLiteFlowPersistence.--jsonoutput; both name the storage kind so it is notconfused with full-object checkpoints.
mode=ro, a missing file isnever created, and no
-wal/-shmfiles are left behind. States still in apending write-ahead log (a flow that is running) are still shown.
sqlite3directly rather than throughSQLiteFlowPersistence,because constructing that class creates the database and sets WAL mode, and
crewai-cli does not depend on crewai. The query matches
load_state_from_history(feat(flow): add exact historical state lookup by row id #8272), and a test checks both return the same state.checkpoint list/info/resumecommands are unchanged.This covers the exact-record inspection half of the ticket. Bounded history
listing depends on #8138 (#8253) and is left for a follow-up.
The ticket asks to confirm the command shape first. I went with
flow stateunder the existing
flowgroup and am happy to rename or move it.Verification
lib/cli/tests/test_flow_state_cli.py(18 tests, CliRunner and temp files, noAPI calls): JSON and text output, wrong UUID, unknown record id, empty store,
missing database, non-SQLite file, unsupported schema, non-object state,
invalid record ids, store left byte-identical, pending write-ahead log, and a
store written by the real
SQLiteFlowPersistence. Also ranruff check,ruff format --checkandmypyon the changed files.Additional context
No docs changes yet; I can add a CLI docs entry with translations once the
command shape is confirmed.