Skip to content

Conversation

@flyingrobots
Copy link
Member

@flyingrobots flyingrobots commented Feb 8, 2026

Summary

  • SystemClock.sleep() unconditionally called timer.unref() on every setTimeout. When a retry backoff or timeout race timer was the sole remaining event-loop handle (common in CLI tools, scripts, and top-level await), Node.js exited before the timer fired — silently aborting retries and timeouts.
  • Removed the unref() call so policy timers keep the process alive while actively awaited. Callers that need graceful shutdown should use AbortSignal instead.
  • Bumps both packages to 0.10.2.

Test plan

  • All 239 existing tests pass (221 alfred + 18 alfred-live)
  • Pre-push hooks pass (lint, test, lockfile, release preflight)
  • Verify retry backoff keeps process alive in a top-level await script
  • Verify timeout fires correctly when wrapped function hangs

Summary by CodeRabbit

  • Bug Fixes

    • Fixed premature process exit issue. Users should use AbortSignal for graceful shutdown handling.
  • Chores

    • Version bumped to 0.10.3 across packages to maintain alignment. No API changes.

SystemClock.sleep() unconditionally called timer.unref() on every
setTimeout. When a retry backoff or timeout race timer was the sole
remaining event-loop handle, Node.js exited before the timer fired —
silently aborting retries and timeouts.

Remove the unref() call so policy timers keep the process alive while
actively awaited. Callers that need graceful shutdown should use
AbortSignal instead.

Bump both packages to 0.10.2.
@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

Patch version bump from 0.10.2 to 0.10.3 across alfred and alfred-live packages. Removes timer.unref() logic from SystemClock to fix premature process exit issues. Updates version numbers in package manifests and documentation.

Changes

Cohort / File(s) Summary
Package Version Bumps
alfred/package.json, alfred/jsr.json, alfred-live/package.json, alfred-live/jsr.json
Incremented versions from 0.10.2 to 0.10.3 across all manifest files.
Changelog Entries
alfred/CHANGELOG.md, alfred-live/CHANGELOG.md
Added entries for 0.10.3 documenting the fix for premature process exit and version alignment.
Dependency Update
alfred-live/package.json
Updated @git-stunts/alfred dependency from 0.10.2 to 0.10.3.
SystemClock Fix
alfred/src/utils/clock.js, alfred/src/index.d.ts
Removed timer.unref() call from SystemClock.sleep implementation and corresponding JSDoc reference.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops through version three-point-oh,
Timer refs must cease to flow,
Processes no longer flee,
Graceful shutdown—AbortSignal decree!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: removing timer.unref() from SystemClock.sleep(), which is the central fix across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/unref-premature-exit

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

SystemClock.sleep() unconditionally called timer.unref() on every
setTimeout. When a retry backoff or timeout race timer was the sole
remaining event-loop handle, Node.js exited before the timer fired —
silently aborting retries and timeouts.

Remove the unref() call so policy timers keep the process alive while
actively awaited. Callers that need graceful shutdown should use
AbortSignal instead.

Bump both packages to 0.10.3.
@flyingrobots
Copy link
Member Author

@coderabbitai review please 🥕

@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

@flyingrobots: I'll review the changes in this PR right away! 🥕

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@flyingrobots flyingrobots merged commit d755c64 into main Feb 8, 2026
2 checks passed
@flyingrobots flyingrobots deleted the fix/unref-premature-exit branch February 8, 2026 23:14
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