Skip to content

refactor: make daemon persistent, remove idle timeout#913

Merged
jackwener merged 4 commits intomainfrom
refactor/persistent-daemon
Apr 9, 2026
Merged

refactor: make daemon persistent, remove idle timeout#913
jackwener merged 4 commits intomainfrom
refactor/persistent-daemon

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Remove IdleManager and 4-hour idle auto-exit — daemon is now persistent
  • Add preuninstall hook for best-effort daemon cleanup on npm uninstall
  • Update docs (EN + ZH) to reflect persistent daemon model

Changes

  • Delete src/idle-manager.ts and src/daemon.test.ts (IdleManager tests)
  • Remove DEFAULT_DAEMON_IDLE_TIMEOUT from constants
  • Simplify src/daemon.ts — replace IdleManager with simple lastCliRequestTime tracking for /status endpoint
  • Add preuninstall script to package.json that sends POST /shutdown to daemon

Context

Discussion in thread #OpenCLI:1bd0da0e — user decided daemon should be persistent (users don't care about the memory), idle timeout is unnecessary overhead.

- Remove IdleManager and 4-hour idle auto-exit
- Daemon now stays alive until explicit shutdown or uninstall
- Add preuninstall hook for best-effort daemon cleanup on npm uninstall
- Update docs to reflect persistent daemon model
- Remove `daemon status` and `daemon restart` CLI commands (doctor covers diagnostics)
- Remove `lastCliRequestTime` tracking (no longer needed without idle timeout)
- Keep only `daemon stop` as the explicit shutdown command
Prevents npm uninstall from hanging if the daemon port accepts
connections but never responds.
@jackwener jackwener merged commit 5f59f9b into main Apr 9, 2026
13 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