[PR #216] [MERGED] fix(runtime): unregister shutdown handlers #1866

Closed
opened 2026-10-16 21:11:57 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/216
Author: @N0zoM1z0
Created: 7/14/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @morluto

Base: main ← Head: agent/runtime-shutdown-cleanup


📝 Commits (2)

  • f9e3c23 fix(runtime): unregister shutdown handlers
  • 1bdb59e test(runtime): cover idempotent handler cleanup

📊 Changes

2 files changed (+53 additions, -3 deletions)

View changed files

📝 src/main.ts (+10 -2)
📝 tests/mainErrors.test.ts (+43 -1)

📄 Description

Summary

  • make shutdown registration return a disposer
  • remove SIGINT, SIGTERM, stdin-end, and stdin-close listeners when shutdown begins
  • verify the disposer runs exactly once through the idempotent shutdown path

The root cause was process-lifetime listeners outliving the runtime they captured, so repeated in-process runs accumulated stale handlers.

Closes #147

Verification

  • npm run typecheck
  • npm run lint (existing warnings only)
  • npm run format:check
  • affected setup/runtime/reference suite: 34 tests passed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/216 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 7/14/2026 **Status:** ✅ Merged **Merged:** 7/14/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/runtime-shutdown-cleanup` --- ### 📝 Commits (2) - [`f9e3c23`](https://github.com/morluto/rea/commit/f9e3c23987bdf37be07d6c4602666c6ac90ae0ed) fix(runtime): unregister shutdown handlers - [`1bdb59e`](https://github.com/morluto/rea/commit/1bdb59e201a26b53f5ed8b2eb870941ca4b788f7) test(runtime): cover idempotent handler cleanup ### 📊 Changes **2 files changed** (+53 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/main.ts` (+10 -2) 📝 `tests/mainErrors.test.ts` (+43 -1) </details> ### 📄 Description ## Summary - make shutdown registration return a disposer - remove SIGINT, SIGTERM, stdin-end, and stdin-close listeners when shutdown begins - verify the disposer runs exactly once through the idempotent shutdown path The root cause was process-lifetime listeners outliving the runtime they captured, so repeated in-process runs accumulated stale handlers. Closes #147 ## Verification - `npm run typecheck` - `npm run lint` (existing warnings only) - `npm run format:check` - affected setup/runtime/reference suite: 34 tests passed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:11:57 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1866
No description provided.