fix: DeepSeek for the whole weekly run; move timer to Saturday

Follow-up to #43. The upgrader parent (LOOP_MODEL) and hourly supervisor
(SUPERVISOR_MODEL) should also use DeepSeek V4.1 Flash, not just the report.
So all three launchers and upgrader.env now default to
opencode-go/deepseek-v4.1-flash (subagents already did).

Also move cc-ci-upgrade-all.timer from Thu 22:00 to Sat 22:00
America/New_York, so the weekly run + the report it launches happen on the
weekend and avoid DeepSeek's weekday peak-pricing windows
(01:00-04:00 & 06:00-10:00 UTC).

Verified: importing each launcher resolves deepseek-v4.1-flash; Python parses
clean; 'systemd-analyze calendar' gives next elapse Sun 03:00 UTC (Sat 22:00 ET),
which is a weekend. NixOS host rebuilt test->switch to apply the timer.
This commit is contained in:
2026-11-23 17:37:49 +00:00
parent e1769a561e
commit c7ef5994b1
5 changed files with 32 additions and 28 deletions
+3 -2
View File
@@ -392,8 +392,9 @@ sudo -iu loops tmux ls # cc-ci-orchestrator, cc-ci
## Weekly upgrade run ## Weekly upgrade run
`cc-ci-upgrade-all.timer` (Thu 22:00 America/New_York) starts `launch-upgrader.py`, which runs `cc-ci-upgrade-all.timer` (Sat 22:00 America/New_York — weekend, off DeepSeek's weekday peak windows) starts `launch-upgrader.py`, which runs
`/upgrade-all` as an opencode agent (`upgrader.env`: `LOOP_MODEL`/`REPORT_MODEL`) in tmux `/upgrade-all` as an opencode agent (`upgrader.env`: `LOOP_MODEL`/`REPORT_MODEL`/`SUPERVISOR_MODEL`, all
`opencode-go/deepseek-v4.1-flash`) in tmux
`cc-ci-upgrader` with a usage-limit watchdog; the hourly `cc-ci-upgrade-supervisor.timer` drives a `cc-ci-upgrader` with a usage-limit watchdog; the hourly `cc-ci-upgrade-supervisor.timer` drives a
stalled run to completion. Start one by hand with `systemctl start cc-ci-upgrade-all`; follow stalled run to completion. Start one by hand with `systemctl start cc-ci-upgrade-all`; follow
`/srv/cc-ci/.cc-ci-logs/cc-ci-upgrader.log`; it ends with `UPGRADE RUN COMPLETE`, a summary in `/srv/cc-ci/.cc-ci-logs/cc-ci-upgrader.log`; it ends with `UPGRADE RUN COMPLETE`, a summary in
+5 -5
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
cc-ci weekly-run SUPERVISOR — hourly glm-5.3-flash orchestrator wake-up. cc-ci weekly-run SUPERVISOR — hourly deepseek-v4.1-flash orchestrator wake-up.
Fired hourly by a systemd timer. It is a CHEAP deterministic GATE first: if this week's Fired hourly by a systemd timer. It is a CHEAP deterministic GATE first: if this week's
/upgrade-all run is already complete, or is actively progressing, it does NOTHING and spends /upgrade-all run is already complete, or is actively progressing, it does NOTHING and spends
ZERO model tokens. Only when the run has STALLED or died before completing — e.g. the host ZERO model tokens. Only when the run has STALLED or died before completing — e.g. the host
disk-full crash on 2026-07-03 that the log-idle/429 watchdog does NOT cover — does it launch a disk-full crash on 2026-07-03 that the log-idle/429 watchdog does NOT cover — does it launch a
short-lived glm-5.3-flash opencode agent that DIAGNOSES the blockage (disk, wedged deploy, dead short-lived deepseek-v4.1-flash opencode agent that DIAGNOSES the blockage (disk, wedged deploy, dead
session, a stuck recipe) and DRIVES the run to completion (resume the upgrader, ensure the session, a stuck recipe) and DRIVES the run to completion (resume the upgrader, ensure the
summary + public report land). One-shot per fire; the next hour re-checks and no-ops if healthy. summary + public report land). One-shot per fire; the next hour re-checks and no-ops if healthy.
@@ -34,7 +34,7 @@ lu = importlib.util.module_from_spec(_spec); _spec.loader.exec_module(lu)
SUP_SESSION = os.environ.get("SUPERVISOR_SESSION", "cc-ci-supervisor") SUP_SESSION = os.environ.get("SUPERVISOR_SESSION", "cc-ci-supervisor")
WORKDIR = os.environ.get("UPGRADER_DIR", "/srv/cc-ci") WORKDIR = os.environ.get("UPGRADER_DIR", "/srv/cc-ci")
LOG_DIR = os.environ.get("LOG_DIR", "/srv/cc-ci/.cc-ci-logs") LOG_DIR = os.environ.get("LOG_DIR", "/srv/cc-ci/.cc-ci-logs")
MODEL = os.environ.get("SUPERVISOR_MODEL", "opencode-go/glm-5.3-flash") MODEL = os.environ.get("SUPERVISOR_MODEL", "opencode-go/deepseek-v4.1-flash")
OPENCODE_BIN = lu.OPENCODE_BIN OPENCODE_BIN = lu.OPENCODE_BIN
OPENCODE_SERVER = lu.OPENCODE_SERVER OPENCODE_SERVER = lu.OPENCODE_SERVER
OPENCODE_SHARE = os.environ.get("OPENCODE_SHARE", "1") == "1" OPENCODE_SHARE = os.environ.get("OPENCODE_SHARE", "1") == "1"
@@ -63,7 +63,7 @@ def _sup_kill(): _sh(["tmux", "kill-session", "-t", SUP_SESSION])
# ── the supervisor agent ───────────────────────────────────────────────────────────────────────── # ── the supervisor agent ─────────────────────────────────────────────────────────────────────────
def build_kickoff(sid, reason): def build_kickoff(sid, reason):
return f"""\ return f"""\
*** cc-ci WEEKLY-RUN SUPERVISOR — one-shot, glm-5.3-flash *** *** cc-ci WEEKLY-RUN SUPERVISOR — one-shot, deepseek-v4.1-flash ***
You are the hourly SUPERVISOR for the weekly cc-ci /upgrade-all run. A gate has determined the run You are the hourly SUPERVISOR for the weekly cc-ci /upgrade-all run. A gate has determined the run
is INCOMPLETE and not currently progressing ({reason}). Your job: get this week's run to a clean is INCOMPLETE and not currently progressing ({reason}). Your job: get this week's run to a clean
DONE — published report + summary — then STOP. You are NOT a perpetual loop. DONE — published report + summary — then STOP. You are NOT a perpetual loop.
@@ -111,7 +111,7 @@ def spawn_supervisor(sid, reason):
f"--attach '{OPENCODE_SERVER}' --title '{SUP_SESSION}' --dir {WORKDIR} \"$(cat '{kf}')\"") f"--attach '{OPENCODE_SERVER}' --title '{SUP_SESSION}' --dir {WORKDIR} \"$(cat '{kf}')\"")
_sh(["tmux", "new-session", "-d", "-s", SUP_SESSION, "-c", WORKDIR, cmd]) _sh(["tmux", "new-session", "-d", "-s", SUP_SESSION, "-c", WORKDIR, cmd])
_sh(["tmux", "pipe-pane", "-o", "-t", SUP_SESSION, f"cat >> '{LOG_DIR}/{SUP_SESSION}.log'"]) _sh(["tmux", "pipe-pane", "-o", "-t", SUP_SESSION, f"cat >> '{LOG_DIR}/{SUP_SESSION}.log'"])
log(f"launched glm-5.3-flash supervisor (tmux '{SUP_SESSION}', model={MODEL}) — {reason}") log(f"launched deepseek-v4.1-flash supervisor (tmux '{SUP_SESSION}', model={MODEL}) — {reason}")
# ── gate ───────────────────────────────────────────────────────────────────────────────────────── # ── gate ─────────────────────────────────────────────────────────────────────────────────────────
def _gate(): def _gate():
+4 -4
View File
@@ -22,8 +22,8 @@ Env:
provider catalogue — see the TIER block below). provider catalogue — see the TIER block below).
Only affects the opencode backend (ignored for claude). Only affects the opencode backend (ignored for claude).
LOOP_MODEL model flag (overrides UPGRADER_MODEL); default tracks backend+tier — LOOP_MODEL model flag (overrides UPGRADER_MODEL); default tracks backend+tier —
opencode+go→opencode-go/glm-5.3-flash, opencode+zen→opencode/glm-5.2, claude→sonnet opencode+go→opencode-go/deepseek-v4.1-flash, opencode+zen→opencode/glm-5.2, claude→sonnet
UPGRADER_MODEL provider/model for opencode, e.g. opencode-go/glm-5.3-flash (OpenCode Go, default), UPGRADER_MODEL provider/model for opencode, e.g. opencode-go/deepseek-v4.1-flash (OpenCode Go, default),
opencode/glm-5.2 (OpenCode ZEN), or tinfoil/deepseek-v4-pro; sonnet for claude opencode/glm-5.2 (OpenCode ZEN), or tinfoil/deepseek-v4-pro; sonnet for claude
UPGRADER_ARGS extra args passed to /upgrade-all (e.g. "n8n ghost", "--dry-run") UPGRADER_ARGS extra args passed to /upgrade-all (e.g. "n8n ghost", "--dry-run")
@@ -52,7 +52,7 @@ LOG_DIR = os.environ.get("LOG_DIR", "/srv/cc-ci/.cc-ci-logs")
BACKEND = os.environ.get("LOOP_BACKEND", os.environ.get("UPGRADER_BACKEND", "opencode")) BACKEND = os.environ.get("LOOP_BACKEND", os.environ.get("UPGRADER_BACKEND", "opencode"))
TIER = os.environ.get("LOOP_TIER", os.environ.get("UPGRADER_TIER", "go")) TIER = os.environ.get("LOOP_TIER", os.environ.get("UPGRADER_TIER", "go"))
_TIER_CFG = { _TIER_CFG = {
"go": {"model": "opencode-go/glm-5.3-flash", "endpoint": "https://opencode.ai/zen/go/v1/chat/completions", "go": {"model": "opencode-go/deepseek-v4.1-flash", "endpoint": "https://opencode.ai/zen/go/v1/chat/completions",
"auth": "opencode-go", "label": "OpenCode Go"}, "auth": "opencode-go", "label": "OpenCode Go"},
"zen": {"model": "opencode/glm-5.2", "endpoint": "https://opencode.ai/zen/v1/chat/completions", "zen": {"model": "opencode/glm-5.2", "endpoint": "https://opencode.ai/zen/v1/chat/completions",
"auth": "opencode", "label": "OpenCode ZEN"}, "auth": "opencode", "label": "OpenCode ZEN"},
@@ -406,7 +406,7 @@ def _limit_retry_after():
key = _limit_key() key = _limit_key()
if not key: if not key:
return 0 return 0
body = _json.dumps({"model": (MODEL or "").split("/")[-1] or "glm-5.3-flash", "max_tokens": 8, body = _json.dumps({"model": (MODEL or "").split("/")[-1] or "deepseek-v4.1-flash", "max_tokens": 8,
"messages": [{"role": "user", "content": "hi"}]}).encode() "messages": [{"role": "user", "content": "hi"}]}).encode()
req = _ureq.Request(LIMIT_ENDPOINT, data=body, method="POST", req = _ureq.Request(LIMIT_ENDPOINT, data=body, method="POST",
headers={"Authorization": "Bearer " + key, "content-type": "application/json"}) headers={"Authorization": "Bearer " + key, "content-type": "application/json"})
+8 -6
View File
@@ -1,6 +1,6 @@
--- ---
name: weekly-upgrader-opencode-go-glm name: weekly-upgrader-opencode-go-glm
description: weekly upgrade run now defaults to opencode-go/glm-5.3-flash (PR #20, 2026-09-14); zen tier dead on this host; how backend/model + monitoring are wired description: weekly upgrade run now defaults to opencode-go/deepseek-v4.1-flash for upgrader + report + supervisor (2026-11-23), timer moved to Sat 22:00 America/New_York; zen tier dead on this host; how backend/model + monitoring are wired
metadata: metadata:
node_type: memory node_type: memory
type: project type: project
@@ -10,11 +10,13 @@ metadata:
The weekly recipe-upgrade run (`cc-ci-plan/launch-upgrader.py`, fired by the The weekly recipe-upgrade run (`cc-ci-plan/launch-upgrader.py`, fired by the
`cc-ci-upgrade-all` systemd timer Thu 22:00 Boston) now **defaults to backend=opencode, `cc-ci-upgrade-all` systemd timer Thu 22:00 Boston) now **defaults to backend=opencode,
model=opencode-go/glm-5.3-flash** when no env is set (operator choice 2026-09-08 via model=opencode-go/glm-5.3-flash** when no env is set (operator choice 2026-09-08 via
`/srv/cc-ci/upgrader.env`; PR #20 hardcoded the same defaults into the launchers 2026-09-14 — `/srv/cc-ci/upgrader.env`; PR #20 hardcoded the same defaults into the launchers 2026-09-14).
upgrader + supervisor). **2026-11-23: the REPORT launcher (`launch-report.py`) was moved to **2026-11-23: ALL main agents (upgrader parent, report, hourly supervisor) were moved to
`opencode-go/deepseek-v4.1-flash`** (display name "DeepSeek V4.1 Flash 1017") at the operator's `opencode-go/deepseek-v4.1-flash`** (display name "DeepSeek V4.1 Flash 1017") at the operator's
request; `upgrader.env` `REPORT_MODEL` and the in-code default now both say deepseek, while request — `upgrader.env` `LOOP_MODEL`/`REPORT_MODEL`/`SUPERVISOR_MODEL` and the in-code defaults
LOOP_MODEL / SUPERVISOR_MODEL stay glm-5.3-flash. Model default tracks the in all three launchers now say deepseek. The timer was also moved from Thu 22:00 to **Sat 22:00
America/New_York** so the whole run + report lands on the weekend, avoiding DeepSeek's weekday
peak-pricing windows (01:00–04:00 & 06:00–10:00 UTC). Model default tracks the
backend — an explicit `LOOP_BACKEND=claude` (no model) falls back to `sonnet`. backend — an explicit `LOOP_BACKEND=claude` (no model) falls back to `sonnet`.
**2026-09-14 — ZEN IS DEAD ON THIS HOST.** The ZEN provider models (`opencode/glm-5.2`) are **2026-09-14 — ZEN IS DEAD ON THIS HOST.** The ZEN provider models (`opencode/glm-5.2`) are
@@ -69,7 +71,7 @@ renamed from `babysit` 2026-06-23.)
reuses it for the REPORT job (`cc-ci-report` session, marker `RECIPE REPORT COMPLETE`) — the report runs on reuses it for the REPORT job (`cc-ci-report` session, marker `RECIPE REPORT COMPLETE`) — the report runs on
glm-5.2 sharing the same opencode-go budget the upgrade run drains, so it can 429-stall too. `_run_pids()` glm-5.2 sharing the same opencode-go budget the upgrade run drains, so it can 429-stall too. `_run_pids()`
is scoped to the managed session (title or `-s <sid>`) so the two watchdogs never kill each other's process. is scoped to the managed session (title or `-s <sid>`) so the two watchdogs never kill each other's process.
Weekly timer: Thu 22:00 America/New_York; no `LOOP_BACKEND`/`upgrader.env` override ⇒ glm-5.2 defaults. Weekly timer: **Sat 22:00 America/New_York** (moved from Thu on 2026-11-23 to land on the weekend/off-peak DeepSeek pricing); no `LOOP_BACKEND`/`upgrader.env` override ⇒ deepseek-v4.1-flash defaults for upgrader/report/supervisor.
See [[orchestrator-backend-switch-gotcha]]. See [[orchestrator-backend-switch-gotcha]].
**2026-07-04 hardening (after the 2026-07-03 run stalled on a HOST DISK-FULL and never resumed — **2026-07-04 hardening (after the 2026-07-03 run stalled on a HOST DISK-FULL and never resumed —
+12 -11
View File
@@ -95,10 +95,9 @@
# UPGRADER_ARGS, …). The leading "-" makes it optional: absent file → the in-code defaults, # UPGRADER_ARGS, …). The leading "-" makes it optional: absent file → the in-code defaults,
# which are opencode + LOOP_TIER=go (the only tier with a key on this host; ZEN models are # which are opencode + LOOP_TIER=go (the only tier with a key on this host; ZEN models are
# dead here — the in-code default is 'go' for exactly that reason, see launch-upgrader.py). # dead here — the in-code default is 'go' for exactly that reason, see launch-upgrader.py).
# Current config: LOOP_TIER=go with LOOP_MODEL / SUPERVISOR_MODEL # Current config: LOOP_TIER=go with LOOP_MODEL / REPORT_MODEL / SUPERVISOR_MODEL all
# opencode-go/glm-5.3-flash (upgrader, supervisor) and REPORT_MODEL # opencode-go/deepseek-v4.1-flash (upgrader, report, supervisor). Subagents use the same
# opencode-go/deepseek-v4.1-flash (the public Recipe Report). Subagents bind deepseek via the # deepseek via the cc-ci repo's opencode config. No rebuild needed to switch — the env file is read at each
# cc-ci repo's opencode config. No rebuild needed to switch — the env file is read at each
# timer fire. Holds no secrets (the API key lives in the opencode config / auth.json). # timer fire. Holds no secrets (the API key lives in the opencode config / auth.json).
EnvironmentFile = "-/srv/cc-ci/upgrader.env"; EnvironmentFile = "-/srv/cc-ci/upgrader.env";
}; };
@@ -111,23 +110,25 @@
}; };
systemd.timers.cc-ci-upgrade-all = { systemd.timers.cc-ci-upgrade-all = {
description = "Weekly trigger for cc-ci-upgrade-all (Thursdays 22:00 America/New_York — Boston 10pm)"; description = "Weekly trigger for cc-ci-upgrade-all (Saturdays 22:00 America/New_York — Boston 10pm)";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
# 10pm Thursday Boston time — DST-aware (EDT→02:00 UTC, EST→03:00 UTC) via the tz in OnCalendar. # 10pm Saturday Boston time, i.e. the weekly run (and the Recipe Report it launches) happens
OnCalendar = "Thu *-*-* 22:00:00 America/New_York"; # on the weekend, avoiding DeepSeek's weekday peak-pricing windows (01:00–04:00 & 06:00–10:00
# UTC). DST-aware (EDT→02:00 UTC Sunday, EST→03:00 UTC Sunday) via the tz in OnCalendar.
OnCalendar = "Sat *-*-* 22:00:00 America/New_York";
Persistent = true; # if the box was down at the scheduled time, run once on next boot Persistent = true; # if the box was down at the scheduled time, run once on next boot
}; };
}; };
# Hourly SUPERVISOR — a glm-5.2 orchestrator wake-up that keeps the weekly run on track. The # Hourly SUPERVISOR — a deepseek-v4.1-flash orchestrator wake-up that keeps the weekly run on track.
# log-idle/429 watchdog only handles opencode-go usage-limit stalls; it does NOT cover a host # The log-idle/429 watchdog only handles opencode-go usage-limit stalls; it does NOT cover a host
# disk-full crash (which killed the 2026-07-03 run) or any other environmental wedge. This is a # disk-full crash (which killed the 2026-07-03 run) or any other environmental wedge. This is a
# CHEAP deterministic gate: if the weekly run is complete or actively progressing it does NOTHING # CHEAP deterministic gate: if the weekly run is complete or actively progressing it does NOTHING
# (zero model tokens). Only when a run has stalled/died before completing does it launch a # (zero model tokens). Only when a run has stalled/died before completing does it launch a
# short-lived glm-5.2 agent that diagnoses the blockage and drives the run to a clean DONE. # short-lived deepseek-v4.1-flash agent that diagnoses the blockage and drives the run to a clean DONE.
systemd.services.cc-ci-upgrade-supervisor = { systemd.services.cc-ci-upgrade-supervisor = {
description = "cc-ci hourly weekly-run supervisor (glm-5.2 — drives a stalled /upgrade-all to completion)"; description = "cc-ci hourly weekly-run supervisor (deepseek-v4.1-flash — drives a stalled /upgrade-all to completion)";
after = [ "network-online.target" ]; after = [ "network-online.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
serviceConfig = { serviceConfig = {