diff --git a/cc-ci-plan/launch.py b/cc-ci-plan/launch.py index 61b4a73..6695682 100644 --- a/cc-ci-plan/launch.py +++ b/cc-ci-plan/launch.py @@ -66,7 +66,16 @@ LOOP_MODEL = os.environ.get("LOOP_MODEL") or _read_file_default(_MODEL_FILE, ADV_MODEL = os.environ.get("ADV_MODEL") or _read_file_default(_ADV_MODEL_FILE, "") def role_model(role): - return ADV_MODEL if (role == "adversary" and ADV_MODEL) else LOOP_MODEL + # Per-phase override wins: a file LOG_DIR/.loop-model- (builder/shared) or + # .loop-model-adv- (adversary) pins a model for just that phase. Read fresh on + # every call (cur_idx → PHASE_IDX_FILE), so a phase transition flips the model + # automatically — e.g. opus for a hard phase, sonnet after — with no watchdog bounce. + pid = phase_id(cur_idx()) + if role == "adversary": + ov = _read_file_default(os.path.join(LOG_DIR, f".loop-model-adv-{pid}"), "") + return ov or ADV_MODEL or LOOP_MODEL + ov = _read_file_default(os.path.join(LOG_DIR, f".loop-model-{pid}"), "") + return ov or LOOP_MODEL REMOTE_CONTROL = os.environ.get("REMOTE_CONTROL", "1") == "1" CLAUDE_BIN = os.environ.get("CLAUDE_BIN", "claude")