From b6a95c423c7443805775e7d70ded6b11434ff4c0 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Sat, 4 Jul 2026 10:11:49 +0000 Subject: [PATCH] supervisor: treat run as finished once the weekly summary is written A run can finish the recipe work + summary + report yet never print a clean sign-off marker (it may wedge afterwards, as on 2026-07-03). Without a second completion signal the supervisor would try to 'resume' the already-finished run every hour until the 96h window closed. Now the gate also treats the run as done when a weekly summary file (upgrade-all-.md, the Step-5 output) exists with an mtime after the session began. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01WxbpH3DquKzoSTSwGvGuET --- cc-ci-plan/launch-supervisor.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cc-ci-plan/launch-supervisor.py b/cc-ci-plan/launch-supervisor.py index 27efdaf..9d8072a 100644 --- a/cc-ci-plan/launch-supervisor.py +++ b/cc-ci-plan/launch-supervisor.py @@ -117,6 +117,19 @@ def _gate(): return False, sid, "weekly run COMPLETE (DONE marker present) — nothing to do" created = _session_created_ms(sid) age_h = (time.time() * 1000 - created) / 3.6e6 if created else 0.0 + # Belt-and-suspenders completion signal: the run wrote its weekly SUMMARY (Step 5 output) AFTER + # this session began. More reliable than the text marker — a run can finish the actual work + + # summary + report yet never print a clean sign-off (it may wedge afterwards, as on 2026-07-03). + # Without this the supervisor would try to "resume" an already-finished run every hour until the + # 96h window closes. + if created: + import glob + for f in glob.glob(os.path.join(WORKDIR, ".cc-ci-logs/upgrades/upgrade-all-*.md")): + try: + if os.path.getmtime(f) * 1000 > created: + return False, sid, f"weekly summary written ({os.path.basename(f)}) — run finished" + except OSError: + pass if created and age_h > WINDOW_HOURS: return False, sid, f"incomplete run is {age_h:.0f}h old (> {WINDOW_HOURS:.0f}h window) — not auto-resurrecting" # "Progressing" for an opencode run is NOT session_busy() (its pane regex is claude-tuned and