Run on the core host, on Claude Sonnet 5.5 via the Anthropic API; no Ollama
The daemon moves from WSL on the workstation to the core host, where it runs commands directly (core is the only host). One model profile, claude, with a 200k context and the existing cost caps. install.sh runs on the core host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
974abbec1d
commit
12e6fef51c
9 files changed
+263
-271
No files matched your search
+34
-52
@@ -28,13 +28,14 @@ Event-driven where something announces itself:
|
||||
|
||||
All agent work runs one task at a time through the canonical stack-support
|
||||
agent (semprini-core/agents/stack-support.agent.md), run in-process with
|
||||
pydantic-ai (agent.py), on the workstation's local model (GLM-4.7-Flash on
|
||||
Ollama) unless config.json names others.
|
||||
pydantic-ai (agent.py), on Claude through the Anthropic API unless
|
||||
config.json names other models.
|
||||
Operator messages go to the front of the queue.
|
||||
|
||||
The daemon runs on the operator's workstation, not on the stack it keeps:
|
||||
it reaches the core host over SSH (hosts.py), reads the host's health in one
|
||||
round trip (probe.py), and edits and commits core's live checkout there.
|
||||
The daemon runs on the core host itself, which is always on: commands run
|
||||
there directly (hosts.py), probe.py reads the host's health, and the agent
|
||||
edits and commits core's live checkout in place. It reaches the home
|
||||
cluster through the WireGuard tunnel.
|
||||
|
||||
Remediation scope is whatever Uptime Kuma tracks at check time, re-read every
|
||||
cycle. Changes the agent applies are committed to semprini-core `main` and
|
||||
@@ -77,30 +78,15 @@ CORE_HOME = "/home/ubuntu"
|
||||
DEFAULTS = {
|
||||
# Where commands run (hosts.py). Replaced whole by config.json, not merged.
|
||||
"hosts": {
|
||||
# No "ssh": the daemon runs on this host, so commands run here directly.
|
||||
"core": {
|
||||
"ssh": "ubuntu@3.107.254.151",
|
||||
"about": "the core stack host, AWS Lightsail Semprini-Core, Ubuntu, user "
|
||||
"ubuntu (docker group, passwordless sudo). Docker Compose runs "
|
||||
"the core stack, semprini-blog and conk; Loki, Kuma and Gitea "
|
||||
"are here. kubectl (as elz-operator) and `ssh sem-k8s-1..3`, "
|
||||
"`ssh sem-gw` also reach the home cluster from here, through the "
|
||||
"tunnel; `local` reaches it without the tunnel",
|
||||
},
|
||||
"local": {
|
||||
"about": "the operator's workstation, WSL Ubuntu, where this daemon runs. "
|
||||
"curl, git and ssh; GITEA_* is set for API calls. The home cluster "
|
||||
"is on this LAN: work on it from here. `kubectl` (cluster-admin, as "
|
||||
"elz-operator) and `ssh sem-k8s-1..3`, `ssh sem-gw` (as paul, "
|
||||
"passwordless sudo: `sudo k3s kubectl`, `sudo crictl`) reach it "
|
||||
"directly, tunnel or not. The operator's own checkouts are under "
|
||||
"/mnt/c/Dev: read them, never commit there",
|
||||
},
|
||||
"windows": {
|
||||
"shell": "powershell",
|
||||
"powershell_bin": "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe",
|
||||
"about": "the same workstation's Windows, as the operator's user (Hyper-V "
|
||||
"Administrators): the home cluster VMs sem-k8s-1..3 and sem-gw "
|
||||
"(Get-VM; C:\\Dev\\semprini-core\\infra\\hyperv\\cluster.ps1 status)",
|
||||
"about": "the core stack host, where this daemon runs: AWS Lightsail "
|
||||
"Semprini-Core, Ubuntu, user ubuntu (docker group, passwordless "
|
||||
"sudo). Docker Compose runs the core stack, semprini-blog and "
|
||||
"conk; Loki, Kuma and Gitea are here. GITEA_* is set for API "
|
||||
"calls. kubectl (as elz-operator) and `ssh sem-k8s-1..3`, "
|
||||
"`ssh sem-gw` reach the home cluster through the WireGuard tunnel "
|
||||
"while the operator's workstation, which hosts it, is on",
|
||||
},
|
||||
},
|
||||
# The host semprini-core runs from, and its checkout there.
|
||||
@@ -111,37 +97,33 @@ DEFAULTS = {
|
||||
"extra_dirs": [f"{CORE_HOME}/semprini-blog", f"{CORE_HOME}/conk"],
|
||||
"agent_file": "agents/stack-support.agent.md",
|
||||
"runbook_file": "docs/stack-support-runbook.md",
|
||||
# Model profiles (agent.py). One local model does everything; another
|
||||
# profile (a cloud one, say) is only worth adding for a reason. An api_key
|
||||
# is saved with --set-api-key and re-read before every run.
|
||||
# {windows_host} is the Windows side of WSL's NAT network, where Ollama
|
||||
# listens. Replaced whole by config.json, not merged.
|
||||
# Model profiles (agent.py). One Claude model does everything. Its api_key
|
||||
# is saved with --set-api-key and re-read before every run. Replaced whole
|
||||
# by config.json, not merged.
|
||||
"models": {
|
||||
# GLM-4.7-Flash (30B MoE, 19 GB) fits the 4090 with room for its cache,
|
||||
# and uses tool results faithfully (--try-model); qwen3-coder did not.
|
||||
# Ollama loads it with a 128k window.
|
||||
"local": {"model": "ollama:hf.co/bartowski/zai-org_GLM-4.7-Flash-GGUF:Q5_K_S",
|
||||
"base_url": "http://{windows_host}:11434/v1",
|
||||
"context_tokens": 131072},
|
||||
# A history is shortened past context_tokens: 200k keeps one long run
|
||||
# from re-sending (and paying for) a near-million-token prompt per step.
|
||||
"claude": {"model": "anthropic:claude-sonnet-5.5", "context_tokens": 200000},
|
||||
},
|
||||
# Which profiles each kind of task tries, best first; a later one takes
|
||||
# over when the first is unreachable or fails the run. Replaced whole.
|
||||
"routing": {
|
||||
"operator": ["local"],
|
||||
"alerts": ["local"],
|
||||
"health": ["local"],
|
||||
"upgrade": ["local"],
|
||||
"operator": ["claude"],
|
||||
"alerts": ["claude"],
|
||||
"health": ["claude"],
|
||||
"upgrade": ["claude"],
|
||||
},
|
||||
# Per run. cost_usd caps metered (Anthropic) runs by kind; local runs are free.
|
||||
# Per run. cost_usd caps metered runs by kind.
|
||||
"limits": {
|
||||
"request_limit": 150,
|
||||
"tool_calls_limit": 300,
|
||||
"cost_usd": {"default": 5, "upgrade": 15},
|
||||
},
|
||||
"agent_timeout_seconds": 2700,
|
||||
# The hold a shell on the core host sets (`maintainer.py --hold` from an old
|
||||
# checkout there, as semprini-core's sync-to-host.sh does). Read each minute.
|
||||
"remote_hold_file": f"{CORE_HOME}/.local/state/semprini-maintainer/hold.json",
|
||||
# A hold set on another machine, read each minute over the repo host. Empty
|
||||
# while the daemon runs on the core host: `--hold` there (as semprini-core's
|
||||
# sync-to-host.sh runs it) writes the daemon's own hold file.
|
||||
"remote_hold_file": "",
|
||||
"uv_bin": f"{HOME}/.local/bin/uv",
|
||||
"kuma_volume": "uptime-kuma-data",
|
||||
"sqlite_image": "keinos/sqlite3",
|
||||
@@ -925,7 +907,7 @@ def bot_identity(cfg):
|
||||
def load_hosts(cfg):
|
||||
hosts = hostlib.load_hosts(cfg)
|
||||
core = hosts.get(cfg["repo_host"])
|
||||
if core is not None and core.kind == "ssh":
|
||||
if core is not None and core.kind != "powershell":
|
||||
core.env = {**bot_identity(cfg), **core.env}
|
||||
return hosts
|
||||
|
||||
@@ -1410,11 +1392,11 @@ class Maintainer:
|
||||
f"run it.\nFailed during {what}: `{str(exc)[:300]}`")
|
||||
if AUTH_ERROR_RE.search(str(exc)):
|
||||
msg += ("\n\nThis is a model credential problem, not a stack fault. Create an "
|
||||
"API key in the provider's console, then on the workstation run "
|
||||
"API key in the provider's console, then on the core host run "
|
||||
f"`{HERE}/maintainer.py --set-api-key <profile>`. The next run picks it up.")
|
||||
elif re.search(r"connect|11434|ollama", str(exc), re.I):
|
||||
msg += ("\n\nThe local model server looks unreachable: is Ollama running on "
|
||||
"Windows, with *Expose Ollama to the network* on?")
|
||||
elif re.search(r"connect|timed? ?out|overloaded|529", str(exc), re.I):
|
||||
msg += ("\n\nThe model provider looks unreachable or overloaded: check its status "
|
||||
"page and this host's outbound network.")
|
||||
if queued:
|
||||
msg += f"\n\n{queued} task(s) are queued and will run once this clears."
|
||||
msg += "\n\n_Retrying automatically; quiet until it recovers._"
|
||||
|
||||
Reference in new issue
Block a user