mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 11:07:40 +01:00
Root cause: beacon.py called _cockpit_ready() using /api/control (slow DB+git endpoint, 4+ seconds cold) with a 2s timeout. When OrangeCat fired rapid consecutive stop hooks, this check failed even with Cockpit running, so _start_cockpit() spawned extra npm run dev processes that inherited the bash command substitution pipe (stdout). Their startup output flooded the captured `choice`, jq parsing failed, and the script exited silently with no injection. Fix 1: Add /api/health endpoint (instant response) — beacon.py now uses this instead of /api/control for all liveness checks; also fixes the curl check in agent-hook-bridge.sh. Fix 2: Redirect _start_cockpit() subprocess stdout/stderr to DEVNULL — like _open_browser() already does. Prevents npm run dev from inheriting the pipe and polluting the captured choice. Fix 3: Add concurrent stop guard at top of handle_stop — skips the popup if another stop is already active for the same tab (within 90s). Prevents beacon storms from rapid turn completions. Also increased _poll_choice timeout from 3s to 8s to tolerate cold route compilation without dropping choices. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>