Skip to content

Add opt-in consistent operation timeouts without changing defaults - #99

Merged
tim-kos merged 9 commits into
masterfrom
operation-timeout-attempt
Nov 26, 2026
Merged

tim-kos merged 9 commits into
masterfrom
operation-timeout-attempt

Conversation

@tim-kos

@tim-kos tim-kos commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Adds consistentOperationTimeouts: true to address #82 while preserving the current 0.13.1 behavior by default.

Without the option, or with false, the first operation-timeout callback still receives no arguments, its timer remains referenced even with unref: true, and forever retries keep the legacy array form for delays after their timeout list is used up. Later attempts keep their existing callback arguments and unref behavior.

Opting in changes all three behaviors consistently:

  • The first operation-timeout callback receives its attempt number, just like later attempts.
  • With unref: true, the first operation-timeout timer is unreferenced too. The process can exit before the callback if no other referenced handles remain.
  • After the timeout list is used up, forever retries pass the last timeout value directly to setTimeout (a number for generated timeout arrays). Native Node timing is unchanged; timer wrappers can observe the opted-in argument type.

The option works through retry.operation() and the RetryOperation constructor. The old boolean constructor signature remains supported. The README documents both modes and corrects the existing forever-delay description.

Validation:

  • Full suites pass on Node 12.22.12 and Node 24.22.3.
  • Both new regression files pass on Node 4.9.1.
  • Omitted, false, true, and truthy non-boolean values cover callback argument count/value, callback receiver, attempt sequencing, first and later unref calls, real child-process lifetime for both construction paths, and raw forever-delay argument types.
  • Legacy-mode cases also pass against the unchanged master implementation, including the boolean constructor signature.
  • Ten mutation checks fail as expected when either mode regresses, a strict gate is loosened to a truthy check, or public option forwarding is removed.
  • JavaScript syntax checks pass; the local global JSHint hook reports exactly the same existing warnings as master, with no new warnings. That local hook was bypassed for the commit; repository tests and CI are unchanged.

Opus 5.5 convergence completed in three bounded review rounds. Final implementation verification passed for d12aca703f89d2165de08f238bdf4fd3f71a5770; all accepted findings are resolved. Review artifacts, primary-source evidence, raw validation logs, and actual model receipts are preserved locally.

Fixes #82

…er timeout as a number

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…forever option

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tim-kos tim-kos self-assigned this Nov 25, 2026
@tim-kos tim-kos changed the title Pass the attempt to every operation timeout callback Add opt-in consistent operation timeouts without changing defaults Nov 26, 2026
@tim-kos
tim-kos merged commit 05e9050 into master Nov 26, 2026
1 check passed
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.

Missing current attempt in callback

1 participant