watch.py reports times in CST

This commit is contained in:
KeelrLeek committed 2026-10-07 18:21:43 -05:00
1 parent b28f80f1a4
commit 57fb31f2d6
1 file changed
+15 -2
+15 -2
View File
@@ -18,6 +18,19 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from harbor import projects # noqa: E402
def cst(iso):
"""'2026-10-07T23:21:05Z' -> '18:21 CST' (US Central, as the User reads every time)."""
import datetime
from zoneinfo import ZoneInfo
try:
when = datetime.datetime.fromisoformat(str(iso).replace("Z", "+00:00"))
except ValueError:
return str(iso)
if when.tzinfo is None:
when = when.replace(tzinfo=datetime.timezone.utc)
return when.astimezone(ZoneInfo("America/Chicago")).strftime("%H:%M") + " CST"
def snapshot(conn, me):
q = lambda sql, *a: conn.execute(sql, a).fetchall()
return {
@@ -88,7 +101,7 @@ def main():
for agent, last in stalled(conn, project, args.me, args.stall):
if agent in {a.strip() for a in args.ignore.split(",") if a.strip()}:
continue
found.append(f"stalled: {agent} has made no tool call since {last[11:16]}Z (not stopped) - wake it")
found.append(f"stalled: {agent} has made no tool call since {cst(last)} (not stopped) - wake it")
if found:
print("\n".join(found))
return 0
@@ -96,7 +109,7 @@ def main():
tasks = conn.execute("SELECT state, COUNT(*) FROM tasks GROUP BY state").fetchall()
last = conn.execute("SELECT agent, MAX(at) FROM activity_log GROUP BY agent").fetchall()
print(f"quiet for {args.minutes:g} min; open review items {open_items}; tasks {dict(tasks)}; last tool call "
+ ", ".join(f"{a} {t[11:16]}Z" for a, t in last))
+ ", ".join(f"{a} {cst(t)}" for a, t in last))
return 0