fix(recipe-report): weekly trigger uses launch-report.py 'fresh'; start kills idle/leftover session
A stale cc-ci-report session (from a prior week's run, gone idle) caused this week's launch-report.py 'start' (use-or-create) to leave it and never run a fresh report. Fix: upgrade-all step 6 now calls 'fresh', and start only leaves a session that's actively busy producing a report — an idle/leftover session is killed + restarted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f397968f47
commit
49491fcb90
@@ -32,6 +32,7 @@ def die(m): log(f"ERROR: {m}"); sys.exit(1)
|
||||
def _sh(c): return subprocess.run(c, capture_output=True, text=True)
|
||||
def session_alive(): return _sh(["tmux", "has-session", "-t", SESSION]).returncode == 0
|
||||
def kill_session(): subprocess.run(["tmux", "kill-session", "-t", SESSION], capture_output=True)
|
||||
def _busy(): return "esc to interrupt" in _sh(["tmux", "capture-pane", "-pt", SESSION]).stdout
|
||||
|
||||
|
||||
def build_kickoff(date):
|
||||
@@ -56,9 +57,11 @@ def start(mode, date):
|
||||
die("tmux not found")
|
||||
Path(LOG_DIR).mkdir(parents=True, exist_ok=True)
|
||||
if session_alive():
|
||||
if mode == "use-or-create":
|
||||
log(f"{SESSION} already running — leaving it"); return
|
||||
log(f"{SESSION} exists — killing (fresh)"); kill_session(); time.sleep(1)
|
||||
# The report is a one-shot. Leave the session ONLY if it's actively producing a report;
|
||||
# an idle/leftover session (e.g. last week's, gone idle) is killed so a new run starts.
|
||||
if mode == "use-or-create" and _busy():
|
||||
log(f"{SESSION} busy with a report — leaving it"); return
|
||||
log(f"{SESSION} exists (idle/leftover) — killing first"); kill_session(); time.sleep(1)
|
||||
|
||||
kf = Path(LOG_DIR) / f".kickoff-{SESSION}.txt"
|
||||
kf.write_text(build_kickoff(date))
|
||||
|
||||
Reference in New Issue
Block a user