diff --git a/cc-ci-plan/launch-supervisor.py b/cc-ci-plan/launch-supervisor.py index 9d8072a..a89a2f2 100644 --- a/cc-ci-plan/launch-supervisor.py +++ b/cc-ci-plan/launch-supervisor.py @@ -98,6 +98,12 @@ def spawn_supervisor(sid, reason): Path(LOG_DIR).mkdir(parents=True, exist_ok=True) if _sup_alive(): _sup_kill(); time.sleep(1) + # Unique-name invariant (same as the upgrader): archive-rename every older session titled + # SUP_SESSION so the one this launch creates is the ONLY 'cc-ci-supervisor' in the web UI. + try: + lu._archive_stale_titles(SUP_SESSION, "supervisor archive —") + except Exception: + pass kf = Path(LOG_DIR) / f".kickoff-{SUP_SESSION}.txt" kf.write_text(build_kickoff(sid, reason)) share = "--share" if OPENCODE_SHARE else "" diff --git a/cc-ci-plan/launch-upgrader.py b/cc-ci-plan/launch-upgrader.py index 5783039..0fd30c5 100644 --- a/cc-ci-plan/launch-upgrader.py +++ b/cc-ci-plan/launch-upgrader.py @@ -286,19 +286,22 @@ def _db_created_ms(sid): except Exception: return 0 -def _archive_stale_titles(): - """Rename every existing top-level session titled SESSION to a dated archive title, so - EXACTLY ONE session ever carries the canonical name (the one this launch creates). This - keeps the run trivially findable in the opencode web UI and makes the title lookup in - _session_id() unambiguous. Old runs stay browsable under 'upgrader archive — weekly '.""" +def _archive_stale_titles(title=None, label=None): + """Rename every existing top-level session with the given canonical title to a dated + archive title, so EXACTLY ONE session ever carries the canonical name (the one the next + launch creates). Keeps the run trivially findable in the opencode web UI and makes the + title lookup in _session_id() unambiguous. Old runs stay browsable under + '