Skip to content

fix(tasks): unref the pi-tasks detection timer so pi -p can exit - #122

Merged
trvon merged 1 commit into
masterfrom
fix/unref-task-detection-timer
Sep 23, 2026
Merged

trvon merged 1 commit into
masterfrom
fix/unref-task-detection-timer

Conversation

@trvon

@trvon trvon commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

checkTasksVersion() opens a 5 s window listening for a pi-tasks reply to its detection ping. When pi-tasks isn't installed, nothing replies, and because the timer wasn't unref'd, the full window kept one-shot pi -p processes running about 4 s after the response was printed.

This PR unrefs that timer, the same way the monitor retention timers and the session heartbeat are already unref'd. Interactive sessions are unaffected: the event loop stays alive there, so the detection window still settles after 5 s as before.

Measurements

pi -p "say ok" --no-extensions -e <pi-loop>, without pi-tasks:

  • before: response at 1.4 s, process exit at 5.3 s
  • after: process exits right after the response (about 1.8 s)

Tests

  • New test: unrefs the detection timer (so pi -p can exit). It fails without the fix.
  • vitest run: 1067 passed. Typecheck passes. Lint shows no new warnings (the 2 existing ones are in monitor-manager.ts).

Without pi-tasks installed nothing answers the detection ping, so the 5s
window timer kept one-shot pi -p processes alive ~4s after the response.
@trvon
trvon merged commit 0ba7410 into master Sep 23, 2026
5 checks 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.

1 participant