fix: ExponentialBackoff execute() bypasses maxElapsed timeout#15
Open
deepshekhardas wants to merge 1 commit into
Open
fix: ExponentialBackoff execute() bypasses maxElapsed timeout#15deepshekhardas wants to merge 1 commit into
deepshekhardas wants to merge 1 commit into
Conversation
The execute() method tracked elapsedMs across retries but never checked it against maxElapsed, allowing the retry loop to continue indefinitely regardless of the configured time limit.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/src/v3/apps/backoff.ts">
<violation number="1" location="packages/core/src/v3/apps/backoff.ts:344">
P1: The new `maxElapsed` break is unreachable on `AttemptTimeout` retries because `continue` in `catch` skips the post-`finally` check.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| clearTimeout(attemptTimeout); | ||
| } | ||
|
|
||
| if (elapsedMs > this.#maxElapsed * 1000) { |
There was a problem hiding this comment.
P1: The new maxElapsed break is unreachable on AttemptTimeout retries because continue in catch skips the post-finally check.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/src/v3/apps/backoff.ts, line 344:
<comment>The new `maxElapsed` break is unreachable on `AttemptTimeout` retries because `continue` in `catch` skips the post-`finally` check.</comment>
<file context>
@@ -340,6 +340,10 @@ export class ExponentialBackoff {
clearTimeout(attemptTimeout);
}
+
+ if (elapsedMs > this.#maxElapsed * 1000) {
+ break;
+ }
</file context>
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.
Fixes issue triggerdotdev#3726.
The execute() method tracked elapsedMs but never checked it against maxElapsed, allowing the retry loop to continue indefinitely regardless of the configured time limit. Added check after each retry attempt.
Summary by cubic
Fixes
ExponentialBackoff.execute()ignoringmaxElapsed, which could let retries run past the configured time limit. Now the loop checks elapsed time after each attempt and stops whenmaxElapsedis exceeded.elapsedMs > this.#maxElapsed * 1000) after each retry, preventing overlong or infinite retries.Written for commit bf858f4. Summary will update on new commits. Review in cubic