Commit Graph
314 Commits
Author SHA1 Message Date
Cato 3b167334e5 ops(hetzner): add a dry-run-first box disk cleanup workflow
The bitbaum root disk is over 90%. This adds a workflow_dispatch job,
defaulting to dry_run=true, that SSHes with the existing deploy key and
reclaims reconstructible space only: journals, apt and npm caches, release
dirs beyond current+previous, unused Docker images and build cache, old
rotated logs, and Postgres dumps older than 14 days. It never touches
volumes, databases, running containers, shared env, or the live/previous
release. It also reports and, when the unit already exists, re-enables
disk-gc.timer and pg-backup.timer if they were simply disabled.
2026-11-10 11:59:08 +01:00
Cato 57f9cfe467 ci-gate: count only push and pull-request runs as CI, so the sweep cannot hold deploys (#1618)
The auto-merge sweep (event workflow_run) runs on main's SHA every time any
pull request's CI finishes. The gate counted it as CI, so a deploy waited at
PENDING until the sweep went quiet: solon's #484 had CI green at 09:24 UTC on
2026-11-10 and its deploy only passed the gate at 09:36, and every merge in
the queue waited behind that. A chained data job (places-data) failing would
also have blocked a deploy, the same class as the 2026-11-01 data-load bug.

The event test becomes an allowlist (push, pull_request, pull_request_target,
merge_group), matching the rule the comment already states. Four new cases in
test-ci-gate.sh; 22 pass.
2026-11-10 11:26:32 +01:00
Cato 5cc51575f0 fix(box-env-keys): refuse GITHUB_-prefixed secret names (#1615)
GitHub Actions reserves the GITHUB_ prefix and will not store a secret
under such a name, so a names list that includes one can never work.
The shared script and reusable workflow now fail with a clear message.
The fixture in the tests uses GH_CLIENT_ID, matching Morulia.
2026-11-10 08:48:49 +01:00
CatoandClaude Opus 5.5 fc73653347 fix(ops): the OOM killer no longer picks the user manager itself as its victim (#1609)
user@1000 failed three times on 2026-11-08 with "Main process exited,
code=killed, status=9/KILL": the kernel killed systemd --user itself, which
OOMPolicy=continue (#1606) cannot survive. Upstream user@.service ships
OOMScoreAdjust=100, which makes the ~10 MB manager outrank most real memory
hogs. The drop-in now sets OOMScoreAdjust=0 so the manager is ranked by its
real size and the OOM killer goes after the process using the memory.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:32:47 +00:00
CatoandClaude Opus 5.5 dfb69d33bc fix(alerts): the failed-unit sweep clears a failed unit whose file is gone instead of paging it (#1607)
signin-wake.service failed on 2026-10-31. Its unit files were deleted when
signin went live and was later retired, but nothing ran reset-failed, so
systemd kept it as LOAD=not-found / failed. host-check's sweep paged it and
dispatched a fix agent every day from 2026-11-05 to 2026-11-08, each time
with an empty journal. #1603 stops the live switch from leaving new ghosts
behind. This clears the existing one, and any later one, with no hand on
the box.

The sweep now runs reset-failed on failed services whose LOAD column is
not-found, writes one journal line for each, and leaves them out of the
paged set. Nothing can start such a unit again, so there is nothing to fix.
A deleted unit file that a live site needs is still caught: the watchdog
probes the site itself.

install-box-alerts.yml installs this on merge (it watches this file).
test-host-alerts.sh: four new checks (a ghost is cleared and never paged
or tracked, and a real failure beside it still pages and is not cleared);
110 passed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 06:30:35 +00:00
CatoandClaude Opus 5.5 4e5a5725a0 fix(ops): an OOM kill no longer takes down the ubuntu user manager (#1606)
* fix(rag): the embed server drops work nobody is waiting for, so one slow page cannot fail the reindex

The 2026-11-07 03:30 loki-reindex ran 15 minutes of "[embeddings] failed: The
operation was aborted due to timeout" and was killed by TimeoutStartSec. The
first user got 384/637 chunks, the second 0/632, with 3.9s of client CPU.

#1594 serialized inference behind one lock. The client aborts a page after
30s, but the server kept computing the abandoned page under the lock, so the
next page queued behind dead work, timed out too and left its own behind.
After the first slow page every page failed.

- embed-server.py checks whether the caller is still connected when it takes
  the lock and between batches, drops the work if not, and logs the drop.
- embeddings.ts pages at 16, the server's own batch, instead of 48: a third
  of the time per request against the same 30s timeout, and a third of the
  wait for a live caller queued behind the reindex.
- scripts/test/embed-server-drops-abandoned.ts runs the real server.py on a
  slow stub model. Against the old server the next caller waited 1761ms
  behind abandoned work; now it does not.

Every deploy syncs server.py and restarts loki-embed when it changed (#1595).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ops): an OOM kill no longer takes down the ubuntu user manager

user@1000.service (the ubuntu account's systemd manager on bitbaum) failed
with "The kernel OOM killer killed some processes in this unit" followed by
"Failed with result 'signal'", and paged as a failed unit. It is the same
failure #1601 fixed for the openclaw manager (user@1001): systemd's default
OOMPolicy=stop stops the whole manager when the kernel kills any one process
inside it.

The deploy step from #1601 now installs the same OOMPolicy=continue drop-in
for both the openclaw and the ubuntu managers. It still writes only the
drop-in and runs daemon-reload (only when a file changed), restarts nothing,
skips users that do not exist, and warns without failing the deploy. The conf
and its guard test drop the openclaw- prefix, since they now cover both; the
test fails if ubuntu leaves the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 06:20:43 +00:00
CatoandClaude Opus 5.5 804d0a2919 fix(hetzner): a site that goes live leaves no failed wake unit behind (#1603)
sync-infra's live branch stopped <app>-wake.service and deleted its unit
files, but stopping a failed unit does not clear its failed state. systemd
then keeps it as a not-found, failed unit that nothing ever starts again,
and host-check's failed-unit sweep reports it as still failing.

signin-wake.service failed on 2026-10-31 (Result: resources, #1491). signin
went live minutes later (#1490). On 2026-11-01 an older retire-site.sh that
did not yet know about wake units retired signin. The ghost unit was still
dispatching an incident on 2026-11-05.

The live branch now runs reset-failed on both wake units before it removes
their files. retire-site.sh --mode delete already does the same.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 06:18:40 +00:00
CatoandClaude Opus 5.5 33cfe39459 fix(ops): an OOM kill no longer takes down the openclaw user manager (#1601)
2026-11-05 07:10 UTC the box ran out of RAM. The kernel OOM-killed
openclaw-gateway (797.5M peak), then its restarts and the user's dbus.
systemd's default OOMPolicy=stop then stopped user@1001.service, the
openclaw user's manager and the only thing that restarts the gateway, so
WhatsApp and the Telegram chat stayed down for more than a day.

Ship a drop-in, user@<openclaw uid>.service.d/10-oom-continue.conf, with
OOMPolicy=continue (same lesson as loki-box-runner, 2026-09-25). Every
deploy installs it with daemon-reload only. It restarts nothing, warns on
failure, and is skipped where there is no openclaw user.
openclaw-gateway-up.sh and doctor-messaging.sh report whether it is in
place. The doctor now asks systemd for the manager's state instead of
trusting the bus socket, which outlives a dead manager.
scripts/test/openclaw-survives-oom.ts guards both halves.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 20:26:46 +01:00
Cato 31d82135f5 fix(ops): do not fail app crons when CRON_SECRET is absent (#1598)
grep exits 1 when the key is missing, and set -e aborted the shared
runner before curl. A daily job whose app does not use the secret
(botsmann /api/rebuild) then paged as status=1 with no HTTP line.
2026-11-06 10:40:15 +01:00
CatoandClaude Opus 5.5 7fddc81f46 fix(deploy): every deploy ships the embed server, so #1594 reaches the box (#1595)
The memory bound from #1594 merged and changed nothing on the box: server.py
and the loki-embed unit were written only by install-fleet-rag.sh, which needs
a laptop's ssh key (and this morning the laptop's agent could not sign). The
unit lived as a heredoc inside that installer, so the deploy had nothing to
ship.

Move the unit to scripts/hetzner/loki-embed.service, have the installer copy
it, and have deploy-hetzner.sh content-sync server.py + the unit, restarting
loki-embed (and waiting on /health) only when one changed. Warn-only, skipped
where the install never ran. scripts/test/deploy-ships-embed.ts guards both
halves.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 07:05:57 +01:00
CatoandClaude Opus 5.5 66e1d48fd2 fix(rag): bound the embed server's memory so a reindex cannot starve the box (#1594)
* fix(rag): bound the embed server's memory so a reindex cannot starve the box

The 03:30 loki-reindex drove loki-embed (ThreadingHTTPServer, one onnxruntime
run per concurrent request, arena never returned) to 2GB, filled swap, and
pushed load to 53. Postgres connects timed out, so six other apps' crons
failed — sbb-fundbuero purge among them — until the OOM killer took the
embed process at 03:33:05.

Serialize inference behind a lock with a small batch size, and give the unit
MemoryHigh/MemoryMax so the kernel reclaims or kills this process alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(test): box-register-follow fixture no longer commits into the real repo

Under the husky pre-push hook the inherited GIT_DIR turned the suite's
`git init` into the pushing checkout: commits "one"/"two" landed on the
branch (emptying its tree) and core.bare=true reached the shared .git/config,
breaking the main checkout. Source git-fixture-env.sh like its siblings, and
add test-git-fixtures-isolated.sh to test:ops so a new fixture suite that
skips it fails instead of becoming the fourth incident.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 05:25:21 +01:00
CatoandClaude Opus 5.5 8454c0acaa fix(ops): cron installer prunes timers for retired jobs (#1593)
fc-cron@nudge-idle kept failing with HTTP 404 every night: the route was
retired on 2026-10-10 (replaced by autopilot-night), but
install-hetzner-crons.sh only ever wrote and enabled timers, so the old
timer stayed on the box calling a route that no longer exists.

The installer now treats SCHED as the whole list: any fc-cron@*.timer on
the box whose name is not in SCHED is disabled, deleted, and its service's
failed state reset. The deploy already re-runs the installer, so the merge
clears the nudge-idle unit with no hand step. test-cron-runner.sh covers
the prune against a stubbed systemctl.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:22:08 +01:00
CatoandClaude Opus 5.5 c9bec3c028 fix(deploy): ship widget/ to the box-runner so loki-reindex can load its imports (#1592)
loki-reindex.service died on MODULE_NOT_FOUND: scripts/reindex-knowledge.ts
reaches src/lib/feedback/tour-token.ts, which imports widget/tour (since
#1534), but deploy-hetzner.sh and install-box-runner.sh never rsynced widget/
into /opt/loki/runner. Ship widget/ alongside src/ and chown it.

scripts/test/runner-ships-imports.ts walks the static import graph from every
runner entrypoint the deploy ships and fails if any reached file is not
covered by a sync_runner line — it reproduces this incident on the old deploy.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 14:49:25 +00:00
CatoandClaude Opus 5.5 e0f98d97f7 fix(box): a sleeping app naps with SIGKILL so a slow stop is not a page (#1590)
SuccessExitStatus=143 only covers a Node that exits within the template's
3s TimeoutStopSec. biaslens-app (2026-11-04) did not: systemd killed it,
recorded Result=timeout, the unit read failed and the nap paged as an
incident. A nap follows 15min with no connection, so nothing is left to
drain; stop sleeping apps with SIGKILL and count it as a clean exit. OOM
kills still read failed (Result=oom-kill comes from the cgroup).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:26:51 +00:00
CatoandClaude c03cecbcfe feat(ops): delete-synthetic-user workflow for OrangeCat's auth server (#1581)
A live check that dies halfway leaves its throwaway account behind, and only
GoTrue's admin API can remove it (orangecat#1533 left one). The workflow finds
the user by an exact match of the email, deletes it with
DELETE /auth/v1/admin/users/<id> using the service-role key already on the box,
and reads the lookup back. Only example.com, example.test and .invalid
addresses are accepted, a second match is never guessed between, and no key is
printed. Tested against a fake admin API in test:ops.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 03:24:14 +01:00
CatoandClaude 32af8519e2 fix(ops): lightning-on finds a monorepo release's receipt (#1580)
kivvi serves apps/web from its release, so its receipt is under
app/apps/web/public, and lightning-on said "no AccountKit in its release".
The receipt is now looked for up to five levels into the release.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 02:40:51 +01:00
CatoandClaude d6fdc750f9 feat(ops): lightning-off, the way back for one app (#1579)
lightning-on all reached every app whose release carries AccountKit 0.26.1+,
including three whose sign-in other work owns right now (aoz-wohnen,
botsmann, vitareba). lightning-off removes the flag from one app and restarts
it; it refuses all.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 01:51:37 +01:00
CatoandClaude 5aa5b318ef fix(ops): lightning-on reads a standalone release's receipt (#1578)
On the box, biaslens's release had no @bitbaum/accountkit/package.json (a
standalone build traces only the files it runs), so lightning-on said "no
AccountKit in its release". The release receipt names the locked version;
it is read first, then the package files as before.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 01:35:25 +01:00
CatoandClaude f387c7a66c fix(backups): an unreachable off-box target fails in minutes, not half an hour (#1575)
The first run of install-backups.yml (#1572) wrote every local dump in 45
seconds, then waited 29 minutes on restic before "restic repo unreachable",
and the job's 30-minute limit cancelled the check after it. It had already
printed all 412 files in /opt/backups/pg at mode 600, the newest dump too.

restic's reachability check now gets 120 seconds, the push an hour and the
prune half an hour, and the job 90 minutes, so a dead target is reported
quickly and the mode check always reports. The off-box target itself is
unreachable and needs its owner (Storage Box); that is not fixed here.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 00:59:19 +01:00
CatoandClaude 3b010a6519 feat(ops): lightning-on switches Lightning login on per app (#1573)
AccountKit 0.26.1 mounts Lightning login (LNURL-auth) only with
ACCOUNTKIT_LIGHTNING=1. app-secrets.yml action=lightning-on adds it to one
app, or with app=all to every app whose running release carries AccountKit
0.26.1 or later, and restarts it. An older copy anywhere in the release holds
an app back; a value someone set is kept; nothing is paired, there is no key.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 00:34:39 +01:00
CatoandClaude fe9f8dc3b6 fix(ops): the passkeys switch waits out the auth restart, and lists www (#1571)
The first apply (orangecat#1533) set the four variables and recreated the
auth container, and passkeys_enabled reads true; but the read-back ran into
the few seconds the restarting server answers 5xx, curl -f failed under set -e,
and the run reported failure. A failed read is now "not yet".

www.orangecat.ch serves the site itself (200, no redirect), so a passkey
ceremony there needs its origin listed; the RP id orangecat.ch covers it.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 00:08:55 +01:00
CatoandClaude Opus 5.5 42435de738 feat(ops): OrangeCat passkeys switch, a workflow for GoTrue's four variables (#1569)
* feat(ops): OrangeCat passkeys switch, a workflow for GoTrue's four variables

OrangeCat's code offers passkeys and hides them while GoTrue says
passkeys_enabled: false. GoTrue's env lives in /opt/supabase/docker, which no
workflow wrote, so the switch could only be thrown by hand (orangecat#1533).

orangecat-passkeys.yml (show / apply / rollback) sets GOTRUE_PASSKEY_ENABLED
and the relying party (orangecat.ch, OrangeCat, https://orangecat.ch) in
.env, passes them through the auth service's environment once, recreates
only that container and reads passkeys_enabled back from the public
settings. An RP id someone already set is never moved: passkeys made for it
would be stranded. Names and verdicts only in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* fix(ops): no grep -q at the end of a pipe in the passkeys switch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 23:43:43 +01:00
CatoandClaude 89914e6096 fix(auth): the cutover's proofs work where an address must be confirmed first (#1568)
AOZ refuses an unconfirmed address at sign-in when mail is configured
(emailConfirmation: 'before-sign-in'). Two proofs would have read that as a
failure:

- switch: the imported legacy proof account was written unconfirmed, so its
  live sign-in would be refused and the switch rolled back. It is now written
  with a confirmed address, as a claimed AOZ account has.
- prove: a fresh sign-up there waits for its mailed link instead of signing
  in. An .invalid address receives no mail, so the journey confirms the
  address as that link would, says so, and signs in.

Vitareba (no confirmation wall) is unchanged: its sign-up signs in at once.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 23:10:37 +01:00
CatoandClaude fc0712e80c feat(box): provider keys pasted in GitHub reach the box, and the shared sign-in switches itself on (#1563)
box-env-keys.yml (reusable) copies the names a caller lists from its
repository secrets into the app's env on the box (box-env-keys.sh: a value
set in GitHub wins, a name GitHub does not hold is left alone, names only
in the log), restarts the app when something changed, and with signin-on
runs app-secrets.sh signin-on all once Morulia lists a provider.

signin-on now skips an app whose AccountKit predates 0.24.0: its button
names a fixed list of providers, which may not be on.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 22:20:57 +01:00
CatoandClaude 7f13d4be0f fix(auth): the cutover's live proof expects a kept account to refuse its own deletion (#1565)
Vitareba (medical records) and AOZ (provisioned identities) create AccountKit
with accountDeletion: false, so /delete-user answers 404. prove expected 200
and would have failed on a correct deployment. It now checks the refusal with
the account and its session intact, then removes the throwaway account from
both tables itself and confirms nothing of it remains.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 22:11:12 +01:00
CatoandClaude 2eb76924d8 fix(backups): nightly dumps are written readable by root only (#1564)
The rehearsal of Vitareba's import read last night's dump and reported it as
mode 644. /opt/backups is 700, so nobody else could open it, but a dump holds
every row of a product, patients' and residents' among them, and one copied
or moved out of that directory keeps its mode. The runner now sets umask 077,
as the AccountKit cutover's own dumps already do.

It reaches the box when install-backups.sh is next run; no workflow installs it.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 22:00:29 +01:00
CatoandClaude 987f77d61b feat(box): an accounts database beside a supabase schema (#1562)
Printcraft and Botsmann keep their data in a schema of the supabase-db
container, which publishes no port, so AccountKit (Drizzle) cannot reach
it. scripts/hetzner/accounts-db.conf (app|database) gives such an app a
second, host database for its accounts, without a new apps.conf column:

- provisionable-db.sh accepts a supabase app with a row, so
  provision-db.yml creates its database, role and DATABASE_URL;
- deploy.sh applies drizzle/ to that database in its own step after the
  schema step; apply-schema.sh takes ONLY_LAYOUT, and a supabase schema
  only ever takes supabase/migrations;
- check-accounts-db.sh (in verify) fails when the file drifts from
  apps.conf: unknown, archived, non-supabase, misnamed, duplicate or
  colliding rows;
- accountkit-supabase.yml / accountkit-supabase.sh survey, rehearse
  (always rolled back) and import an app's GoTrue people as AccountKit
  accounts under their old ids, linked to OrangeCat by actor id, never by
  address. Counts only; nothing empties a table.

test-accounts-db.sh (in test:ops) covers the register, the gate, the
layout split, the deploy order and the import's refusals.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 21:53:29 +01:00
CatoandClaude Opus 5.5 6e0944d620 feat(auth): the AccountKit switch for Vitareba and AOZ, with a restore-proven rehearsal (#1560)
* feat(auth): the AccountKit switch for Vitareba and AOZ, with a restore-proven rehearsal

Vitareba (patients) and AOZ (residents) keep their accounts in their own
tables, so accountkit-switch.sh's survey and proofs do not fit them, and its
rollback empties the shared tables. scripts/hetzner/accountkit-cutover.sh
serves both from the same workflow:

- survey: counts per schema (Vitareba's Google-only patients among them),
  the shared tables' counts and a 12-character digest of who may do what.
- rehearse: last night's box dump (or one made now, mode 600) restored into
  a temporary database; the product's import SQL run there with a throwaway
  legacy account, counts printed, rolled back, the database dropped. It fails
  if an imported hash differs from its source, is in a format AccountKit
  cannot read, or the proof account's imported bcrypt hash does not verify.
- switch: a fresh dump, rehearsed first; the app stopped for the import so no
  legacy write lands after it; AUTH_RUNTIME=accountkit; then, on the public
  site, the imported proof account refuses a wrong password and signs in with
  its own, and the role digest is unchanged. Any failure rolls back.
- rollback: AUTH_RUNTIME emptied and a restart. No table is emptied.
- prove: sign up, sign out, a wrong password refused, sign in, delete, with
  an .invalid account, checking no row of it remains.

Tested locally on both products' committed migration chains with synthetic
rows: survey, rehearse, and a switch whose proof fails and rolls back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* test(auth): the switch check covers the cutover script and its guarantees

The workflow now offers Vitareba and AOZ and the rehearse action, served by
accountkit-cutover.sh; the check reads both registers and both action lists.
For the cutover it also refuses an unknown action and an unregistered app,
finds no TRUNCATE and nothing in rollback but emptying AUTH_RUNTIME, a dump
written 600 from its first byte, and no proof secret echoed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 21:34:32 +01:00
CatoandClaude 6704b56636 feat(auth): GitHub signs in on AccountKit through Loki's own GitHub app (#1551)
Loki's GitHub sign-in, and the repo and workflow grant "Start a new
project" acts with, waited on the bitbaum sign-in getting provider
credentials. AccountKit 0.22 brings a product's own GitHub app across at
its existing callback: GitHub is offered again on this runtime, with
githubScopes repo and workflow; a signed-in person pressing GitHub links
it ("Connect GitHub"); a new link's token goes to Loki's accounts, where
the GitHub features read it. GitHub links made under Auth.js are recorded
in AccountKit's table (the import, and migration 0133 on the switched
box), so they sign the same person in. The deploy's provider check
expects GitHub when the box has the app.

Also: prove's real-inbox step retries mail.tm when several proofs run at
once.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 16:13:09 +01:00
CatoandClaude 0bdf3d79b4 feat(ops): prove a real password reset, and Loki's OrangeCat token (#1546)
prove now also runs a real password reset on every switched product: the
product's own forgot-password page, the mail in a real inbox (a
throwaway mail.tm address), its link, a new password set on the
product's reset page, and that password signing in. On Loki, after the
real OrangeCat sign-in, the token it left in Loki's accounts is checked
against OrangeCat's userinfo, as publish needs. Nothing printed names an
address, a link, a password or a token.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 09:21:56 +01:00
CatoandClaude Opus 5.5 18d34dff0a fix(notify): OpenClaw jobs send only what has one tap; close the review's critical/high findings (#1542)
* fix(openclaw): every scheduled job sends only what has one tap, else NO_REPLY

On 2026-11-02 the chat still carried OpenClaw's own messages that fail the
owner's test: "Invoice / Payment Alert … if credit card is on file, no
action needed", "Gateway was not running. Restarted automatically. All good
now." The scheduled jobs' prompts live only on the box, so:

- contract.md: one short block appended (between markers, replaced on each
  install) to every enabled job except the day plan: send only what needs
  him, each item with the ONE link that does it, never status or counts, and
  reply exactly NO_REPLY when nothing passes — OpenClaw's documented silent
  token, which suppresses delivery.
- The installer lists, by path only, every file on the box that calls the
  Telegram API or says "restarted automatically", so the remaining sender is
  found from the public log without printing anything private.
- Notices carry no machine name ("orangecat-cat · …"); the source stays on
  the list row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* docs(telegram): register the day-plan installer (it only searches for senders)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* fix(notify): close the review's critical and high findings

An independent review of the messaging system found real defects; these
are the ones that lose an urgent message, send a wrong one, or wake him:

- Intrusions could be dropped: the caps held urgent notices, every SSH
  password login shared one dedupe key, and /api/notify/box answered 200
  when nothing was recorded, so the box never used its direct fallback.
  Urgent notices skip the caps, intrusion lines are keyed on the whole line,
  and the route answers 503 when an urgent line was not delivered.
- A link chosen by an email could become a trusted one-tap button. Buttons
  now open only own domains, Gmail, Google Calendar, GitHub or Hetzner.
- Long titles/labels or a fourth button dropped real notices into the list;
  they are clipped instead. Only a missing or unsafe action refuses.
- SSH login from a new address and edits to authorized_keys/sudoers/shadow/
  PAM/ld.so.preload are intrusion signs (both lists, kept equal by test);
  the button opens /today, where the notice is listed; the title names the box.
- Customers' escalations and capped goals reached the owner's chat
  (selfTelegramTarget); they now use telegramTargetFor. The gateway-down
  message went once per fleet account; it is sent once.
- The notify routes accept bearer tokens only (no browser session/CSRF).
- countDeliveries ignored rows older than a week; it no longer does.
- Night silence (22:00–07:00 Zurich) for the direct senders too: lib-alert's
  fallback, ivy-health, fleet-uptime, deploy-hetzner. ivy-health names what
  broke and offers Redeploy only when Loki's app is the failure, Box doctor
  otherwise, and reads the chat id from the box's telegram.env.
- Prompts: the day plan no longer asks for approve links it cannot get or a
  page it cannot open, never uses links found inside emails, and says when a
  source failed. The summaries he asked for (reflection, digests, scorecard,
  evening wrap) get a digest contract instead of being silenced; jobs with no
  text prompt are left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* feat(day-plan): one morning message; the email scanner twice a day

Approved by the owner 2026-11-02. The day plan now carries a half-line on
each person he meets today, and the separate 07:30 "Meeting People Brief"
is switched off. The email deadline scanner runs at 08:00 and 17:00 instead
of four times a day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 08:46:52 +01:00
CatoandClaude Opus 5.5 f8da012c95 feat(notify): Telegram only with a one-tap action — one gateway for every bot (#1540)
* fix(alerts): stop paging on transient systemd-run units; send digests silently

The 5-minute host sweep announced every failed one-off systemd-run unit
(run-p<pid>-i<id>) as its own incident. Each has a fresh name, so no
per-unit cooldown held and the phone rang every five minutes.

The sweep now resets those units and never announces them, and the
STILL FAILING / RECOVERED digests are delivered with disable_notification.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* fix(alerts): quiet by default, ring only for down/intrusion; stop deploy and cron echoes

- lib-alert: all box alerts deliver silently except DOWN/deploy failure/
  intrusion-class messages (_alert_silent)
- host sweep: failed appcron oneshots are the OnFailure notifier's, not repeated
- security check: files a deploy rewrites by design are journal-only

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* ci(box): install the alerting scripts on the box when they change

The alert fixes only take effect once install-host-alerts.sh and
install-security-watch.sh run on the box, and nothing ran them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* feat(notify): one tap or not at all — every bot reaches the owner through one gateway

The owner's Telegram held ~1,200 unread messages and rang every five minutes
with lines he could do nothing with ("STILL FAILING: run-p…", "SENSITIVE
FILE(S) CHANGED … if this was a deploy, ignore", "built nothing"). New rule,
enforced in code: a message reaches the phone only with a button that does
the thing; everything else is recorded on /today or /system.

- telegram-send: refuses a message without a URL button (NOT_ACTIONABLE);
  adds silent delivery and sendTelegramVoice.
- lib/notify: one gateway (deliverNotice) with the policy — at most 3
  buttons, one incident one message with backed-off reminders, 3/source/hour
  and 12/day caps, sound only for "now" and never 22:00–07:00 Zurich. Voice
  notes for paid plans; a monthly "voice notes come with Personal" notice
  with its pay button for free accounts.
- Routes: /api/notify (token holders, `loki.sh notify`), /api/notify/box
  (the box's lib-alert), /api/orangecat/notify (OrangeCat's bots, signed).
- Box: lib-alert posts every line to Loki's list instead of Telegram; only an
  intrusion goes straight to the phone when Loki is unreachable, with a Box
  doctor button. ivy-health pages only "down and restart failed" with
  Redeploy; clean deploy rollbacks are not paged; fleet-uptime pages only for
  Loki or 3+ apps down; sleeping apps are no longer conformance findings.
- App senders: each kept one now carries its button (Triage it, Review it,
  Watch the fix, Write to them, Restart the gateway, Decide on Control …);
  telemetry/runner/model-id pings and run successes leave Telegram.
- Day plan: the morning brief's prompt is in the repo
  (scripts/openclaw/day-plan) and installed on merge, which also switches off
  jobs that only post swap/memory warnings.
- Workflows install the box alerting, ivy-health, the day plan and OpenClaw's
  photo/video understanding on merge instead of by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* feat(telegram): every sender is silent between 22:00 and 07:00 unless it says otherwise

Feedback, studio briefs and the other direct senders skipped the notify
gateway's quiet hours. A send that does not ask for sound now arrives
silently at night in the owner's zone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 07:04:45 +01:00
CatoandClaude 33e6a4b8dc fix(app-secrets): restart an app only when it is running (#1538)
On 2026-11-01 an `ensure` for keller wrote its OrangeCat client and then
failed the run: keller-app exists (registered 2026-10-29) but keller has
never been deployed, so there is no release to start, and the restart
exited 1. apps.conf lists keller as a prospect; it is meant to stay off.

The restart now asks `systemctl is-active` instead of `systemctl cat`. A
unit that is not running is left alone and the run reports that its next
start reads the new values, the same promise as for an app with no unit.
A running app is restarted exactly as before. test-app-secrets.sh pins
the stopped-unit case (26 pass).


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 23:39:49 +01:00
CatoandClaude d719ff00ca fix(app-secrets): no fixed switch-on of the shared sign-in; only signin-on (#1537)
#1531 added SIGNIN_ISSUER/SIGNIN_CLIENT_ID literal rows for petvity and
surf-your-life, and #1533's merge of main carried them in. Any `ensure` for
those apps would show the Morulia button while Morulia lists no provider.
The rows go (the pairs stay), and a test now fails on any registry row that
sets either name: signin-on, which refuses without a provider, is the only
writer. Same intent as #1536, which no longer applies cleanly after #1533.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 22:35:08 +01:00
CatoandClaude f6954978d7 fix(box): accountkit-switch rollback refuses to empty the only copy of a credential (#1535)
rollback empties the shared auth_* tables, which was safe while they held
only copies of the product's own rows. Once a product renders AccountKit's
own screens (petvity and surf-your-life now do), those tables hold the only
copy of every password set through AccountKit, every passkey and every second
factor. rollback now counts those first and refuses on any, naming the safe
path: revert the product's screens pull request.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 22:14:32 +01:00
CatoandClaude 2c0d8b737d feat(app-secrets): every sign-in page is a Morulia and an OrangeCat client (#1533)
Three things, all in the one registry that writes secrets nobody holds:

- morulia pair rows for the 13 apps bitbaum/morulia#21 adds (every fleet app
  with a sign-in page, fleet docs/auth-parity-2026-11-01.md), so `ensure
  morulia` gives each its SIGNIN_CLIENT_SECRET.
- a new kind, oc-client:<id>, for "Sign in with OrangeCat" in the ten apps
  that had no OrangeCat client. It writes ORANGECAT_OAUTH_CLIENT_ID/_SECRET
  into the app's env first, then the secret's sha256 into OrangeCat's
  oauth_clients row (created switched off by orangecat's deploy) and switches
  it on. A row holding a secret the app lacks is reported, never replaced.
  Nothing is printed but names and states.
- an action, signin-on <app|all>: adds SIGNIN_ISSUER and SIGNIN_CLIENT_ID
  beside the paired secret and restarts the app. It refuses while Morulia's
  /api/health lists no provider, so the button can never lead to an empty
  page. Ready for when the provider keys are in.

test-app-secrets.sh: 25 checks (11 new), including that neither a secret nor
its hash is printed.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 22:13:30 +01:00
CatoandClaude 24e27d25fa feat(box): the shared sign-in for petvity and surf-your-life (#1531)
Both apps move onto AccountKit's own sign-in screens, which offer Morulia once
SIGNIN_ISSUER, SIGNIN_CLIENT_ID and SIGNIN_CLIENT_SECRET are set. The client
secret is a pair with Morulia's SIGNIN_CLIENT_SECRET_<ID> (bitbaum/morulia
lib/clients.ts rows); the issuer and id are literals.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 21:21:26 +01:00
CatoandClaude Opus 5.5 bf448e39f2 ops(register): follow main from a shallow checkout (#1526)
* ops(register): a refused follow says where the two histories meet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* ops(register): follow main from a shallow checkout

The box's loki checkout is a shallow clone (52 grafts). A fetch into it
stops at the old boundary, so HEAD (c65ead0f6, 2026-10-07, an ancestor
of main) and main shared no history there and the follow refused with
335 'local' commits. Deepen the fetch past HEAD's date, then judge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:38:01 +01:00
CatoandClaude a85a2d15ee fix(ops): show every refusal code the OrangeCat proof lands on (#1525)
Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:32:54 +01:00
CatoandClaude 81f920a108 chore(register): the leftover signin database is gone (#1523)
Dropped with drop-db.yml (run 41335134500): 0 users, 0 sessions; its
rows were one schema-history row and the 7 OIDC client registrations
morulia holds for itself. The role went with it. The morulia row's
comment no longer says the database is on the box.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:26:33 +01:00
CatoandClaude Opus 5.5 cc8672d665 ops(db): drop-db counts the rows before it drops (#1522)
* ops(db): drop-db counts the rows before it drops

The dry run said tables and size, not whether anything is in them.
signin has 13 tables and 8 MB; 'it holds no users' is now a count in
the log (exact, one count(*) per table, summed), not an assumption.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* ops(db): name the tables that hold rows, with their counts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:25:16 +01:00
CatoandClaude ddbd95303d ops(register): bring the box's register to main; retire a site main already removed (#1520)
register-drift reported orangecat-2 only in the box's register, and six
rows main had since corrected: the box's loki checkout sat on a
2026-10-07 commit, because only register-site.sh ever fast-forwards it.

- box-register.yml + box-register-follow.sh: the same adoption, on its
  own. Fast-forward only, from the public repository URL; refuses while
  the box holds a row main lacks, a local commit, or a change beyond
  apps.conf. Plan by default; keeps the old register in the home dir.
- retire-site.sh, delete: also removes the row from the box's register.
  Run from the workflow it removed it from the runner's copy only, which
  is how orangecat-2 (retired 2026-10-17) stayed on the box.
- retire-site.sh, offline and delete: stop the wake socket too. A site
  that sleeps when idle kept its socket listening on its port, and any
  local request woke the app again.
- retire-site.sh: --no-github (no repository, workflow or secret step)
  and --keep-data (delete keeps /opt and the checkout); RETIRE_LOOK=1
  prints what is on the box before the plan.
- retire-site.yml: github and keep_data inputs, the look, and a site
  that only the box's register still has is judged by that row.

Tests: test-box-register-follow.sh (new, in test:ops) and
test-retire-site.sh (12 more checks).


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:19:15 +01:00
CatoandClaude c84a57a62e fix(ops): name the product's refusal code when the OrangeCat proof is refused (#1519)
Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:13:06 +01:00
CatoandClaude f4418172a8 ops(register): name the columns a drifted row differs in (#1518)
register-drift.sh said only port and status for a differing row, so
biaslens, kivvi and vitareba (same port, same status on both sides) were
reported with nothing to go on. It now names every column that differs,
with both values. The workflow also prints the box checkout's branch,
distance from main and changed paths, as context for a red run.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:08:12 +01:00
CatoandClaude Opus 5.5 089235bb46 fix(register): biaslens has a host database (#1517)
* fix(register): biaslens has a host database

The box's register says biaslens's db column is biaslens; main said '-'.
The box is right: register-site.sh provisioned the database there, and
biaslens.orangecat.ch/api/health reports its accounts ready, which needs
DATABASE_URL. With '-' every deploy skipped the app's schema step. Found
by register-drift (only biaslens's db column differed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* docs(register): say which deploys read main's biaslens row

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:07:01 +01:00
CatoandClaude 9597e1f75d ops(db): a dispatch-only workflow that drops one leftover host database (#1516)
Nothing dropped a host database: retire-site.sh keeps a site's data by
design, so signin, renamed to morulia, left its empty database behind.
drop-db.yml drops exactly one, and refuses unless the register and the
box both say nothing can still mean it:

- droppable-db.sh, against main's register and the box's checkout of it:
  not a system database, no row named after it, no row's db column
  using it;
- drop-db-on-box.sh, on the box: not a template, no env file under /opt
  naming it in DATABASE_URL, no open connection. Then the database, and
  the role of the same name if Postgres lets it go.

An empty confirm is a dry run; confirm must repeat the name to drop.
Names, counts and sizes only in the log. Tested in test:ops
(test-drop-db.sh).


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:05:50 +01:00
CatoandClaude 5a1c34981d feat(ops): prove the account journeys live on a switched product (#1515)
A prove action for accountkit-switch.yml, with throwaway accounts deleted
again: two sessions, a row change read on the next request, a password
write ending every session (old refused, new accepted), sign-out and
deletion. Where the product offers OrangeCat, a real browser sign-in
with a throwaway OrangeCat account through OrangeCat's sign-in and
consent and back. This replaces the approved test identity the switch
docs waited on.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 18:56:01 +01:00
CatoandClaude 281540c4bf feat(ops): an AccountKit switch per product, with a live proof and rollback (#1510)
Five products stage AccountKit beside Auth.js behind AUTH_RUNTIME. This is
the switch, from GitHub over the deploy's SSH, one product per run:

- survey: counts only, including people whose only way in is a social
  provider AccountKit cannot reach yet (they would be locked out);
- switch: refuses while that count is above zero; imports under locks with
  the product's own accountkit-import.sql, ensures a 32-character
  BETTER_AUTH_SECRET, sets AUTH_RUNTIME=accountkit, restarts, then proves
  on the public site that AccountKit answers and a throwaway account signs
  in, reads its session and signs out (deleted after); any failure rolls
  back;
- rollback: AUTH_RUNTIME off, restart on Auth.js, mirrors dropped, shared
  tables emptied.

The log is public: counts and verdicts only. test-accountkit-switch.sh joins
test:ops.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 17:15:29 +01:00
CatoandClaude 6628a951d4 ops(register): remove the retired signin row (#1505)
retire-site.sh --mode delete cleared signin from the box on 2026-11-01
(run 41293394217): unit, vhost, /opt/signin, checkout and watchdog
target. The rename guard skipped every GitHub step, so bitbaum/morulia
kept its workflows and deploy key. Port 4040 is free again. The host
database `signin` is still there; the morulia comment says so.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 10:42:34 +01:00
CatoandClaude 6859c7271e ops(register): the shared sign-in is morulia; signin is archived (#1504)
bitbaum/signin was renamed to bitbaum/morulia (fleet #413) before any app
used it. The service moves to morulia.orangecat.ch:

- apps.conf: a morulia row (port 4041, db morulia, live). The signin row
  is archived so no sync regenerates it; it goes once retire-site --mode
  delete has cleared the box.
- app-secrets.sh: the registry entry is morulia, SIGNIN_URL is
  https://morulia.orangecat.ch, same seven pair lines. With morulia's
  side empty and each app holding its SIGNIN_CLIENT_SECRET, ensure copies
  the app's value over; nothing is regenerated.
- retire-site.sh: a renamed repository still answers under its old name,
  so retiring signin would have disabled morulia's workflows, removed its
  deploy key and, with --repo archive, archived it. Every GitHub step is
  now skipped when the repository belongs to another name. Tested.
- provision-db tests and examples name morulia.

The SIGNIN_* env names stay: they are generic.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 10:21:06 +01:00