Skip to content

mcp: exit the daemon process after shutdown#98

Merged
benvinegar merged 1 commit intomainfrom
feat/mcp-daemon-exit-cleanly
Mar 24, 2026
Merged

mcp: exit the daemon process after shutdown#98
benvinegar merged 1 commit intomainfrom
feat/mcp-daemon-exit-cleanly

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • stop awaiting a never-resolving promise in hunk mcp serve
  • expose a daemon stopped promise so the CLI process can exit when the server shuts down
  • add a regression test that starts hunk mcp serve, sends SIGTERM, and asserts the process exits instead of hot-looping

Root cause

hunk mcp serve started the daemon and then awaited new Promise(() => {}). After the server shut down, the process stayed alive in Bun and spun hot instead of exiting.

Testing

  • bun run typecheck
  • bun test test/daemon-launcher.test.ts test/mcp-server.test.ts test/session-cli.test.ts test/mcp-e2e.test.ts test/mcp-serve-process.test.ts
  • verified current-repo orphan Bun MCP daemons stayed at 0 after the MCP-heavy test run

@benvinegar benvinegar merged commit 11eb4bb into main Mar 24, 2026
3 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