Repository navigation
Description
Starting with Airflow 3.3.1, the Grid and Graph views return HTTP 500 for Dags whose TaskGroups have dependencies that form a cycle when each group is treated as a single unit, even though the task-level graph is acyclic. These Dags parse, schedule and run normally, and they rendered in the UI up to and including 3.3.0.
One proposed change (#73087) would reject these Dags at parse time. That is also a breaking change for existing Dags, this time with an import error. Before choosing a direction, I'd like community input on:
- how to handle the regression,
- whether these Dags should be allowed at all,
- how any change should be rolled out and communicated.
I'm affected by this on my own Dags as well.
How we got here
- Fix grid/graph view topological sort for group-level and cross-group dependencies #69933 (backported to
v3-3-testin [v3-3-test] Fix grid/graph view topological sort for group-level and cross-group dependencies (#69933) #70591, released in 3.3.1) fixed the group-level topological sort used by Grid/Graph (closes Tasks in the Grid view are not in topological order #65291). Before that change, the sort ignored group-to-group and cross-group edges and silently rendered an arbitrary order. It now takes those edges into account, so a pre-existing group-level cycle raisesValueError("A cyclic dependency occurred in dag: ..."), which surfaces as a 500 from the Grid and Graph endpoints. - UI: Fix Grid view for bidirectional TaskGroup dependencies #72822 tried to keep these Dags renderable in the UI by falling back to strongly-connected-component ordering. It was closed after review comments suggested that cyclic TaskGroup dependencies should be treated as invalid. Those comments noted that planned TaskGroup features (task loops, dynamic TaskGroups, "retry/clear this TaskGroup", "wait for TaskGroup completion") could have undefined behaviour on these Dags.
- Reject cyclic TaskGroup dependencies during Dag parsing #73087 (open) proposes moving the failure to parse time with an import error that names the offending TaskGroup and the nodes involved in the cycle. Another user raised concerns there about doing this in a patch release without following the deprecation policy.
Affected Dag shapes
A task with no upstream task inside its own group counts as a root of that group, even when a task outside the group provides its only upstream. Group-level edges are built from those roots.
1. Sibling groups with dependencies in both directions:
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.sdk import DAG, TaskGroup
with DAG("tg_cycle", schedule=None):
with TaskGroup("group1"):
a1 = EmptyOperator(task_id="a1")
a2 = EmptyOperator(task_id="a2")
with TaskGroup("group2"):
b1 = EmptyOperator(task_id="b1")
b2 = EmptyOperator(task_id="b2")
a1 >> b1 # group1 -> group2
b2 >> a2 # group2 -> group12. Two tasks in one group bridged by a task outside it:
with DAG("tg_bridged", schedule=None):
with TaskGroup("g"):
a = EmptyOperator(task_id="a")
b = EmptyOperator(task_id="b")
ext = EmptyOperator(task_id="ext")
a >> ext >> b # g -> ext -> gBoth are acyclic at the task level. This pattern is common when TaskGroups are used for logical or visual grouping (for example one group per database schema) rather than as execution units. Users report hitting it when upgrading from 2.x to 3.3.1.
Impact by version
| Version | Parsing / scheduling | Grid / Graph view |
|---|---|---|
| ≤ 3.3.0 | Works | Renders, but group order can be wrong |
| 3.3.1, 3.3.2 | Works | HTTP 500 |
| With #73087 | Import error, Dag not loaded | N/A |
Open questions for the community
- Should these Dags be allowed at all?
- Against allowing them: group-level features need an unambiguous group ordering (see the discussion in UI: Fix Grid view for bidirectional TaskGroup dependencies #72822).
- For allowing them: many users rely on TaskGroups purely as a visual or logical grouping, and the task graph itself is valid.
- How should the change be rolled out, given the deprecation policy? Options include:
- Keep allowing them permanently, and make Grid/Graph tolerate group-level cycles (e.g. the approach in UI: Fix Grid view for bidirectional TaskGroup dependencies #72822).
- Hard-reject at parse time in a patch release (Reject cyclic TaskGroup dependencies during Dag parsing #73087 as it stands).
- Emit a deprecation warning / Dag warning at parse time now, keep Grid/Graph working (e.g. with a fallback ordering), and hard-reject in a later minor or major release.
- Hard-reject only from 3.4.0, and fix the 500 in 3.3.x separately.
- What should 3.3.x users do in the meantime? Currently the only workaround is to restructure the Dag: remove the cycle or flatten the affected TaskGroups. Tasks keep running and stay reachable through the REST API.
- Communication: a
significantnewsfragment exists in Reject cyclic TaskGroup dependencies during Dag parsing #73087. Should there also be a known-issue note in the 3.3.1/3.3.2 release notes and/or an announcement on the dev/users mailing list?
Related
- Tasks in the Grid view are not in topological order #65291: original issue (Grid view not in topological order)
- Fix grid/graph view topological sort for group-level and cross-group dependencies #69933 / [v3-3-test] Fix grid/graph view topological sort for group-level and cross-group dependencies (#69933) #70591: sort fix that exposed the cycle (released in 3.3.1)
- UI: Fix Grid view for bidirectional TaskGroup dependencies #72822: UI fallback approach (closed)
- Reject cyclic TaskGroup dependencies during Dag parsing #73087: parse-time rejection (open)
- Discussion: https://lists.apache.org/thread/sossl7b2w2ftyk4028qrhps2tcdxj2px
Are you willing to submit PR?
- Yes. I'm willing to submit PRs for whichever direction the community agrees on.
Drafted-by: Claude Code (Opus 5.5); reviewed by @dheerajturaga before posting
Activity
dheerajturaga commentedon Sep 24, 2026
Another case, found by @shubhamraj-git while reviewing #73087 (#73087 (comment)): a Dag whose group-level dependencies have no cycle can still get a 500 from Grid/Graph when the view is filtered.
Unfiltered Grid/Graph return 200. With
root=g.first&include_downstream=true,partial_subset()dropsg.guard, sog.secondbecomes a root ofg. The group-level edges then becomeg ↔ bridge, and both endpoints return 500. The same failure happens without #73087.So filtering can create group-level cycles even for Dags that pass any parse-time check. Whatever we decide on rejecting these Dags, the Grid/Graph ordering needs to tolerate group-level cycles rather than error out. I'll handle that in a separate PR.
Drafted-by: Claude Code (Opus 5.5); reviewed by @dheerajturaga before posting
rloredo commentedon Oct 1, 2026
We use task groups as a visual aid for grouping tasks not to create dependencies.
Disallowing these type of dags needs to come with an alternative to organize tasks in "folders".
dheerajturaga commentedon Oct 7, 2026
Thanks @rloredo. Many people use TaskGroups as folders, and you're not the only one affected. The same came up on #73087 (one group per database schema) and #73724 (dbt models in a group with a Spark task between two of them).
Here's what the dev list agreed (discussion, result):
TaskGroupCycleDeprecationWarning(Deprecate cyclic TaskGroup dependencies #73746). They keep parsing and running.Until 3.4.0, only Grid and Graph are affected. Tasks keep running and the REST API still works.
The reason for the change is that planned TaskGroup features, such as loops, dynamic TaskGroups, retrying a group and waiting for a group to finish, need each group to come either before or after its neighbours. A cycle makes that impossible.
The rule: a dependency into or out of any task in a group counts as a dependency of the whole group. So a path that leaves a group and comes back into it (
g.a >> x >> g.b) is a cycle.How to restructure. One of these usually works without changing any task dependencies:
This changes task IDs (for example,
sales.loadbecomesload.sales.load). Check anything that refers to tasks by ID, such as sensors orxcom_pullcalls.Once 3.4.0 is out, you can find affected Dags in CI by running your Dag tests with
-W error::airflow.sdk.exceptions.TaskGroupCycleDeprecationWarning.A folder-only alternative. That's a fair ask, and Airflow doesn't have one today. Rejection in 3.5 is the plan. The dev list discussion also said we should check how common this pattern is and reconsider if it would break many Dags. Options include letting a Dag opt out of group-level features, or a grouping that's only for display. The 3.4 deprecation period is the time to collect that information. If you're affected, please reply here with:
If enough users can't restructure, I'll raise it on the dev list again before 3.5.
Drafted-by: Claude Code (Opus 5.5); reviewed by @dheerajturaga before posting
dheerajturaga commentedon Oct 7, 2026
Scope note from #73746: the deprecation warning, and the parse-time rejection as currently planned, live in the Python SDK's
DAG.check_cycle(). Go, Java and TypeScript SDK Dags reach the Dag processor already serialized, andlang_sdk_processor.pyonly validates them, so they get neither the warning nor the rejection. Before the rejection lands in 3.5, the check should run onSerializedTaskGroupin core (for example fromlang_sdk_processor), so it covers every SDK. If that doesn't make 3.5, the rejection should be documented as Python-only.Drafted-by: Claude Code (Opus 5.5); reviewed by @dheerajturaga before posting
michiel-de-muynck commentedon Oct 9, 2026
The main unresolved issue I see here still is the conflict between:
There are multiple possible solutions to this:
Just ignoring the discrepancy seems like the worst choice.
dheerajturaga commentedon Oct 9, 2026
@michiel-de-muynck The dev list treated this as a bug fix, not as removing a feature. The deprecation policy covers supported behavior. Airflow never defined how TaskGroups that depend on each other in a cycle should behave: before 3.3.1, Grid and Graph ignored the edges between groups and showed them in an arbitrary order (#65291), and the planned features that act on a TaskGroup as a whole (loops, dynamic TaskGroups, retrying a group, waiting for a group to finish) have no defined behavior for them. The release process docs also note that SemVer isn't a promise of 100% compatibility, because a bug to one person can be a feature another person depends on.
We still didn't want these Dags to start failing without notice. So 3.4 first warns at parse time and in the UI, with guidance on how to restructure, and the rejection comes in 3.5. The lazy consensus agreed on this as an explicit exception, so I don't plan to propose a change to the deprecation policy for it.
If you think the decision is wrong, the dev list is the place to raise it. As mentioned above, if the 3.4 period shows that many users can't restructure their Dags, I'll take it back to the list before 3.5.
mef commentedon Oct 19, 2026
Hi, I'd like to raise a potential issue with the solution of rejecting Cyclic TaskGroup dependencies break at parse time.
Here's our situation to describe the potential issue:
One DAG containing a cyclic task group dependencies runs daily in production, and since Airflow v3.3.1, the grid view does not show the groups and tasks data anymore - as per the issue reported here.
We fixed it by reorganizing the groups so that there are no more cycles at group level, 6 days ago.
When limiting UI display to only 'last 5 runs' - so only the new grouping is in place, then the groups show up correctly in the UI:
However, when loading the page with the default display of 'last 10 runs', the older versions of the DAG with previous grouping setup is parsed, and we end up with the current issue again of groups and tasks not showing up.
So whenever rejecting DAGs with 'cyclic taskgroup dependencies', how would older versions be handled? Will users be able to deploy corrected DAGs, without risking rejections because older versions have the issue?
Thanks.
dheerajturaga commentedon Oct 19, 2026
The problem is that the old runs use the dag version which had the cycle which breaks the UI
I had to delete the old dag runs to resolve this. If you don't care about the older dagruns, you can delete them to fix this.
IgorBobic commentedon Oct 26, 2026
@dheerajturaga I understand that you want to clear the way for future features, which is nice. However as @rloredo mentions we use them as an organization feature. With traditional data modeling practices it commonplace to have bidirectional relations between facts and dimensions. So, in some case it is not an option to just move the model or split it up. Additionally, it generates a big generational overhead for the users of our platform.
In our organization there are 32 DAGs that have circular task groups, here is a snippet of examples:
As I understand the plan is now to:
Is my understanding correct?
If so, I would say it is essential for us to have some grouping functionality of our tasks, that can exist regardless of whether there are circular dependencies between those groups.
I see there is this feature from astronomer cosmos called group_nodes_by_folder, which is currently broken as well. I also see that the PR linked above should fix this. Can we assume that this feature will work even with circular dependencies existing between those folders in 3.3.5+? If not, will there be some support included in that patch that will allow some sort of grouping without using TaskGroups? I think that is essential if you want to make these circular dependencies breaking
Thanks in advance
IgorBobic commentedon Nov 18, 2026
@dheerajturaga I was very happy to see that in 3.4 we no longer have broken UI, only a warning. Thanks!
I was wondering what the plans were on having a folder system that we could replace the task groups with? You mentioned above you would consider adding it. It would be a really nice feature I think and would allow us to migrate away from the TaskGroups
If you lack capacity I would also be open to contributing this to Airflow myself. Although it is very core Airflow it seems to me, so if you would rather have control over it I also totally understand :)
Thanks!
Warn when folder task groups form a cycle (#3091)