[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
Open
Conversation
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>
📝 WalkthroughWalkthroughChangesFlow ID warning parity
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
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

inputs.idvalues with HTTP 422, but the OSS library accepts any string locally, sokickoff(inputs={"id": "session-1"})works in dev and fails on first AMP contact.UserWarningat kickoff when a flow with persistence active receives a non-UUIDidinput, telling the user AMP rejects such ids with 422 and to use a UUID (e.g.str(uuid4())).idis meaningful for state) and once per kickoff.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.pystill passes.🤖 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-timeUserWarningexplaining 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 intest_flow_id_format_warning.pycover 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.