Skip to content

[EPD-197] Warn locally when a persisted flow gets a non-UUID id input (AMP parity)#6539

Open
joaomdmoura wants to merge 2 commits into
mainfrom
joao/epd-197-amp-non-uuid-id-input-rejected-with-422-on-amp-undocumented
Open

[EPD-197] Warn locally when a persisted flow gets a non-UUID id input (AMP parity)#6539
joaomdmoura wants to merge 2 commits into
mainfrom
joao/epd-197-amp-non-uuid-id-input-rejected-with-422-on-amp-undocumented

Conversation

@joaomdmoura

@joaomdmoura joaomdmoura commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator
  • CrewAI AMP deployments reject non-UUID inputs.id values with HTTP 422, but the OSS library accepts any string locally, so kickoff(inputs={"id": "session-1"}) works in dev and fails on first AMP contact.
  • Adds a one-time UserWarning at kickoff when a flow with persistence active receives a non-UUID id input, telling the user AMP rejects such ids with 422 and to use a UUID (e.g. str(uuid4())).
  • Non-breaking: local behavior is unchanged — non-UUID ids keep working exactly as before; the warning only fires when persistence is active (when id is meaningful for state) and once per kickoff.
  • New tests in lib/crewai/tests/test_flow_id_format_warning.py: non-UUID id + persistence warns once and still runs; valid UUID id does not warn; non-UUID id without persistence does not warn. test_flow_persistence.py still passes.
  • Linear: https://linear.app/crewai/issue/EPD-197

🤖 Generated with Claude Code


Note

Low Risk
Adds a non-breaking UserWarning at kickoff with no change to flow execution or persistence semantics; scope is limited to id validation messaging.

Overview
Persisted flows that receive a non-UUID inputs["id"] at kickoff now emit a one-time UserWarning explaining that CrewAI AMP returns HTTP 422 for those ids, while OSS still accepts any string. Execution and persistence behavior are unchanged.

The warning runs only when persistence is considered active—instance/class backend, flow-level persist, or method-level @persist (via new _has_active_persistence()), not for flows with no persistence. Tests in test_flow_id_format_warning.py cover warn-once-still-runs, valid UUID silent, method-only persist, and no-persistence no warn.

Reviewed by Cursor Bugbot for commit 406b265. Bugbot is set up for automated code reviews on this repo. Configure here.

CrewAI AMP deployments reject non-UUID inputs.id values with HTTP 422,
while the OSS library accepts any string locally, so the mismatch only
surfaces on first deployed run. Emit a one-time UserWarning at kickoff
when persistence is active and the provided id is not a valid UUID.
Local behavior is unchanged — non-UUID ids keep working.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@linear

linear Bot commented Jul 14, 2026

Copy link
Copy Markdown

EPD-197

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Flow ID warning parity

Layer / File(s) Summary
Persisted kickoff validation
lib/crewai/src/crewai/flow/runtime/__init__.py
Flow kickoff detects instance, flow-level, and method-level persistence, then warns when inputs["id"] cannot be coerced to a UUID.
Warning behavior coverage
lib/crewai/tests/test_flow_id_format_warning.py
Tests cover non-UUID warnings, valid UUIDs, method-level persistence, state persistence, execution, and non-persisted flows.

Sequence Diagram(s)

sequenceDiagram
  participant Flow as Flow.kickoff_async
  participant Persistence as _has_active_persistence
  participant Validator as _warn_if_non_uuid_flow_state_id
  Flow->>Persistence: Check active persistence
  Persistence-->>Flow: Return persistence status
  Flow->>Validator: Validate inputs["id"]
  Validator-->>Flow: Emit UserWarning for non-UUID
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: warning locally for non-UUID persisted flow IDs for AMP parity.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the warning behavior and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch joao/epd-197-amp-non-uuid-id-input-rejected-with-422-on-amp-undocumented

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 450a4de. Configure here.

Comment thread lib/crewai/src/crewai/flow/runtime/__init__.py
Comment thread lib/crewai/tests/test_flow_id_format_warning.py Fixed
Method-level @persist stamps persistence into the flow definition's
per-method config and never sets self.persistence, so the AMP parity
warning missed flows persisting only via method decorators. Detect
active persistence across instance/class-level backends, the flow-level
definition, and per-method persist configs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant