---
created: "2026-03-28T16:35:00.000Z"
title: Add signal traps for graceful poll teardown and status queries
area: tooling
files:
  - owl.sh
  - live.sh
---

## Problem

When owl polls get killed (raw SIGTERM), they die silently and linger as stale entries in Claude Code's background tasks panel. Over a session with multiple Psyche spawn/kill cycles, the panel becomes cluttered with indistinguishable dead tasks.

## Solution

1. Add signal handlers to owl.sh poll loop:
   - `trap 'echo "TERMINATED:$ID"; exit 0' TERM USR1` — graceful teardown with output
   - `trap 'echo "STATUS:$ID pending=... gen=... uptime=..."' USR2` — live status query without killing
2. owl.sh stop: use `kill -USR1` instead of raw kill
3. live.sh stop: same — SIGUSR1 for graceful Psyche teardown
4. Claude Code sees task complete (exit 0), fires notification, task depopulates cleanly

Source: todlando feature idea via owl message (2026-03-28)
