Skip to content

Conversation

@Fury0508
Copy link
Contributor

@Fury0508 Fury0508 commented Feb 10, 2026

Improve default task failure email template for readability

Description

Replaces the default task failure email template to improve operator experience and mobile readability.

Problem:
Current default shows raw Python object dumps (UUIDs, repr(), internal fields), making it hard to quickly identify which DAG/task failed and find logs.

Solution:

  • Professional HTML template with dark theme matching Airflow UI
  • Structured display: DAG, task, run ID, attempt, host, tags
  • Clear exception formatting in highlighted box
  • Action buttons for "View Log" and "Mark Success"
  • Plain text fallback for non-HTML email clients
  • Airflow 3.x compatibility (conditional rendering for optional attributes)
  • Fully backward compatible (custom templates still work)

Screenshots

ss

Testing

  • ✅ Templates render correctly with mock task data
  • ✅ Handles missing URLs gracefully (Airflow 3.x compatibility)
  • ✅ Email delivery tested via MailHog SMTP server
  • ✅ Backward compatibility verified

Files Changed

+ airflow-core/src/airflow/templates/email/task_failure_subject.txt
+ airflow-core/src/airflow/templates/email/task_failure_body.html
+ airflow-core/src/airflow/templates/email/task_failure_body.txt
M task-sdk/src/airflow/sdk/execution_time/task_runner.py

closes: #61667


Was generative AI tooling used to co-author this PR?
  • Yes

Claude AI was used to:

  • Design the HTML email template
  • Locate correct files in Airflow 3.x codebase (task_runner.py)
  • Create test scripts for validation
  • Set up MailHog for email testing

The contributor reviewed all code, tested the implementation, and validated against issue requirements.


- Replace plain text email with professional HTML template
- Add dark-themed design matching Airflow UI
- Include structured task details (run, attempt, host, tags)
- Add Airflow 3.x compatibility (conditional rendering for URLs)
- Provide plain text fallback for email clients without HTML support
- Maintain backward compatibility (custom templates still work)

Fixes apache#61667
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.

Improve default task failure email template for readability and operational clarity

1 participant