From da763fc889c01f2bc8489ae02e28cb8138adb907 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 14 Aug 2026 01:05:58 -0700 Subject: [PATCH] fix(statusline): render the althing monitor bell reliably MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two gaps kept the 🔔/🔕 monitor-armed indicator from ever showing: 1. The block keyed off $ALTHING_HANDLE, which is unset in the statusline environment — so the handle was always empty and the whole bell block was skipped. Resolve the per-project handle from ~/.althing/session_handles.json (keyed by the cwd Claude Code passes on stdin), the same map `althing-cli use` writes. 2. Even with the handle resolved, the lock check covered only wake-listener-$h.lock and light-monitor-$h.lock — missing monitor-$h.lock, which is the lock `althing-cli monitor` (the CC-native exit-0-re-arm loop) actually writes. Add it; the kill -0 liveness gate already discards stale locks. --- home_root/.claude/statusline-command.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/home_root/.claude/statusline-command.sh b/home_root/.claude/statusline-command.sh index ea642cb..aa2acce 100644 --- a/home_root/.claude/statusline-command.sh +++ b/home_root/.claude/statusline-command.sh @@ -110,9 +110,18 @@ if command -v althing-cli >/dev/null 2>&1; then # suppress the empty-inbox form (📪 0) — only surface actual unread mail (📬 N) case "$althing" in *📪*) althing="" ;; esac h="${ALTHING_HANDLE:-}" + # ALTHING_HANDLE isn't set in the statusline env — resolve the per-project handle from + # althing's session map (keyed by the cwd Claude Code passes on stdin), the same source + # `althing-cli use` writes. Without this the monitor bell (🔔/🔕) never renders. + [ -z "$h" ] && [ -n "$cwd" ] && h=$(jq -r --arg d "$cwd" '.[$d] // empty' "$HOME/.althing/session_handles.json" 2>/dev/null) if [ -n "$h" ]; then mon="🔕" - for lk in "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do + # Three independent arming mechanisms, one lock each — any live one means "armed": + # monitor-$h.lock <- `althing-cli monitor` (the CC-native exit-0-re-arm loop) + # wake-listener-$h.lock <- `althing-wake-listener` (herald inbound) + # light-monitor-$h.lock <- `althing-light-monitor` (standing watch) + # The kill -0 liveness gate below discards stale locks, so listing all three is safe. + for lk in "$HOME/.althing/monitor-$h.lock" "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do [ -f "$lk" ] || continue pid=$(tr -dc '0-9' < "$lk" 2>/dev/null) if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then mon="🔔"; break; fi