Skip to content

[v3-4-test] Fix empty audit log dag_id for DAG.cli() subcommands (#73379) - #75388

Merged
vatsrahul1001 merged 1 commit into
v3-4-testfrom
backport-51411ac-v3-4-test
Oct 22, 2026
Merged

vatsrahul1001 merged 1 commit into
v3-4-testfrom
backport-51411ac-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

The Dag file is its own entry point on this path, so the parser behind
DAG.cli() drops dag_id - there is nothing for the user to type. But
action_cli snapshots the namespace and writes the Log row before the
handler runs, so every audit row for python my_dag.py dags pause and its
five sibling subcommands lands with dag_id NULL: the event cannot be
filtered by Dag, and in multi-team mode team_name is resolved from
dag_id, so it also drops out of the owning team's view.

The back-fills already inside set_is_paused, dag_list_dag_runs and
dag_list_jobs cannot cover this. They run after that insert has been
committed, and they write to the namespace rather than to the metrics
dict that was built from it.

Every one of the six subcommands receives the Dag positionally and
reads args.dag_id only behind a dag or ... short-circuit, so supplying
it changes no control flow - only what the audit row records.
(cherry picked from commit 51411ac)

Co-authored-by: Y-C [email protected]
Co-authored-by: Eason09053360 [email protected]

)

The Dag file is its own entry point on this path, so the parser behind
DAG.cli() drops dag_id - there is nothing for the user to type. But
action_cli snapshots the namespace and writes the Log row before the
handler runs, so every audit row for python my_dag.py dags pause and its
five sibling subcommands lands with dag_id NULL: the event cannot be
filtered by Dag, and in multi-team mode team_name is resolved from
dag_id, so it also drops out of the owning team's view.

The back-fills already inside set_is_paused, dag_list_dag_runs and
dag_list_jobs cannot cover this. They run after that insert has been
committed, and they write to the namespace rather than to the metrics
dict that was built from it.

Every one of the six subcommands receives the Dag positionally and
reads args.dag_id only behind a dag or ... short-circuit, so supplying
it changes no control flow - only what the audit row records.
(cherry picked from commit 51411ac)

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Eason09053360 <[email protected]>
@vatsrahul1001
vatsrahul1001 marked this pull request as ready for review October 22, 2026 09:52
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.4.0 milestone Oct 22, 2026
@vatsrahul1001
vatsrahul1001 merged commit 78b6518 into v3-4-test Oct 22, 2026
124 of 135 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-51411ac-v3-4-test branch October 22, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants