Fix dictation process lifecycle #36

Merged
lost-rob0t merged 1 commit from fix/zara-005-dictation-lifecycle into fix/zara-004-prolog-config-overrides 2026-07-18 20:48:26 +00:00
lost-rob0t commented 2026-07-18 20:28:38 +00:00 (Migrated from github.com)

What changed

  • made validated PID-file and live process state authoritative for dictation activity
  • cleaned stale, empty, malformed, exited, and zombie PID entries
  • made start and stop idempotent and replaced shell-interpolated kill with process_kill/2
  • launched the child directly while recording its PID and redirecting its log
  • added injectable PID/log paths and exit/SIGTERM cleanup to both dictation entrypoints
  • added eight deterministic fake-child lifecycle cases

Why

The parent Prolog process cached dictation state independently of the child. Self-stop, crashes, and stale PID files could therefore leave the wake loop trapped in dictation mode, while stop trusted arbitrary PID text in a shell command.

Impact

The wake listener returns to normal whenever the dictation child exits. Repeated start/stop calls are safe, malformed state is removed, and PID termination no longer uses shell interpolation.

Validation

  • nix develop -c scripts/test-dictation-lifecycle.sh (8 passed)
  • nix develop -c scripts/test-prolog-config.sh
  • nix develop -c scripts/test-command-routing.sh
  • nix develop -c pytest (11 passed)

Closes #6

## What changed - made validated PID-file and live process state authoritative for dictation activity - cleaned stale, empty, malformed, exited, and zombie PID entries - made start and stop idempotent and replaced shell-interpolated `kill` with `process_kill/2` - launched the child directly while recording its PID and redirecting its log - added injectable PID/log paths and exit/SIGTERM cleanup to both dictation entrypoints - added eight deterministic fake-child lifecycle cases ## Why The parent Prolog process cached dictation state independently of the child. Self-stop, crashes, and stale PID files could therefore leave the wake loop trapped in dictation mode, while stop trusted arbitrary PID text in a shell command. ## Impact The wake listener returns to normal whenever the dictation child exits. Repeated start/stop calls are safe, malformed state is removed, and PID termination no longer uses shell interpolation. ## Validation - `nix develop -c scripts/test-dictation-lifecycle.sh` (8 passed) - `nix develop -c scripts/test-prolog-config.sh` - `nix develop -c scripts/test-command-routing.sh` - `nix develop -c pytest` (11 passed) Closes #6
Sign in to join this conversation.
No description provided.