Skip to content

Highlight user-code frames in task log tracebacks#70294

Merged
pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:highlight-dag-bundle-traceback-frames
Jul 24, 2026
Merged

Highlight user-code frames in task log tracebacks#70294
pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:highlight-dag-bundle-traceback-frames

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Jul 23, 2026

Copy link
Copy Markdown
Member

When a task fails, the frame that actually raised is almost always in the user's DAG code, but in the log traceback it looks identical to the surrounding framework frames from installed packages — so you have to scan every File "..." line to find where your code is.

This colors traceback frames by origin: frames in user code (DAG bundle, plugins, local files) stay prominent (fg.info, bold), while frames in installed packages (site-packages / dist-packages) are muted (fg.muted). The failing user frame now stands out at a glance.

Classification is a single rule — a frame is user code unless its path is under a site-packages/dist-packages directory — which is robust across bundle layouts (local folder, git, /tmp/airflow/dag_bundles/...) without hardcoding a bundle path. A data-frame-source attribute (user/library) is set on each frame for testability and as a styling hook.

Before

error in user code only
Screenshot 2026-07-23 at 16 58 44
error in library
Screenshot 2026-07-23 at 16 59 14

After

error in user code only
Screenshot 2026-07-23 at 16 52 45
error in library
Screenshot 2026-07-23 at 16 52 30


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Jul 23, 2026
@pierrejeambrun
pierrejeambrun marked this pull request as ready for review July 23, 2026 14:52
@pierrejeambrun pierrejeambrun added this to the Airflow 3.3.1 milestone Jul 23, 2026
@pierrejeambrun pierrejeambrun added the backport-to-v3-3-test Backport to v3-3-test label Jul 23, 2026
@pierrejeambrun pierrejeambrun self-assigned this Jul 23, 2026
@bbovenzi

Copy link
Copy Markdown
Contributor

How does this look in dark mode?

How different do we want these links to look like? fg.info vs fg.muted in light mode is fairly subtle.

@pierrejeambrun
pierrejeambrun force-pushed the highlight-dag-bundle-traceback-frames branch from 6c62adf to 5ce44c3 Compare July 23, 2026 14:57
@collinmcnulty

Copy link
Copy Markdown
Contributor

The pieces I really want in color are the parts that are my code (so not site-packages and not airflow itself) and the actual error message (ParserError in this case). There's so much blue on the screen that its actually hard to pick those out. I think it would be fine to put the site-packages lines just in the normal black text color.

@bbovenzi

Copy link
Copy Markdown
Contributor

That makes sense to me, system file lines aren't important so we should reduce their highlight or remove it entirely

In an error traceback the frame that actually failed is usually in the user's DAG code, but it sits visually indistinguishable among the framework frames from installed packages. Emphasising user-code frames and muting installed-package frames lets users find where the error originates at a glance.
@pierrejeambrun
pierrejeambrun force-pushed the highlight-dag-bundle-traceback-frames branch from 5ce44c3 to b2a35e0 Compare July 23, 2026 17:16
@pierrejeambrun

Copy link
Copy Markdown
Member Author

Updated. Now library line appear in normal text color:

Screenshot 2026-07-23 at 19 16 27 Screenshot 2026-07-23 at 19 16 58

Here airflow is considered 'user code' because that's a local development setup where airflow is actually installed in editable mode from source. Normally in prod environment it will be 'pip installed...' and land in site packages.

@pierrejeambrun

Copy link
Copy Markdown
Member Author

On a real install. With airflow installed from a wheel:

Screenshot 2026-07-24 at 11 28 33 Screenshot 2026-07-24 at 11 28 52

@pierrejeambrun
pierrejeambrun merged commit 4e65210 into apache:main Jul 24, 2026
89 checks passed
@pierrejeambrun
pierrejeambrun deleted the highlight-dag-bundle-traceback-frames branch July 24, 2026 09:29
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 24, 2026
…#70294)

In an error traceback the frame that actually failed is usually in the user's DAG code, but it sits visually indistinguishable among the framework frames from installed packages. Emphasising user-code frames and muting installed-package frames lets users find where the error originates at a glance.
(cherry picked from commit 4e65210)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 24, 2026
…#70294)

In an error traceback the frame that actually failed is usually in the user's DAG code, but it sits visually indistinguishable among the framework frames from installed packages. Emphasising user-code frames and muting installed-package frames lets users find where the error originates at a glance.
(cherry picked from commit 4e65210)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
pierrejeambrun added a commit that referenced this pull request Jul 24, 2026
#70375)

In an error traceback the frame that actually failed is usually in the user's DAG code, but it sits visually indistinguishable among the framework frames from installed packages. Emphasising user-code frames and muting installed-package frames lets users find where the error originates at a glance.
(cherry picked from commit 4e65210)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants