Skip to content

fix(worker): Attribute captured task errors to the current task - #818

Merged
yuvmen merged 3 commits into
mainfrom
codex/fix-task-error-transaction-pr
Oct 16, 2026
Merged

yuvmen merged 3 commits into
mainfrom
codex/fix-task-error-transaction-pr

Conversation

@yuvmen

@yuvmen yuvmen commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Many taskbroker issues incorrectly show PackageService.get_vercel_packages as their transaction instead of the task that failed. SENTRY-5WPS, SENTRY-5WKT, and SENTRY-5WK7 are three examples of this broader problem.

After the task's tracing scope exits, a stale startup transaction name on the SDK's current scope overrides the task name set on the isolation scope. Set the current-scope transaction name during timeout, retry-exhausted, and ordinary failure reporting so captured errors identify the correct task.

Regression tests run existing example tasks through the worker and assert the error event's transaction name in static and streaming tracing. All 11 targeted tests pass.

Set the current SDK scope transaction name when reporting timeouts and
exhausted retries. Isolate ordinary failure reporting so stale startup
transaction names cannot override the activation task name.

Add regression coverage for all three failure paths with static and
streaming tracing, including scope restoration and existing fingerprints.
Reuse the existing worker helper, example tasks, and signal-restoration
fixture. Inspect the processed error event through before_send and assert
that its transaction names the failing task.

Remove the custom app and transport harness, private scope assertions,
and conditional fingerprint checks.
@yuvmen
yuvmen marked this pull request as ready for review October 15, 2026 20:08
@yuvmen
yuvmen requested a review from a team as a code owner October 15, 2026 20:08
@@ -517,6 +517,10 @@ def check_task_future_completion(
inflight.activation.taskname,
]
scope.set_transaction_name(inflight.activation.taskname)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line necessary if the line below is set?

Set task transaction names only on the current SDK scope. Its value takes
precedence during event capture, making the isolation-scope assignments
redundant in both timeout and retry-exhausted reporting.
@yuvmen
yuvmen merged commit 79c12a1 into main Oct 16, 2026
28 checks passed
@yuvmen
yuvmen deleted the codex/fix-task-error-transaction-pr branch October 16, 2026 19:20
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.

2 participants