feat(upgrader): LOOP_TIER=go|zen config — switch weekly upgrade to OpenCode ZEN
GO subscription hit a monthly usage limit (resets in 9 days). Add LOOP_TIER env (default 'zen') to launch-upgrader.py + launch-report.py so the opencode backend can use either subscription: zen→opencode/glm-5.2, go→opencode-go/glm-5.2. The tier selects the default model, the usage-limit probe endpoint, and the auth.json key. The systemd timer reads LOOP_TIER from /srv/cc-ci/upgrader.env.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"""cc-ci recipe-report launcher — one-shot agent that runs /recipe-report after the weekly upgrade.
|
||||
|
||||
The report agent's model is configured SEPARATELY from the upgrader (REPORT_BACKEND/REPORT_MODEL),
|
||||
but defaults to the same OpenCode Go subscription on glm-5.2. The model default tracks the backend
|
||||
(opencode→opencode-go/glm-5.2, claude→opus).
|
||||
but defaults to the same OpenCode subscription on glm-5.2 as the upgrader. The model default tracks
|
||||
the backend+tier (opencode+zen→opencode/glm-5.2, opencode+go→opencode-go/glm-5.2, claude→opus).
|
||||
|
||||
Usage:
|
||||
launch-report.py start [DATE] use-or-create the session; runs /recipe-report [DATE]
|
||||
@@ -11,7 +11,8 @@ Usage:
|
||||
launch-report.py stop kill the session
|
||||
launch-report.py status show session state
|
||||
|
||||
Env: REPORT_BACKEND (default opencode), REPORT_MODEL (default opencode-go/glm-5.2 | opus for claude),
|
||||
Env: REPORT_BACKEND (default opencode), REPORT_MODEL (default tracks tier),
|
||||
LOOP_TIER / REPORT_TIER (default 'zen'; 'go' or 'zen'; only for opencode),
|
||||
OPENCODE_SHARE (1=attach web server + public --share link), REPORT_SESSION, REPORT_DIR.
|
||||
"""
|
||||
import os, subprocess, sys, time
|
||||
@@ -22,7 +23,9 @@ SESSION = os.environ.get("REPORT_SESSION", "cc-ci-report")
|
||||
WORKDIR = os.environ.get("REPORT_DIR", "/srv/cc-ci")
|
||||
LOG_DIR = os.environ.get("LOG_DIR", "/srv/cc-ci/.cc-ci-logs")
|
||||
BACKEND = os.environ.get("REPORT_BACKEND", "opencode")
|
||||
_DEFAULT_MODEL = "opencode-go/glm-5.2" if BACKEND == "opencode" else "opus"
|
||||
TIER = os.environ.get("LOOP_TIER", os.environ.get("REPORT_TIER", "zen"))
|
||||
_TIER_MODEL = {"go": "opencode-go/glm-5.2", "zen": "opencode/glm-5.2"}
|
||||
_DEFAULT_MODEL = _TIER_MODEL.get(TIER, _TIER_MODEL["zen"]) if BACKEND == "opencode" else "opus"
|
||||
MODEL = os.environ.get("REPORT_MODEL", _DEFAULT_MODEL)
|
||||
CLAUDE_BIN = os.environ.get("CLAUDE_BIN", "claude")
|
||||
CLAUDE_FLAGS = os.environ.get("CLAUDE_FLAGS", "--dangerously-skip-permissions")
|
||||
@@ -84,7 +87,7 @@ def start(mode, date):
|
||||
)
|
||||
else:
|
||||
die(f"unknown REPORT_BACKEND '{BACKEND}'")
|
||||
log(f"starting {SESSION} (backend={BACKEND}, model={MODEL}, date={date or 'today'})")
|
||||
log(f"starting {SESSION} (backend={BACKEND}, tier={TIER}, model={MODEL}, date={date or 'today'})")
|
||||
subprocess.run(["tmux", "new-session", "-d", "-s", SESSION, "-c", cwd, cmd])
|
||||
subprocess.run(["tmux", "pipe-pane", "-o", "-t", SESSION, f"cat >> '{LOG_DIR}/{SESSION}.log'"])
|
||||
if BACKEND == "opencode":
|
||||
@@ -99,13 +102,13 @@ def start(mode, date):
|
||||
LU = "/srv/cc-ci/cc-ci-plan/launch-upgrader.py"
|
||||
rf = Path(LOG_DIR) / f".kickoff-{SESSION}-resume.txt"
|
||||
rf.write_text(
|
||||
"The opencode-go usage limit has reset (or the report stalled). CONTINUE generating and "
|
||||
"The opencode usage limit has reset (or the report stalled). CONTINUE generating and "
|
||||
"publishing this week's public Recipe Report per /recipe-report: survey → write the spec "
|
||||
"JSON → render with recipe-report.py → publish. Do NOT hand-write HTML (render() owns all "
|
||||
"formatting). When the page is live, print 'RECIPE REPORT COMPLETE' and go idle.")
|
||||
wenv = {"HOME": os.environ.get("HOME") or "/home/loops",
|
||||
"UPGRADER_SESSION": SESSION, "UPGRADER_DIR": cwd, "LOG_DIR": LOG_DIR,
|
||||
"UPGRADER_BACKEND": "opencode", "UPGRADER_MODEL": MODEL,
|
||||
"UPGRADER_BACKEND": "opencode", "UPGRADER_MODEL": MODEL, "LOOP_TIER": TIER,
|
||||
"OPENCODE_BIN": OPENCODE_BIN, "OPENCODE_SERVER": OPENCODE_SERVER,
|
||||
"OPENCODE_SHARE": "1" if OPENCODE_SHARE else "0",
|
||||
"UPGRADER_DONE_MARKER": "RECIPE REPORT COMPLETE",
|
||||
|
||||
Reference in New Issue
Block a user