Subject: [Bug Report] Graph View missing tasks for large nested TaskGroups
Body:

Hello Airflow Core Team,

I hope you are doing well.

I observed a potential bug in Apache Airflow v2.7.x where the Graph View UI
sometimes fails to render all tasks in DAGs with more than 20 nested
TaskGroups. I drafted this bug report with guidance and have verified the
issue in my environment.

Steps to reproduce:
1. Create a DAG with 25+ tasks.
2. Nest some tasks using TaskGroup.
3. Open Graph View in Airflow Web UI.

Expected behavior:
- All tasks and dependencies should render correctly, regardless of the
number of nested TaskGroups.

Actual behavior:
- Some tasks disappear, and edges fail to connect, making DAG visualization
incomplete.

Environment:
- Apache Airflow v2.7.2
- Python 3.11
- Chrome v120
- OS: Ubuntu 22.04

Proposed solution:
- Update `dagGraph.render()` in `airflow/www/static/js/daggraph.js` to
dynamically calculate node offsets.
- Ensure the SVG container resizes dynamically to fit all tasks.
- Optional: add a scrollable container for DAGs with hundreds of tasks.
- I can provide a Pull Request with the fix if desired.

Thank you for your time and for maintaining this incredible project.

Best regards,
Khasim Shaik


Script

from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.utils.task_group import TaskGroup
from datetime import datetime

# Define DAG
with DAG(
    dag_id='nested_taskgroup_bug_demo',
    start_date=datetime(2025, 10, 21),
    schedule_interval=None,
    catchup=False,
) as dag:

    start = DummyOperator(task_id='start')
    end = DummyOperator(task_id='end')

    # Outer TaskGroup
    with TaskGroup("outer_group") as outer_group:
        # Nested TaskGroups
        for i in range(1, 4):  # 3 nested groups
            with TaskGroup(f"nested_group_{i}") as nested_group:
                for j in range(1, 10):  # 9 tasks per nested group
                    task = DummyOperator(task_id=f"task_{i}_{j}")

    # DAG structure
    start >> outer_group >> end

Reply via email to