Skip to content

fix: Task dependency graph should validate cycles at creation time, not at runtime #6433

Description

@tcconnally

Problem

When tasks are defined with circular dependencies (A -> B -> C -> A), CrewAI does not detect the cycle until runtime, when it causes a RecursionError or infinite hang.

Steps

  1. Define Task A with depends_on=[Task B]
  2. Define Task B with depends_on=[Task C]
  3. Define Task C with depends_on=[Task A]
  4. Run the crew -> hangs or crashes

Expected

Cycle detection at graph construction time with a clear ValueError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions