mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 17:52:35 +00:00
When a consumer passes `id` in `kickoff(inputs=...)`, that value overwrites the flow's state.id — which was also being used as the execution tracking identity for telemetry, tracing, and external correlation. Two kickoffs sharing the same consumer id ended up with the same tracking id, breaking any downstream system that joins on it. Introduces `Flow.execution_id`: a stable per-run identifier stored as a `PrivateAttr` on the `Flow` model, exposed via property + setter. It defaults to a fresh `uuid4` per instance, is never touched by `inputs["id"]`, and can be assigned by outer systems that already have an execution identity (e.g. a task id). Switches the `current_flow_id` / `current_flow_request_id` ContextVars to seed from `execution_id` so OTel spans emitted by `FlowTrackable` children correlate on the stable tracking key. `state.id` keeps its existing override semantics for persistence/restore — consumers resuming a persisted flow via `inputs["id"]` work exactly as before. Adds tests covering default uniqueness per instance, immunity to consumer `inputs["id"]`, context-var propagation, absence from serialized state, and parity for dict-state flows.