Skip to content

fix: ExponentialBackoff execute() bypasses maxElapsed timeout#15

Open
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3726-backoff-maxelapsed
Open

fix: ExponentialBackoff execute() bypasses maxElapsed timeout#15
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3726-backoff-maxelapsed

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented May 26, 2026

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() ignoring maxElapsed, which could let retries run past the configured time limit. Now the loop checks elapsed time after each attempt and stops when maxElapsed is exceeded.

  • Bug Fixes
    • Added an elapsed time check (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

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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

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