diff --git a/cc-ci-plan/launch-report.py b/cc-ci-plan/launch-report.py index 0f9bf7f..3b9b9cd 100755 --- a/cc-ci-plan/launch-report.py +++ b/cc-ci-plan/launch-report.py @@ -73,14 +73,30 @@ def start(mode, date): # Unique-name invariant (same as upgrader/supervisor): archive-rename every older session # titled SESSION so the one this launch creates is the ONLY 'cc-ci-report' in the web UI. # Archived names start with 'archive-' (operator convention 2026-08-04). + # + # AND clear the stale session PIN. The pin file is what the shared watchdog resolves via + # lu._session_id(); if a PREVIOUS run's pin survives, the watchdog inspects that old (already + # DONE_MARKER-bearing) session, declares "run completed" and exits within one poll — leaving + # the new run unwatched. That regression silently un-watchdogged the 2026-08-07 finish-run's + # report step (pin dated 2026-08-04). The pin is re-established after launch, below. + _lu = None + _prev_ids = set() try: + os.environ["UPGRADER_SESSION"] = SESSION # scope the shared helpers to THIS session name import importlib.util as _ilu _spec = _ilu.spec_from_file_location( "launch_upgrader", os.path.join(os.path.dirname(os.path.realpath(__file__)), "launch-upgrader.py")) _lu = _ilu.module_from_spec(_spec); _spec.loader.exec_module(_lu) _lu._archive_stale_titles(SESSION) + _rows = _lu._server_get("/session") or [] + _rows = _rows if isinstance(_rows, list) else _rows.get("data", []) + _prev_ids = {s.get("id") for s in _rows} + try: + _lu.STATE_SID_FILE.unlink() + except OSError: + pass except Exception as e: - log(f" (archive-rename skipped: {e})") + log(f" (archive-rename/pin-clear skipped: {e})") kf = Path(LOG_DIR) / f".kickoff-{SESSION}.txt" kf.write_text(build_kickoff(date)) @@ -102,6 +118,10 @@ def start(mode, date): log(f"starting {SESSION} (backend={BACKEND}, tier={TIER}, model={MODEL}, date={date or 'today'})") subprocess.run(["tmux", "new-session", "-d", "-s", SESSION, "-c", cwd, cmd]) subprocess.run(["tmux", "pipe-pane", "-o", "-t", SESSION, f"cat >> '{LOG_DIR}/{SESSION}.log'"]) + if BACKEND == "opencode" and _lu is not None: + # Re-establish the pin on THIS run's session, so the watchdog (spawned below) resolves the + # new session rather than falling back to a title lookup or a stale pin. + _lu._pin_new_session(_prev_ids) if BACKEND == "opencode": if OPENCODE_SHARE: log(f" attached to {OPENCODE_SERVER} → http://oc.commoninternet.net +public --share link")