From 5c260d225ce9aa46a1a10e4bf29cf6f596274e13 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Thu, 11 Jun 2026 16:03:29 +0000 Subject: [PATCH] launch-orchestrator: persisted .orch-model file (ORCH_MODEL > LOOP_MODEL > file) Operator switching models near weekly limits: loops -> sonnet, orchestrator -> opus. Dotfiles updated (.loop-model/.loop-model-adv=sonnet, .orch-model=opus) so watchdog restarts keep the choice. --- cc-ci-plan/launch-orchestrator.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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")