diff --git a/cc-ci-plan/launch-orchestrator.py b/cc-ci-plan/launch-orchestrator.py index 2220bad..ffb5e97 100644 --- a/cc-ci-plan/launch-orchestrator.py +++ b/cc-ci-plan/launch-orchestrator.py @@ -42,7 +42,20 @@ WORKDIR = os.environ.get("ORCH_DIR", "/srv/cc-ci-orch") LOG_DIR = os.environ.get("LOG_DIR", "/srv/cc-ci/.cc-ci-logs") BACKEND = os.environ.get("LOOP_BACKEND", "claude") -LOOP_MODEL = os.environ.get("LOOP_MODEL", "") + +# Orchestrator model: ORCH_MODEL env wins, then LOOP_MODEL, then a persisted file written +# when the operator changes the model (so watchdog-triggered restarts keep it). +_ORCH_MODEL_FILE = f"{LOG_DIR}/.orch-model" + +def _read_file_default(path, default): + try: + v = open(path).read().strip() + return v or default + except FileNotFoundError: + return default + +LOOP_MODEL = (os.environ.get("ORCH_MODEL") or os.environ.get("LOOP_MODEL") + or _read_file_default(_ORCH_MODEL_FILE, "")) # claude-specific CLAUDE_BIN = os.environ.get("CLAUDE_BIN", "claude")