Skip to content

fix(client): Send Retry times as max_attempts on retry - #882

Open
sentry-junior[bot] wants to merge 1 commit into
mainfrom
markusunterwaditzer/stream-2128-taskbroker-client
Open

sentry-junior[bot] wants to merge 1 commit into
mainfrom
markusunterwaditzer/stream-2128-taskbroker-client

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

When a task asks to retry, the worker sent max_attempts = Retry._times + 1 (added in #630), and the broker writes that onto the activation. Retry.initial_state() uses times, and the worker's own max_attempts_reached() stops after times runs, so from the second run on the activation said one more attempt was left than really was.

The run count was right, but on a task's last run current_task().retries_remaining was True and retry_task() raised RetryTaskError instead of NoRetriesRemainingError. Callers that handle "no retries left", such as data_export.tasks.assemble_download sending its failure email, never got there.

This sends times. Activations that already carry the old value get corrected on their next RETRY, since the broker updates max_attempts when it differs.

Once this ships in sentry, the workaround from getsentry/sentry#126403 in workflow_engine/tasks/actions.py can go.

Fixes STREAM-2128

via markus.

--

View Session [Sentry]

The worker sent times + 1 as max_attempts when a task asked to retry, so
from the second run on the activation carried one more attempt than the
task's Retry allows. On a task's last run, retries_remaining was True and
retry_task() raised RetryTaskError instead of NoRetriesRemainingError.

Send times, which matches Retry.initial_state() and the worker's own
max_attempts_reached() check.

Fixes STREAM-2128

Co-Authored-By: Markus Unterwaditzer <markus@sentry.io>
@untitaker untitaker self-assigned this Dec 2, 2026
@linear-code

linear-code Bot commented Dec 2, 2026

Copy link
Copy Markdown

STREAM-2128

@untitaker
untitaker marked this pull request as ready for review December 2, 2026 17:11
@untitaker
untitaker requested a review from a team as a code owner December 2, 2026 17:11
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