Repository navigation
Fix Grid and Graph 500 errors for cyclic TaskGroup dependencies - #73724
Merged
dheerajturaga merged 2 commits intoOct 8, 2026
Merged
Conversation
1 task done
1 task done
|
Hi @dheerajturaga, thanks for driving this. We're hitting the same 500 in production: dbt models While looking into it, I tried a slightly different approach and opened it as #73933. Instead of Drafted-by: Claude Code (Opus 5.5); reviewed by @JH0917 before posting |
Member
Author
|
@ashb your thoughts on this? Would like this to go in 3.4 as agreed in the Lazy Consensus https://lists.apache.org/thread/5fpwlxg4y6jhyrw7n2m3jz3o7t6xvhlk |
1 task done
kaxil
reviewed
Oct 7, 2026
dheerajturaga
force-pushed
the
fix-grid-graph-taskgroup-cycles
branch
from
October 7, 2026 19:31
fd6f270 to
3c54e11
Compare
Since 3.3.1 the Grid and Graph views fail with HTTP 500 for Dags whose TaskGroups depend on each other when each group is treated as a single unit, even though the task graph is acyclic and the Dag parses and runs normally. Filtering a view by a root task can create the same group-level cycle in a Dag that has none, so the views have to tolerate these cycles whether or not such Dags are later rejected at parse time.
Since 3.3.1 the deprecated DAG.topological_sort() raises for Dags that pass check_cycle, for the same group-level cycles that broke Grid and Graph. Parse-time detection of these Dags now has its own check, so nothing relies on the raise, and the two sorts should order these siblings the same way. Deserialization orders children by label, which had made the expected orders in the tests match the input order, so they could not tell whether the fallback reorders anything.
dheerajturaga
force-pushed
the
fix-grid-graph-taskgroup-cycles
branch
from
October 8, 2026 01:47
3c54e11 to
cc356fd
Compare
kaxil
approved these changes
Oct 8, 2026
eladkal
approved these changes
Oct 8, 2026
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.
Since 3.3.1, the Grid and Graph views return HTTP 500 for Dags whose TaskGroups depend on each other when each group is treated as a single unit. The task graph itself is acyclic, and these Dags parse, schedule and run normally. #69933 made the group-level sort account for group-to-group and cross-group edges, so these group-level cycles now raise instead of rendering in an arbitrary order.
Two shapes trigger it:
a1 >> b1andb2 >> a2acrossgroup1andgroup2).a >> ext >> b). A task with no upstream inside its own group counts as a root of that group, soextand the group depend on each other.Filtering can also create the cycle in a Dag that has none. With
root=g.first&include_downstream=true,partial_subset()can drop a task's only in-group upstream and turn it into a group root. So Grid and Graph need to tolerate group-level cycles whatever is decided about rejecting these Dags at parse time, which is being discussed in #73678.The serialized TaskGroup sort now orders the siblings on a cycle as one unit, placed where its first child is declared, with its members in declaration order. Everything around the cycle keeps the existing pass-numbering order, and Dags without a group-level cycle are unaffected. The serialized and Task SDK sorts share this fallback through
TaskGroupMixinin the shareddagnodelibrary, so the deprecatedDAG.topological_sort(), which has raisedAirflowDagCycleExceptionfor these Dags since 3.3.1, orders them the same way. Detecting these Dags at parse time is left to the deprecation check in #73746.This replaces #72822 with a narrower change: it drops the task-level cycle re-check (task-level cycles are already rejected at parse time).
related: #73678
Screenshots
Graph view with this change, all TaskGroups expanded. Without it, the Graph view returns HTTP 500 for each of these.
Sibling groups (
a1 >> b1andb2 >> a2)A group bridged by an outside task (
g.a >> bridge >> g.b)One group per database schema
Filtered view (root
g.first, Downstream). The full Dag has no group-level cycle; the filter creates one.More: a ring of three groups, a cycle inside a nested group, and the filtered example Dag without the filter
Three groups in a ring (takes the pass-numbering path)
Cycle inside a nested group (
outer.innerandouter.bridge)The filtered example Dag without the filter (rendered before this change too; included for comparison)
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines