councilroot.py resolves one durable council root for every script and migrates the old /tmp root under the held locks: a preflight conflict moves nothing, each legacy file is renamed to a staging name before it is copied so a late writer is merged by the catch-up, id-less journals merge by line multiset, a differing whole file is kept beside its namesake, and a crash marker makes install copy the skills and report. One settings-file list, managed drop-ins included, serves councilroot.py and queue.py. Tests run once on unify/skills-20261114 after the merge (operator order 2026-11-14). 🎯 Fix: 88 % 💥 Break: 7 % 💸 Tokens: 100 % ⏱️ Velocity: 100 % 🛡️ Security: 100 % 🏆 Score: 82 🚦 Gate: ⛔ fix 88 % < 90, break 7 % > 5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.1 KiB
Bash
27 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Usage: watch-check.sh
|
|
# Shows whether the agents-council watch hook is stuck: running hook
|
|
# processes, holders of the kept queue history, and the age of the stored
|
|
# resource stage. Exit 1 when the stored stage is older than STALE_SECONDS.
|
|
set -euo pipefail
|
|
|
|
COUNCIL_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)/skills/kvb-org-organize/scripts/councilroot.py"
|
|
STATE="$(python3 "${COUNCIL_ROOT}" root)/watch.json"
|
|
KEPT="$(python3 "${COUNCIL_ROOT}" durable)/queue-history.jsonl"
|
|
STALE_SECONDS=600
|
|
|
|
printf 'watch hooks running: %s\n' "$(pgrep -fc 'watch.py watch' || true)"
|
|
if command -v lsof &>/dev/null; then
|
|
printf 'holders of %s:\n' "${KEPT}"
|
|
lsof "${KEPT}" 2>/dev/null || printf ' none\n'
|
|
else
|
|
printf 'lsof not installed; holders of %s unknown\n' "${KEPT}"
|
|
fi
|
|
python3 -c '
|
|
import json, sys, time
|
|
state = json.load(open(sys.argv[1]))
|
|
stage, free, age = state["stage"], state["free"], round(time.time() - state["checked"])
|
|
print(f"stored stage {stage}, {free:.1f} GB free, {age} s old")
|
|
sys.exit(1 if age > int(sys.argv[2]) else 0)
|
|
' "${STATE}" "${STALE_SECONDS}"
|