Skip to content

improve logs for retry.Do error scenarios(troubleshoting improvement)#1909

Merged
ilija42 merged 2 commits intomainfrom
improveRetryError
Mar 19, 2026
Merged

improve logs for retry.Do error scenarios(troubleshoting improvement)#1909
ilija42 merged 2 commits intomainfrom
improveRetryError

Conversation

@fernandezlautaro
Copy link
Contributor

Several pieces in of the WR in CRE relies on the retry.Do feature, where when eventually fails the real cause gets swallowed here.

So this fix improves readability when we are troubleshooting logs

Requires

Supports

@fernandezlautaro fernandezlautaro requested a review from a team as a code owner March 19, 2026 14:17
Copilot AI review requested due to automatic review settings March 19, 2026 14:17
@github-actions
Copy link

👋 fernandezlautaro, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves troubleshooting for pkg/utils/retry.Strategy.Do by ensuring terminal retry failures (context cancellation/timeout or max retries) include the last callback error in the returned error message, and updates tests accordingly.

Changes:

  • Track and surface the last callback error in the context done and max retry attempts reached error paths.
  • Expand retry tests to assert the returned error contains both the retry wrapper error and the underlying callback error details.
  • Add new test cases to validate that the last callback error is surfaced.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/utils/retry/retry.go Adds lastKnownErr tracking and includes it in terminal error messages for better diagnostics.
pkg/utils/retry/retry_test.go Updates error assertions to check multiple substrings and adds new cases around “last error” behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mchain0
mchain0 previously approved these changes Mar 19, 2026
@ilija42 ilija42 added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit 832f46a Mar 19, 2026
32 of 34 checks passed
@ilija42 ilija42 deleted the improveRetryError branch March 19, 2026 15:29
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.

6 participants