Skip to content

AIP-97 (1/3): add failure_kind to the task-failure listener + infra_reason column - #11

Draft
1fanwang wants to merge 1 commit into
aip97-stack-basefrom
aip97-p1-failure-context
Draft

AIP-97 (1/3): add failure_kind to the task-failure listener + infra_reason column#11
1fanwang wants to merge 1 commit into
aip97-stack-basefrom
aip97-p1-failure-context

Conversation

@1fanwang

@1fanwang 1fanwang commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Part 1 of 3 of the AIP-97 stack. Consolidated view with the whole design and e2e: apache/airflow#66405.

Why

on_task_instance_failed sees only the worker-side error. When a task is killed from outside, such as a pod eviction, OOM kill, force-deleted pod, or lost heartbeat, the worker never raises. The listener gets no cause. An eviction and a real ValueError look identical to alerting and lineage.

What

Foundation only, with no executor wiring or retry change yet:

  • on_task_instance_failed gains an optional failure_kind enum: infra, application, timeout, or manual. pluggy matches by name, so a listener that omits it keeps working.
  • The worker sets application or timeout; a manual mark-failed sets manual. infra arrives with the executor bridge (2/3).
  • A new nullable infra_reason column on task_instance holds the executor's reason token.

Testing

test_listener_types: a listener declaring failure_kind receives it, and one that omits it still fires. airflow db migrate creates the infra_reason column.

Stack

  1. this PR: failure_kind plus infra_reason
  2. Kubernetes classifier
  3. opt-in refund

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c2d3760-e634-4cf0-a625-cffaa1886110

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aip97-p1-failure-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…column

on_task_instance_failed gains an optional failure_kind argument, a
TaskFailureKind str enum (infra / application / timeout / manual) in
airflow_shared.state. pluggy dispatches by parameter name, so a listener that
does not declare it keeps working. The worker populates application or timeout;
a manual mark-failed populates manual. The executor's reason token persists on
the task instance as a new nullable infra_reason column.

Foundation for AIP-97; the Kubernetes classifier (infra) and the opt-in retry
refund follow as separate PRs.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang force-pushed the aip97-p1-failure-context branch from 519dc7e to f6f1416 Compare July 27, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant