From c7ef5994b12a02aaeb7be581159b8a84e2cc3b59 Mon Sep 17 00:00:00 2001 From: autonomic-bot <64+autonomic-bot@noreply.git.autonomic.zone> Date: Mon, 23 Nov 2026 17:37:49 +0000 Subject: [PATCH] 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. --- README.md | 5 +++-- cc-ci-plan/launch-supervisor.py | 10 +++++----- cc-ci-plan/launch-upgrader.py | 8 ++++---- memory/weekly-upgrader-opencode-go-glm.md | 14 ++++++++------ nix/modules/cc-ci.nix | 23 ++++++++++++----------- 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index f8b0800..adada62 100644 --- a/README.md +++ b/README.md @@ -392,8 +392,9 @@ sudo -iu loops tmux ls # cc-ci-orchestrator, cc-ci ## Weekly upgrade run -`cc-ci-upgrade-all.timer` (Thu 22:00 America/New_York) starts `launch-upgrader.py`, which runs -`/upgrade-all` as an opencode agent (`upgrader.env`: `LOOP_MODEL`/`REPORT_MODEL`) in tmux +`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`/`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 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 diff --git a/cc-ci-plan/launch-supervisor.py b/cc-ci-plan/launch-supervisor.py index d2f950f..e14357b 100644 --- a/cc-ci-plan/launch-supervisor.py +++ b/cc-ci-plan/launch-supervisor.py @@ -1,12 +1,12 @@ #!/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 /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 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 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") WORKDIR = os.environ.get("UPGRADER_DIR", "/srv/cc-ci") 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_SERVER = lu.OPENCODE_SERVER 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 ───────────────────────────────────────────────────────────────────────── def build_kickoff(sid, reason): 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 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. @@ -111,7 +111,7 @@ def spawn_supervisor(sid, reason): f"--attach '{OPENCODE_SERVER}' --title '{SUP_SESSION}' --dir {WORKDIR} \"$(cat '{kf}')\"") _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'"]) - 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 ───────────────────────────────────────────────────────────────────────────────────────── def _gate(): diff --git a/cc-ci-plan/launch-upgrader.py b/cc-ci-plan/launch-upgrader.py index 731a8ee..d065ec3 100644 --- a/cc-ci-plan/launch-upgrader.py +++ b/cc-ci-plan/launch-upgrader.py @@ -22,8 +22,8 @@ Env: provider catalogue — see the TIER block below). Only affects the opencode backend (ignored for claude). 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 - UPGRADER_MODEL provider/model for opencode, e.g. opencode-go/glm-5.3-flash (OpenCode Go, default), + 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/deepseek-v4.1-flash (OpenCode Go, default), 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") @@ -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")) TIER = os.environ.get("LOOP_TIER", os.environ.get("UPGRADER_TIER", "go")) _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"}, "zen": {"model": "opencode/glm-5.2", "endpoint": "https://opencode.ai/zen/v1/chat/completions", "auth": "opencode", "label": "OpenCode ZEN"}, @@ -406,7 +406,7 @@ def _limit_retry_after(): key = _limit_key() if not key: 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() req = _ureq.Request(LIMIT_ENDPOINT, data=body, method="POST", headers={"Authorization": "Bearer " + key, "content-type": "application/json"}) diff --git a/memory/weekly-upgrader-opencode-go-glm.md b/memory/weekly-upgrader-opencode-go-glm.md index c8afe42..2a6d342 100644 --- a/memory/weekly-upgrader-opencode-go-glm.md +++ b/memory/weekly-upgrader-opencode-go-glm.md @@ -1,6 +1,6 @@ --- 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: node_type: memory type: project @@ -10,11 +10,13 @@ metadata: 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, 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 — -upgrader + supervisor). **2026-11-23: the REPORT launcher (`launch-report.py`) was moved to +`/srv/cc-ci/upgrader.env`; PR #20 hardcoded the same defaults into the launchers 2026-09-14). +**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 -request; `upgrader.env` `REPORT_MODEL` and the in-code default now both say deepseek, while -LOOP_MODEL / SUPERVISOR_MODEL stay glm-5.3-flash. Model default tracks the +request — `upgrader.env` `LOOP_MODEL`/`REPORT_MODEL`/`SUPERVISOR_MODEL` and the in-code defaults +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`. **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 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 `) 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]]. **2026-07-04 hardening (after the 2026-07-03 run stalled on a HOST DISK-FULL and never resumed — diff --git a/nix/modules/cc-ci.nix b/nix/modules/cc-ci.nix index 2833bbd..13c4fe2 100644 --- a/nix/modules/cc-ci.nix +++ b/nix/modules/cc-ci.nix @@ -95,10 +95,9 @@ # 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 # 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 - # opencode-go/glm-5.3-flash (upgrader, supervisor) and REPORT_MODEL - # opencode-go/deepseek-v4.1-flash (the public Recipe Report). Subagents bind deepseek via the - # cc-ci repo's opencode config. No rebuild needed to switch — the env file is read at each + # Current config: LOOP_TIER=go with LOOP_MODEL / REPORT_MODEL / SUPERVISOR_MODEL all + # opencode-go/deepseek-v4.1-flash (upgrader, report, supervisor). Subagents use the same + # deepseek via the 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). EnvironmentFile = "-/srv/cc-ci/upgrader.env"; }; @@ -111,23 +110,25 @@ }; 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" ]; timerConfig = { - # 10pm Thursday Boston time — DST-aware (EDT→02:00 UTC, EST→03:00 UTC) via the tz in OnCalendar. - OnCalendar = "Thu *-*-* 22:00:00 America/New_York"; + # 10pm Saturday Boston time, i.e. the weekly run (and the Recipe Report it launches) happens + # 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 }; }; - # Hourly SUPERVISOR — a glm-5.2 orchestrator wake-up that keeps the weekly run on track. The - # log-idle/429 watchdog only handles opencode-go usage-limit stalls; it does NOT cover a host + # Hourly SUPERVISOR — a deepseek-v4.1-flash orchestrator wake-up that keeps the weekly run on track. + # 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 # 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 - # 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 = { - 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" ]; wants = [ "network-online.target" ]; serviceConfig = { -- 2.54.0