fix: [SVLS-9168] fix operation_attempt on replay operations#18520
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits intoJun 10, 2026
Merged
Conversation
… replay The aws.durable.operation_attempt metric was off by one for replayed operations. _traced_process reads step_details.attempt at two different points in the checkpoint lifecycle: - pending/retry checkpoint (fresh execution): the value is the count of prior failed attempts, which already equals the 0-indexed index of the attempt about to run. - succeeded checkpoint (read on a replay): the value is the 1-indexed number of the attempt that ultimately succeeded (1 for a first-try success). This made the same operation report attempt=0 on its fresh execution but attempt=1 on a later replay. Normalize the succeeded read by subtracting 1 so both agree on the documented 0-indexed convention. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
|
Codeowners resolved as |
On a succeeded checkpoint the stored attempt is the 1-indexed number of the attempt that succeeded, which is always >= 1, so attempt - 1 is always >= 0 and the max(0, ...) floor can never fire. Removing it keeps the normalization honest and avoids silently masking a future invariant break. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
step_details.attempt is server-maintained; the SDK only reads it. Note that the succeeded-checkpoint 1-indexing is observed behavior pinned by the unit test, not an SDK guarantee. Also condense the comment. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
lym953
marked this pull request as ready for review
June 8, 2026 19:43
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db0c145006
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
emmettbutler
requested changes
Jun 9, 2026
emmettbutler
left a comment
Collaborator
There was a problem hiding this comment.
This change looks reasonable enough. Please add a release note.
…t attempt=0 on replay Defensively clamp the replayed operation_attempt so a succeeded checkpoint whose StepDetails lacks "Attempt" (StepDetails.from_dict defaults it to 0) cannot emit a nonsensical operation_attempt = -1. We have not observed attempt == 0 on success; every SDK success path increments via OperationAction.SUCCEED or the wait_for_condition +1. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…n_attempt replay fix Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
Author
|
Added a release note |
emmettbutler
approved these changes
Jun 10, 2026
gh-worker-dd-mergequeue-cf854d
Bot
merged commit Jun 10, 2026
25fb0fd
into
main
501 of 505 checks passed
gh-worker-dd-mergequeue-cf854d
Bot
deleted the
yiming.luo/durable-replay-attempt-offbyone
branch
June 10, 2026 17:04
vlad-scherbich
pushed a commit
that referenced
this pull request
Jun 10, 2026
# Problem The value of `aws.durable.operation_attempt` span attribute is off by 1 for replays. For example, if an operation fails for the first attempt, succeeds on the first retry, then replays, the three spans should have: 1. operation_attempt == 0, replayed == false. 2. operation_attempt == 1, replayed == false. 3. operation_attempt == 1, replayed == true. The operation_attempt should be the same as the that of the last span because the replay just loads the result from the last successful attempt. However, right now the last span has `operation_attempt == 2`. # This PR If the operation is succeeded, i.e. it's a replay, then subtract operation_attempt by 1. # Testing <img width="712" height="523" alt="image" src="https://github.com/user-attachments/assets/401f72a1-527f-4672-8189-db590eff5cf4" /> The result is correct from the UI. See the "replay" and "attempt" value for the `order_process_payment` operations. Co-authored-by: yiming.luo <[email protected]>
brettlangdon
pushed a commit
that referenced
this pull request
Jun 11, 2026
# Problem The value of `aws.durable.operation_attempt` span attribute is off by 1 for replays. For example, if an operation fails for the first attempt, succeeds on the first retry, then replays, the three spans should have: 1. operation_attempt == 0, replayed == false. 2. operation_attempt == 1, replayed == false. 3. operation_attempt == 1, replayed == true. The operation_attempt should be the same as the that of the last span because the replay just loads the result from the last successful attempt. However, right now the last span has `operation_attempt == 2`. # This PR If the operation is succeeded, i.e. it's a replay, then subtract operation_attempt by 1. # Testing <img width="712" height="523" alt="image" src="https://github.com/user-attachments/assets/401f72a1-527f-4672-8189-db590eff5cf4" /> The result is correct from the UI. See the "replay" and "attempt" value for the `order_process_payment` operations. Co-authored-by: yiming.luo <[email protected]>
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.
Problem
The value of
aws.durable.operation_attemptspan attribute is off by 1 for replays.For example, if an operation fails for the first attempt, succeeds on the first retry, then replays, the three spans should have:
However, right now the last span has
operation_attempt == 2.This PR
If the operation is succeeded, i.e. it's a replay, then subtract operation_attempt by 1.
Testing
The result is correct from the UI. See the "replay" and "attempt" value for the
order_process_paymentoperations.