Repository navigation
fix(client): Send Retry times as max_attempts on retry - #882
Open
sentry-junior[bot] wants to merge 1 commit into
Open
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
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
approved these changes
Dec 2, 2026
untitaker
marked this pull request as ready for review
December 2, 2026 17:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()usestimes, and the worker's ownmax_attempts_reached()stops aftertimesruns, 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_remainingwasTrueandretry_task()raisedRetryTaskErrorinstead ofNoRetriesRemainingError. Callers that handle "no retries left", such asdata_export.tasks.assemble_downloadsending 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 updatesmax_attemptswhen it differs.Once this ships in sentry, the workaround from getsentry/sentry#126403 in
workflow_engine/tasks/actions.pycan go.Fixes STREAM-2128
via markus.
--
View Session [Sentry]