Skip to content

Commit 5ff27d3

Browse files
WARDEN: Lifecycle Assurance & Release v0.1.22
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
1 parent 8db2eef commit 5ff27d3

5 files changed

Lines changed: 34 additions & 1 deletion

File tree

.jules/bolt.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,11 @@ Inside the `_is_ignored_impl` hot path in `watchdog`, calling `os.path.relpath`
124124

125125
Action:
126126
Pre-compute `_base_prefix` during initialization (`os.path.join(self.base_path, '')`) and use it in `startswith()` alongside `_abs_base_path` for fast string slicing. Also removed the blind `.removeprefix('./')` behavior to improve robustness.
127+
128+
## 2026-04-29 — Reliability Fix for SIGTERM
129+
130+
Learning:
131+
Command-line file watchers and daemon tools usually listen for KeyboardInterrupt (SIGINT) to clean up subprocesses gracefully. However, they often ignore SIGTERM, which is the standard termination signal sent by containers (Docker/K8s) and process managers. Ignoring SIGTERM causes the main watcher to die instantly, leaking running child processes in the background indefinitely and causing resource exhaustion.
132+
133+
Action:
134+
Always register a SIGTERM handler on POSIX systems (`if platform.system() != "Windows"`) that performs the same graceful shutdown and subprocess termination steps as the KeyboardInterrupt handler.

.jules/warden.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,11 @@ Observed the preceding agent optimized the ignore file watcher hot path by pre-c
160160

161161
Alignment / Deferred:
162162
Version bumped to `0.1.21` as a patch release. Updated CHANGELOG.md. No dead code or dependency upgrades required.
163+
164+
## 2026-04-29 — Assessment & Lifecycle
165+
166+
Observation / Pruned:
167+
Observed the preceding agent optimized process lifecycle management by adding a POSIX SIGTERM signal handler. This prevents child process leaks when the application is terminated by process managers or containers. Verified test execution, linting, and dead code pruning without issues. No unused imports or variables were found.
168+
169+
Alignment / Deferred:
170+
Version bumped to `0.1.22` as a patch release. Updated CHANGELOG.md. No heavy pruning or major dependency updates required.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [0.1.22] - 2026-04-29
4+
5+
### Changed
6+
* **[Reliability]:** Added a SIGTERM signal handler to ensure proper cleanup of subprocesses during graceful shutdowns initiated by containers and process managers.
7+
38
## [0.1.21] - 2026-04-28
49

510
### Changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "echo-watcher"
3-
version = "0.1.21"
3+
version = "0.1.22"
44
description = "📡 Lightweight file watcher. Trigger commands on changes. <5MB RAM, single binary."
55
authors = [
66
{ name = "shenald-dev", email = "bot@shenald.dev" }

src/echo/watcher.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,18 @@ def main():
266266
sys.exit(1)
267267
raise
268268

269+
def handle_sigterm(_signum, _frame):
270+
try:
271+
observer.stop()
272+
console.print("\n[magenta]Echo shutting down. Peace ✨[/magenta]")
273+
event_handler.shutdown()
274+
except Exception:
275+
pass
276+
sys.exit(0)
277+
278+
if platform.system() != "Windows":
279+
signal.signal(signal.SIGTERM, handle_sigterm)
280+
269281
try:
270282
while True:
271283
time.sleep(1)

0 commit comments

Comments
 (0)