From 1c049b126095a204efd8596e2e388de6a44dff7b Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:48:20 -0600 Subject: [PATCH 1/3] home(openclaw): make the gateway un-killable by a restart race; fix heartbeat checks The 2026-11-04 gateway death: a switch restarted the gateway while the OpenCode server had not yet rewritten its service record; ExecStartPre (facade-auth-materialize) failed instantly, five times inside the default start-limit window, and systemd parked the unit start-limit-hit. It stayed down ~24h. - ExecStartPre now waits up to ~3 min for service-prod.json to yield a password before failing. - Unit: StartLimitIntervalSec=600, StartLimitBurst=30, RestartSec=5s; ordered After opencode.service. - Heartbeat: skipWhenBusy=true (upstream-recommended on constrained hosts). - HEARTBEAT.md check 1 pointed at the retired per-CLI proxies (18746 dead = the Nov 4 false alerts); it now checks the facade model list on 127.0.0.1:13420 with the materialized auth, and check 2 includes the opencode service. - CHANNELS.md updated to reality: Slack live since 2026-10-26; Telegram not loaded at all. --- home/openclaw/default.nix | 57 +++++++++++++++++++++++----- home/openclaw/workspace/CHANNELS.md | 16 ++++---- home/openclaw/workspace/HEARTBEAT.md | 4 +- 3 files changed, 58 insertions(+), 19 deletions(-) diff --git a/home/openclaw/default.nix b/home/openclaw/default.nix index 459a12771a..3f46d5db50 100644 --- a/home/openclaw/default.nix +++ b/home/openclaw/default.nix @@ -66,13 +66,17 @@ in }; }; - # Start after the provider proxies + mcpx it depends on. The proxies - # are owned by the proxy-supervisor (transient fps-* units on the - # canonical ports), so the gateway must not Want the manual per-proxy - # units: a gateway restart would re-pull them, and the manual - # commandcode-proxy unit crash-loops on its already-taken port (#883). - # The gateway reaches the proxies by port, not by unit; only mcpx and - # the opencode-route proxy are real unit dependencies. + # Start after the services it depends on. The gateway's model lifeline + # is the OpenCode server (opencode.service, facade on 127.0.0.1:13420) + # since the route proxy retired (opencode#1153, 2026-11-04); it is + # ordered After it but does not Want it (the server has its own + # enablement; the ExecStartPre below waits for its service record). + # The per-CLI proxies are owned by the proxy-supervisor (transient + # fps-* units on the canonical ports), so the gateway must not Want + # the manual per-proxy units: a gateway restart would re-pull them, + # and the manual commandcode-proxy unit crash-loops on its + # already-taken port (#883). Only mcpx and the embedding server are + # Wanted. # Stable local embedding endpoint for memory-lancedb (#1300 phase 1): # a dedicated llama-server on a FIXED loopback port, reusing the # llama.cpp build and the Qwen3-Embedding-0.6B GGUF that OpenCode's @@ -102,13 +106,23 @@ in "agy-proxy.service" "codex-proxy.service" "mcpx.service" + "opencode.service" ]; Wants = [ "openclaw-embedding.service" "mcpx.service" ]; + # The 2026-11-04 death: a restart raced the OpenCode server's + # service record, ExecStartPre failed five times inside the + # default 10s start-limit window, and systemd parked the unit as + # start-limit-hit — down for a day, silently. A transient + # pre-start failure must never be able to do that again: wide + # window, generous burst, slower restart spacing. + StartLimitIntervalSec = "600"; + StartLimitBurst = 30; }; Service = { + RestartSec = "5s"; # Materialize the facade credential at every gateway start # (opencode#1146 step 3): the opencode server password lives # in its service record — the same source oc-password-sync @@ -122,7 +136,27 @@ in set -eu umask 077 mkdir -p "$HOME/.local/state/openclaw" - PW=$(${pkgs.jq}/bin/jq -r .password "$HOME/.local/state/opencode/service-prod.json") + # The OpenCode server writes its service record at ITS start; + # a gateway restart that races it (both restarted by one + # system switch, 2026-11-04) must wait for the record instead + # of failing instantly: that night the record was missing for + # ~3 minutes, this step failed five times in seconds, the + # unit hit the start limit, and the gateway stayed down until + # manually revived a day later. Wait up to ~3 minutes for a + # record that yields a password, then fail loudly. + record="$HOME/.local/state/opencode/service-prod.json" + PW="" + for attempt in $(seq 1 90); do + if [ -f "$record" ]; then + PW=$(${pkgs.jq}/bin/jq -r '.password // empty' "$record" 2>/dev/null || true) + [ -n "$PW" ] && break + fi + sleep 2 + done + if [ -z "$PW" ]; then + echo "openclaw-facade-auth-materialize: $record never yielded a password" >&2 + exit 1 + fi printf 'Basic %s' "$(printf 'opencode:%s' "$PW" | ${pkgs.coreutils}/bin/base64 -w0)" > "$HOME/.local/state/openclaw/opencode-server-auth" '' ); @@ -298,7 +332,7 @@ in # Laptop operations - Everything is a systemd **user** service (linger on): `systemctl --user status|restart `, logs via `journalctl --user -u `. - - Provider proxies on loopback: clef 18742, agy 18743, codex 18744, antigravity-ls 18745, muse 18747, commandcode 18748, claude-code 18749, opencode-route 18750. This gateway: 18789 (tailnet). + - Provider proxies on loopback: clef 18742, agy 18743, codex 18744, antigravity-ls 18745, muse 18747, commandcode 18748, claude-code 18749; the OpenCode server facade on 13420 is this gateway's only model route. This gateway: 18789 (tailnet). - OpenChamber's managed OpenCode port is dynamic — read `~/.config/openchamber/managed-opencode/state.json`, never hardcode it. - Secrets are referenced by name only (Bitwarden Secrets Manager; sops files under /run/secrets/agent-auth/). Never print or commit a secret value. @@ -402,6 +436,11 @@ in every = "30m"; lightContext = true; isolatedSession = true; + # Defer while subagent/nested lanes are busy (upstream + # heartbeat docs recommend this on constrained hosts): + # a heartbeat that collides with fleet work on this laptop + # either steals the lane or dies on requests-in-flight. + skipWhenBusy = true; activeHours = { start = "07:00"; end = "23:00"; diff --git a/home/openclaw/workspace/CHANNELS.md b/home/openclaw/workspace/CHANNELS.md index ebe50c3dae..6568478ab8 100644 --- a/home/openclaw/workspace/CHANNELS.md +++ b/home/openclaw/workspace/CHANNELS.md @@ -2,18 +2,18 @@ ## Live today +- **Slack** (Developing Today workspace) — LIVE since 2026-10-26. App `OpenClaw` (A0CD7L3S81W), bot **@openclaw** (U0CC72H7KA7), socket mode. Tokens are sops-managed secrets referenced by name (`openclaw.slack-bot-token`, `openclaw.slack-app-token`). DM policy is allowlist — Drew (U0CBX163G8Z) only. Group policy is allowlist with no channels allowlisted for Shed's own sessions yet; the Nov 2026 #alignment binding-verification posts were made through the gateway/operator path by a fleet queue task, not from a Shed session. - **Control UI / WebChat** — the gateway UI on the tailnet: `http://amd-6.raptor-pumpkinseed.ts.net:18789/` (token auth; token at `/run/secrets/openclaw/gateway-token`). Also the `openclaw` CLI on this laptop (`openclaw agent --message "…"`, `openclaw status`, `openclaw doctor`). -- **ACP coding sessions** from any connected surface: `/acp spawn opencode` (the only ACP harness wired so far; Claude/Codex run via their native runtime plugins). +- **ACP coding sessions** from any connected surface: `/acp spawn opencode` — OpenCode runs through the ACP-to-HTTP adapter onto the shared `opencode serve` at 127.0.0.1:13420; `agy` runs the system antigravity-acp server. Claude/Codex work via their native runtime plugins. (The claude/codex ACP wrapper scripts currently point into a plugin capture that has been garbage-collected; tracked on GitHub.) -## Plugins loaded, channels pending Drew's one-time setup +## Plugins loaded, channels not configured -Each of these is packaged and loaded; the channel stays inert until Drew does the one external step. Tracked as GitHub issues in developing-today/code. +Each of these is packaged and loaded; the channel stays inert until it is configured. Tracked as GitHub issues in developing-today/code. -- **Slack** (Developing Today workspace) — needs a Slack app (bot + app-level socket token) created in the workspace; tokens filed in Bitwarden by name (`openclaw.slack-bot-token`, `openclaw.slack-app-token`), then referenced from the Nix config. Intended home: a channel alongside Aster, so OpenClaw is a third voice in #alignment-style exchanges. -- **Telegram** — needs a bot from @BotFather + Drew's numeric user ID for `allowFrom`. -- **WhatsApp** — plugin loaded; pairing is a QR scan with Drew's phone (`openclaw channels login --channel whatsapp`). -- **Discord / Matrix / Signal** — plugins loaded; enable per-channel when Drew wants them (bot token / homeserver account / signal-cli link respectively). +- **WhatsApp** — plugin loaded; pairing is a QR scan with Drew's phone (`openclaw channels login --channel whatsapp`). Not linked. +- **Discord / Matrix / Signal** — plugins loaded, not configured; enable per-channel when Drew wants them (bot token / homeserver account / signal-cli link respectively). +- **Telegram** — not loaded in the current plugin set at all (an older version of this file listed it as pending; that was wrong). ## Search & research plugins loaded -Brave, Tavily, Exa, Firecrawl, Perplexity, DuckDuckGo — provider keys (where a plugin needs one) get filed in Bitwarden by name and wired via the gateway environment; DuckDuckGo and the built-in web tools work without keys. +Brave, Tavily, Exa, Firecrawl, Perplexity, DuckDuckGo, SearXNG — provider keys (where a plugin needs one) are filed in Bitwarden by name and wired via the gateway environment; DuckDuckGo, SearXNG and the built-in web tools work without keys. diff --git a/home/openclaw/workspace/HEARTBEAT.md b/home/openclaw/workspace/HEARTBEAT.md index 524deef710..0b668d566e 100644 --- a/home/openclaw/workspace/HEARTBEAT.md +++ b/home/openclaw/workspace/HEARTBEAT.md @@ -2,8 +2,8 @@ On each heartbeat, do the quick checks below with local commands only. Report to Drew **only** if something is wrong or noteworthy; otherwise reply `HEARTBEAT_OK`. -1. Fleet proxies: `curl -s -m 3 http://127.0.0.1:18748/v1/models` and `...:18746/v1/models` return JSON lists. (CommandCode + Design proxies are the model's own lifelines.) -2. `systemctl --user is-active openchamber mcpx openclaw-gateway` — all active. +1. Model lifeline — the OpenCode server facade (this gateway's only model route since the per-CLI proxies retired as lifelines, 2026-11-04): `curl -s -m 3 -H "Authorization: $(cat ~/.local/state/openclaw/opencode-server-auth)" http://127.0.0.1:13420/v1/models` returns a JSON list of route pools. +2. `systemctl --user is-active opencode openchamber mcpx openclaw-gateway` — all active. 3. Disk: `df -h /home` — flag if free space drops under 25 GB. 4. Anything in this workspace's `notes/follow-ups.md` whose date has arrived — surface it once. From aa1e02289a7c03ca71e2107b555a0b9abee32f10 Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:51:01 -0600 Subject: [PATCH 2/3] =?UTF-8?q?home(openclaw):=20drop=20heartbeat.skipWhen?= =?UTF-8?q?Busy=20=E2=80=94=20pinned=20schema=20cannot=20express=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/openclaw/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/home/openclaw/default.nix b/home/openclaw/default.nix index 3f46d5db50..9d6db5091a 100644 --- a/home/openclaw/default.nix +++ b/home/openclaw/default.nix @@ -436,11 +436,10 @@ in every = "30m"; lightContext = true; isolatedSession = true; - # Defer while subagent/nested lanes are busy (upstream - # heartbeat docs recommend this on constrained hosts): - # a heartbeat that collides with fleet work on this laptop - # either steals the lane or dies on requests-in-flight. - skipWhenBusy = true; + # NOTE: heartbeat.skipWhenBusy (upstream-recommended on + # constrained hosts) cannot be expressed yet — the pinned + # nix-openclaw generated schema has no such option. Revisit + # after the nix-openclaw upgrade. activeHours = { start = "07:00"; end = "23:00"; From 2f99a87553fa637eb5840fffdc7020e4657d50aa Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:55:59 -0600 Subject: [PATCH 3/3] home(openclaw): mkForce the gateway RestartSec override --- home/openclaw/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/openclaw/default.nix b/home/openclaw/default.nix index 9d6db5091a..0c2d26d00f 100644 --- a/home/openclaw/default.nix +++ b/home/openclaw/default.nix @@ -122,7 +122,7 @@ in StartLimitBurst = 30; }; Service = { - RestartSec = "5s"; + RestartSec = lib.mkForce "5s"; # module default is 1s — the burst spacing that let 2026-11-04 happen # Materialize the facade credential at every gateway start # (opencode#1146 step 3): the opencode server password lives # in its service record — the same source oc-password-sync