Fury0508 opened a new pull request, #61729:
URL: https://github.com/apache/airflow/pull/61729

   ## 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
   
   **Before:**
   ![Current 
template](https://private-user-images.githubusercontent.com/128898/547061344-827493f3-a812-4b0d-910f-10a1a64b13b4.png)
   
   **After:**
   <img width="1456" height="874" alt="ss" 
src="https://github.com/user-attachments/assets/a4275d6f-e8d7-440d-a2a3-2d59305b13bb";
 />
   
   ### 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?
   
   - [X] Yes
   
   <!--
   Generated-by: Claude AI following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   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.
   
   ---


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to