Commit Graph
191 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 656f643b4e chore(hetzner): drop surf-your-life embed-backfill timer (#1089)
It needs a paid OPENAI_API_KEY the box does not have, answered 503 every
night and paged as a failed unit. Background AI spend is off fleet-wide
(the ai-digest row above was dropped for the same reason). Already
disabled on the box; this stops a reinstall from bringing it back.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:26:11 -07:00
CatoandClaude Opus 5.5 f6b9dd701f fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs (#1087)
* fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs

Sleep-when-idle stops the app with SIGTERM when its proxy idles out, and
Node exits 143. Without SuccessExitStatus systemd recorded that as
Result=exit-code, so every nap read as `failed` and paged Telegram as
"DOWN" quoting the boot banner, then "RECOVERED" on the next visit — ~10
sites flapping all day, burying real alerts. The generated app unit now
counts 143/SIGTERM as a clean stop; the test pins it (mutation-checked).

ivy-health.sh was box-only and still checked fleetcrown-app/-bridge and
the retired OpenClaw gateway, paging "DEGRADED (restart failed)" every 4h
for units that no longer exist. Versioned here, now heals postgres and the
loki-* units and probes loki-app /api/health; installed on the box.

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

* docs(telegram): register ivy-health.sh as a sender

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

* chore(hetzner): ivy-health history without the retired name

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:14:22 -07:00
CatoandClaude 57cf15e6ba fix(deploy, projects): a hung page check no longer holds a deploy for 45 minutes; a closed run no longer reads "Building now" (#1079)
Deploy (every fleet site, via selfhost-deploy.yml):
- page-check.mjs gets one 90s deadline for the whole look. On a host that
  accepts and never answers, goto gave up at 45s and the next call waited
  on the pending navigation forever; farmaciadelparco's deploys #3 and #4
  sat in "Look at the live page before the deploy" until the job's 45m
  limit. Verified against a never-answering socket: records "did not load"
  at 90s and exits 0; a normal page still checks in ~3s.
- timeout-minutes on both page-check steps as the backstop.

Project page:
- deriveBuildStatus: agent_running=t is a live process, not a live build.
  After a run closes Claude Code idles at its prompt, so the page said
  "Building now · An agent is working" beside "Finished · PR #1 merged".
  Building now needs an open run, or a prompt given after the last close.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 13:15:24 -07:00
CatoandCato 2f9a13ebfa chore(register): add farmaciadelparco (#1075)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-10-07 11:25:09 -07:00
CatoandClaude Opus 5.5 c9044a8151 feat(sites): sites that are not live yet sleep when idle (#1066)
* wip(sites): sleep-when-idle building blocks (not wired in yet)

Adds the status list and idle time (_box-env.sh) and the pure generators
(lib.sh: sleeps_when_idle, wake_inner_port, sleep_app_unit, wake_socket_unit,
wake_proxy_unit). Nothing calls them yet: sync-infra.sh is unchanged, so no
site's units change. Wiring them in waits on the owner's go-ahead.

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

* feat(sites): sites that are not live yet sleep when idle

Every site ran around the clock with up to 1 GB, which capped the 16 GB box at
roughly 50 sites however rarely they were visited. A site whose register status
is prospect, demo, validating or unverified now sleeps: systemd listens on its
port, the first request starts it (a second or two), and it stops after 15
idle minutes. Live sites (clients, products, evig, the 4001-4004 services) are
untouched; a row that becomes live is switched back to always on on its next
sync.

- sync-infra.sh: for a sleeping row, the app listens on port+20000 and is bound
  to <name>-wake.service (systemd-socket-proxyd --exit-idle-time) behind
  <name>-wake.socket on the public port. Caddy and deploy.sh keep talking to
  127.0.0.1:$PORT, so neither changes; a deploy's restart pulls the proxy up.
  Falls back to always on, out loud, if the box's proxyd lacks idle exit.
- install-watchdog.sh: a sleeping site is checked by its socket, not by a
  request every 5 minutes (which would keep it awake forever).
- uptime-sweep.sh: sleeping sites are health-probed on the first sweep of
  00/06/12/18 UTC instead of every 15 minutes, so botsmann's kind of outage
  is still caught within hours; certificates are still checked daily.
- Sync sites workflow: re-applies sync-infra.sh to named sites and checks each
  one answers — the rollout for sites already on the box.

Tests: test-sleep-when-idle.sh runs sync-infra and the watchdog installer end
to end against a recording ssh; test-uptime-sweep.sh covers the 6-hourly probe.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 07:01:59 -07:00
CatoandClaude Opus 5.5 5aa521e08d feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch (#1065)
* feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch

A site starts on <slug>.orangecat.ch. When its owner buys a domain, Loki can
now make that domain the site's address: the domain (and www. when it points
here) is served, the free address answers with a 308 to it, and the project's
live URL, production URL and widget origin list follow. Nothing the visitor
sees says where the site is hosted, and the site stays one repo, one Loki
project, on the same box.

- lib.sh caddy_vhost: the one rule for what a row's domains field means. A
  row mixing an own domain with its free host serves the own domain and 308s
  the free one. sync-infra now calls it; every existing row's vhost is
  byte-identical (pinned against the real register in test-custom-domain.sh).
- attach-domain.sh <slug> <domain> | --detach: checks DNS first (A to the box,
  no stray AAAA) and refuses with the exact records when it is not set —
  Caddy would otherwise retry a failing certificate for hours while the free
  address already redirects there. Edits the row, publishes it to main via
  the shared publish_register_row (moved out of register-site.sh), syncs,
  waits for HTTPS. Refuses the handcrafted 4001-4004 services (evig among
  them) whose Caddy blocks are hand-written.
- GET/POST/DELETE /api/projects/[id]/domain + an "Own domain" panel next to
  the live link: type the domain, see the records and whether they are set,
  connect, or go back to the free address. Studio-box gating is the same as
  site registration; everyone else gets the command.

Docs: docs/infrastructure/custom-domains.md, including why sites are not
hosted inside OrangeCat (removed 2026-08-27) and the two things a site's own
code may still need after a move (metadataBase, OrangeCat OAuth redirect URIs).

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

* fix(env): document LOKI_SITES_IP / LOKI_SITES_IPV6 in .env.example

env-example-covers-src requires every variable src/ reads to be named there.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 05:53:32 -07:00
CatoandCato 446549564e chore(register): add orangecat-2 (4035) (#1064)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-10-07 05:28:01 -07:00
CatoandClaude Opus 5.5 0fd886de8d fix(schema): new tables in a PostgREST schema are not public by default; refuse a deploy that leaves one readable (#1054)
apply-schema default-granted ALL on every future table in an app schema to
anon and authenticated (copying printcraft's posture). A migration-created
table has RLS off, and the anon key ships in the browser bundle, so every
new table was readable and writable by anyone through PostgREST. Found live
2026-10-06: botsmann.consultations (visitors' names, emails, messages) —
closed by hand on the DB and in botsmann#221.

- Default privileges: tables and sequences to service_role only. A table the
  anon key should reach grants it (or RLS + policy) in its own migration;
  forgetting now fails with 'permission denied' instead of publishing data.
- refuse_public_exposure on both supabase exits: a table PostgREST serves
  that anon can SELECT with RLS off fails the deploy, with the fix printed.
  Checked live: botsmann and printcraft schemas return no open tables.
- Tests: 5 new checks (54/54); reverting the default grant fails 2.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:44:30 -07:00
CatoandClaude Opus 5.5 63f1ebf4fa ops(xhiva): xhiva.orangecat.ch is the preview's name; the long one stays as an alias (#1053)
The operator, through the site's feedback button: "why not just xhiva.orangecat.ch".
The agent traced it here (its audit D8): the hostname is this row's domains column,
applied to Caddy by sync-infra.sh. Wildcard DNS already resolves.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:40:38 -07:00
CatoandCato a6453cf574 chore(register): add xhiva-art-refresh-300d1519783b47d3ab1c7ddb77c5febf (4032) (#1017)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-10-02 11:20:14 -07:00
CatoandClaude Opus 5.5 0c6e05508e fix(ops): a site that hangs is DOWN, not up; raw sql Date comparisons fixed (#996)
loki.orangecat.ch was down ~06:00-07:53 UTC on 2026-10-01 (next-server
alive, no listening socket; Caddy 502 after 20s) and nobody was paged. The
watchdog's curl times out at 15s, prints 000 itself, and the fallback
'|| echo 000' appended another: "000000" is neither "000" nor a number, so
check() kept the site UP. Any app that hangs rather than refuses was invisible.
check() now counts UP only on a proven 2xx/3xx; test-watchdog-check.sh runs the
shipped check() against a fake curl (old code fails timeout/refused/garbage).
The deploy verifiers had the same append (failing closed) and are normalised.

Also from the same journal: closeStaleAgentTurns threw ERR_INVALID_ARG_TYPE
every hour — postgres-js cannot serialise a Date in a raw sql fragment. Same
shape in the calendar overlap, the digest previous window and two more;
all now use lt/gt/gte, and no-raw-sql-comparisons.ts keeps it that way.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 01:23:15 -07:00
CatoandCursor 231701fc78 feat(crons): daily Solon Places import timer (#994)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 12:42:38 -07:00
CatoandCato 0e97c5e64e chore(register): add zurich-sublet-compliance-concierge-service (4031) (#953)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-28 04:43:18 -07:00
CatoandClaude Opus 5.5 e727405020 fix(sites): new sites skip ports in use; private sites' deploys are actually gated on CI (#948)
Found by the untouched end-to-end test (probe-loop2):

1. Registration took the next port after the register's highest. annushka's
   enquiry API has held 4030 for days with no register row, so the new site
   got 4030, crash-looped on EADDRINUSE and every deploy rolled back. Ports
   something already listens on (ss -Htln on the box) are now skipped, and
   the skip is said out loud.

2. selfhost-deploy's CI gate reads the commit's workflow runs with the job
   token. The org default token is read-only on contents, and a private
   repo's Actions runs are not public, so the call was refused on EVERY
   private deploy and read as "API unreachable — passing open": no private
   site was ever gated on CI (farmhouse too). Both deploy.yml templates now
   grant actions: read; a shim without it is rewritten on the next
   registration; the gate now says "NOT gated" with the fix instead of
   blaming the network.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 13:54:04 -07:00
CatoandClaude Opus 5.5 2cdc648145 fix(sites): a new private site's CI can ship it; registration clears every message it wrote (#946)
* fix(sites): a new private site's CI can ship it; registration clears every message it wrote

The site template's ship job granted its token only actions:write. A
job-level permissions block switches everything else off, so on a PRIVATE repo
checkout answered "Repository not found": CI went red on main, the fleet
sweep never ships a red main, and a brand-new site stopped one step before
going live (probe-loop, 2026-09-26). contents:read added to the template and
to loki's own ship job; ci-jobs-can-read-their-repo.ts fails any job that
checks out without it.

isRegistrationNextStep missed the deployment verdicts from
site-cd-deployment.ts, so Farmhouse kept telling its owner "Deployment
failed" after it was live. The test now collects every reason sentence from
the source and requires the matcher to know it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(cron-runner): free ports and a subshell that always records its exit

Several sessions run verify on one machine at once; two runs on the fixed
ports 4997/4998 answered each other's jobs, and the retry subshell inherited
errexit so a failing job never wrote its rc file. The retry case failed
twice in one day. Four parallel runs: old test 1/4 pass, this one 4/4.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 13:20:39 -07:00
CatoandClaude Opus 5.5 5c5d201426 feat(deploy): every site deploy looks at the page on a phone before and after, and rolls back if it got worse (#943)
A green deploy proved only that the site answered 200: an agent's change could
pass its checks and still leave the page scrolling sideways on a phone,
throwing in the browser, with broken images or most of its text gone, and on
autopilot nobody looks. The shared self-host deploy now reads the live page in
headless Chrome at 390px before and after shipping (page-check.mjs); if the
change ADDED any of those problems (page-check-compare.mjs), it rolls back to
the previous release and fails with the reasons. No baseline is never a
regression, and a checker that cannot run warns instead of blocking.
Screenshots are kept as an artifact for 14 days.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 12:50:55 -07:00
CatoandClaude Opus 5.5 3829e63cb9 chore(register): retire aoz-demo — the AOZ demo moves back onto aoz.orangecat.ch (#941)
George's decision 2026-09-26, relayed by the aoz session: no separate demo
instance. Removes the apps.conf row (port 4028, db aoz_demo) and its nightly
reset-demo cron. aoz-wohnen is unchanged. The box teardown (unit, timer,
Caddy vhost, database, /opt/aoz-demo) is done from the aoz session once this
is merged, so sync-infra cannot re-create it. test-demo-instance.sh keeps its
guard that no non-demo app carries the reset route; zero demos is now valid.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 12:37:44 -07:00
CatoandClaude Opus 5.5 4c9b13aa65 fix: a Claude dialog no longer holds runner updates; repeating an owner note retries it (#939)
* fix(drain): a Claude session showing a dialog does not hold runner updates

A dialog over an empty composer holds no work a restart could lose, but the
drain read Claude's "waiting" as working. Farmhouse sat on "Teach auto mode
about your environment?" and held every runner update for the whole cap —
including the one that clears such dialogs. session_status now reports
"dialog" for waiting + waitingFor dialog; a permission prompt mid-task is
still work.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(feedback): the owner repeating a note retries it instead of dropping their pass

A repeated note was de-duplicated onto the earlier row and answered as a
visitor's, so the widget concluded the pass was bad and forgot it. The pass
is now checked before dedupe: the owner's repeat starts a failed attempt
again, and one already running answers "On it".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 04:47:36 -07:00
CatoandClaude Opus 5.5 1a3e087700 chore(crons): substrata data-quality run every six hours at :41 (#936)
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 00:36:06 -07:00
CatoandClaude Opus 5.5 cf0dc57d42 fix(infra): registration sets HETZNER_IP on the repo so private projects can deploy (#933)
Free-plan orgs expose org variables to public repos only; Loki provisions
private by default, so Farmhouse's Deploy failed with no box address.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 23:16:32 -07:00
CatoandClaude Opus 5.5 f34c15cd62 fix(infra): aoz-demo serves at aoz-demo.orangecat.ch, which resolves (#931)
demo.aoz.orangecat.ch did not: *.orangecat.ch covers one label only, and
aoz.orangecat.ch is its own DNS node, so the deploy's final check failed
with "does not resolve — DNS gap". Checked against 1.1.1.1:
aoz-demo.orangecat.ch -> 167.233.22.31, demo.aoz.orangecat.ch -> nothing.
Only the domain field changes.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 22:53:44 -07:00
CatoandCato 97200d1d4f chore(register): add farmhouse (4029) (#927)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-25 18:57:16 -07:00
CatoandClaude Opus 5.5 f76e6bf212 chore(infra): register aoz-demo, a no-account AOZ demo that never takes aoz-wohnen's push hook (#922)
- apps.conf: aoz-demo|4028|demo.aoz.orangecat.ch, kind demo, owner bitbaum
  (same aoz-begleitung checkout as aoz-wohnen; not a client app).
- install-push-deploy: a demo sharing its repo with a real app is skipped.
  install_hook REPLACES the marked block, so the last row sharing a repo
  won; appended after aoz-wohnen, the demo would have made every push to
  aoz-begleitung deploy the demo instead of the app.
- install-app-crons: nightly /api/cron/reset-demo for aoz-demo ONLY (the
  route truncates the database).
- test-demo-instance.sh (in test:ops): the push-hook guard, and reset-demo
  registered only on a kind=demo app, never aoz-wohnen.

Requested by the aoz session (box side: DB, env, sync-infra, crons is
theirs). No box changes here.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 09:59:01 -07:00
CatoandClaude Opus 5.5 bb9e1a8920 fix(hetzner): launch.sh binds HOSTNAME from BIND_HOST, default stays 127.0.0.1 (#910)
Solon returned 500 for ~30 min: Next 16 standalone + a middleware rewrite
behind Caddy's X-Forwarded-Proto: https fails with 'Failed to proxy
https://localhost:4018/en ... EPROTO' when HOSTNAME=127.0.0.1, because Next
normalises 127.0.0.1 to localhost. An app can now set BIND_HOST in its .env.
The test renders and runs the template for both cases plus a negative control.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:49:38 -07:00
CatoandClaude Opus 5.5 d8be79786c fix(runner): one OOM-killed child no longer stops the runner and every agent in it (#908)
2026-09-25 10:53: the box ran out of RAM during a heidi deploy, the
kernel OOM-killed one chrome-headless an agent was screenshotting with,
and systemd's default OOMPolicy=stop took the whole box-runner unit down,
with every agent session in it (Skif, 13 minutes into a brief).

OOMPolicy=continue in the unit install-box-runner.sh writes; pinned in
deploy-runner-decoupling. Applied live as a drop-in without a restart.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:28:32 -07:00
CatoandClaude Opus 5.5 aac9aa8708 chore(builder-auth): probe daily, not hourly (#903)
Each probe is a real model call on the operator's Claude sign-in; 24 a day for
~2 dispatches a day was spend for nothing. Applied on the box already.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 02:46:41 -07:00
CatoandClaude Opus 5.5 ccf93dfcdf fix(runner): a deploy never kills a working agent — the drain waits up to 6h, then leaves the old code (#902)
At 09:01 on 2026-09-25 the post-deploy drain reached its 30-minute cap
while a Skif agent was genuinely working, and force-restarted the box
runner, killing it mid-brief. Stale runner code is recoverable (the next
drain lands it); an agent's half-done work is not.

drain_decision is now pure and pinned: restart when nothing works, wait
while something does, and at the cap LEAVE the runner on its current
code, loudly. There is no forced-restart path. Default wait 6h.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 02:38:51 -07:00
CatoandClaude Opus 5.5 0b05ebb74b fix(ai): no box timer or background path spends the shared free AI tier (#897)
* fix(ai): no box timer or background path spends the shared free AI tier

Removes the frontier-digest, feedback-digest and scout-events cron routes and
timers; the digest email is built without a model; check-model-ids no longer
sends a one-token completion per pinned model; the DoD model judge on run
close (page poll / runner push / cron sweep) is gone - precheck only; the
Today Watch nudge composes on click, rate-limited, not on mount; the loki-e2e
check (a real chat turn 4x/day) is on demand only; standing-rule calendar
bookings never call the model to recover a date.

scripts/test/no-free-background-ai.ts walks the call graph from every cron
route and close path and fails if any reaches a model endpoint.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* fix(ai): delete the scout and feedback-digest producers the removed crons left dead

Also lowers the telemetry monitored-path floor to 2: frontier_digests was
demoted on purpose with its cron.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 01:19:03 -07:00
CatoandClaude Opus 5.5 49553dadec fix(runner): stop killing working agents — quota NACK read our own prompt, drain waited on idle CLIs (#898)
Two defects hit one Skif dispatch on 2026-09-25, and either alone loses work.

1. The dispatch was NACKed "claude cannot generate because its usage limit
   is exhausted" 14s in, while Claude was visibly working on the brief. The
   capacity check scanned the WHOLE PTY buffer with a topic-word regex
   ("rate limit", "credit", "context window"), so the echoed prompt, the boot
   banner or a file the agent printed read as a quota wall. Now it reads only
   what the CLI printed after the injection, ignores lines that are just the
   prompt echoed back, and for Claude defers to its own session status: a
   session still generating has not hit a wall.

2. Two minutes later the box runner restarted and killed every session. The
   post-deploy drain waited for agent processes to EXIT, and interactive CLIs
   never exit, so it always ran to its 30-minute cap and then killed whatever
   had started most recently. It now counts agents that are WORKING: an idle
   Claude does not hold the restart; generating, waiting mid-task, or any
   status it cannot read does.

Fleet Runner 0.8.32 (desktop/ changed, so it ships as a release).
Tests: terminal-run-view (echo vs real wall, mutation-checked) and a new
test-drain-and-restart-runner.sh (18 checks, four mutations each caught).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 01:14:22 -07:00
CatoandClaude Opus 5.5 c96516dffa fix(schema): default privileges so an app's role can use the tables its migrations create (#895)
apply-schema.sh runs migrations as the postgres superuser, so every table
belongs to postgres and the app's own role can read none of them. skif's
first deploy printed "schema applied ✓" over 14 tables its role could not
SELECT.

Before the batch, set ALTER DEFAULT PRIVILEGES (plain DML, sequences,
functions) for the role named after the database. After it, report any
EXISTING table the role still cannot read, with the GRANT to run. Existing
tables are never re-granted, so a deliberate REVOKE (kivvi's append-only
audit log) survives deploys. Identifiers are validated, not quoted.

Mutation-tested: re-granting existing tables, GRANT ALL, defaults after the
batch, and a missing identifier guard each fail the suite.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 23:17:43 -07:00
CatoandClaude Opus 5.5 2a5aa32b36 chore(crons): substrata auto-updates timer (readers' own keys only) (#892)
Hourly /api/cron/auto-updates drafts new leads only for readers who opted
in, on their stored key and daily cap. Nobody opted in = no model call; the
site's free AI is never spent in the background (substrata ratchet test).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 22:42:28 -07:00
CatoandClaude Opus 5.5 c140429090 chore(crons): drop surf-your-life ai-digest timer (#891)
No background job may spend the shared free AI pool (George 2026-09-25).
The surf-your-life digest becomes an on-demand staff action; its route is
removed in that repo. Timer was already stopped and disabled on the box.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 22:41:10 -07:00
CatoandClaude Opus 5.5 fb39e5bb96 chore(crons): drop substrata's AI drafts timer (#890)
No background job may spend free-tier AI (George, 2026-09-25): it used up the
shared free credits. The unit is already disabled on the box.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 22:13:18 -07:00
CatoandClaude Opus 5.5 c63ae4ef61 fix(register): Skif has a database, and it is our product (#889)
skif's row said db=- and kind=client-site.

db=- makes every deploy skip the schema step, so drizzle/0000_init.sql
would never be applied: the signed-in pages would serve against a
database with no tables (the exact botsmann shape the format note
records). The database now exists on the box: role and db `skif`,
pg_hba rules inserted above the reject block, public schema owned by
the role, verified by connecting and creating a table.

kind=client-site was wrong on its face: Skif is bitbaum's own product,
owner=bitbaum, federating to OrangeCat. And bitbaum has no clients.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 21:51:40 -07:00
CatoandClaude Opus 5.5 b45d03cd12 chore(crons): schedule substrata producer sourcing every 6h (#888)
Its route and tables existed but nothing called it, so /data/freshness showed
it as never run.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 16:29:30 -07:00
CatoandClaude Opus 5.5 1aefed1688 chore(crons): register substrata's daily job-board fetch (#884)
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:56:14 -07:00
CatoandClaude Opus 5.5 59ad5bc471 chore(crons): register substrata's daily BLS series fetch (#881)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:35:25 -07:00
CatoandClaude Opus 5.5 b5367efe74 chore(crons): register substrata's science-pipeline timer (#877)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 13:56:26 -07:00
CatoandCato 13e433c4dd chore(register): add skif (4027) (#878)
Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-24 13:24:11 -07:00
CatoandClaude Opus 5.5 1fb5076765 chore(cron): schedule substrata's event drafter hourly at :32 (#876)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 13:17:36 -07:00
CatoandClaude Opus 5.5 cf0a944107 chore(crons): register substrata's sweep and EDGAR filings timers (#875)
Both were hand-made on the box (the sweep) or not yet made (filings), so a
rebuild would have lost them and neither had OnFailure alerting.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:49:27 -07:00
CatoandClaude Opus 5.5 5f1e283117 fix(scripts): grep -q is never the reader of a pipe under pipefail (#874)
`echo "$x" | grep -q PAT` under `set -o pipefail` can report "not found"
for text that IS there: grep -q exits on its first match and closes the
pipe, the writer takes SIGPIPE (141), and pipefail makes the pipeline
status 141. An `if` then takes the else branch on a successful match.

#587 found this in one file and noted it "only fires when the payload
exceeds the ~4KB pipe buffer". That is not so, and the belief is why
82 copies in 22 scripts survived. Measured today on retire-site's real
1,158-byte plan output with has()'s exact pattern, 3,000 calls each:

  'DRY RUN'        line 3 of 20    echo|grep -q   2/3000 false misses
  'apps.conf row'  line 11 of 20   echo|grep -q   2/3000 false misses
  last phrase      line 20 of 20   echo|grep -q   0/3000
  'DRY RUN'                        here-string    0/3000

Rare per call, but verify makes hundreds of these calls, and the
retire-site suite went red on those two exact phrases twice this week,
passing every rerun. It is worse in a NEGATIVE check - hasnt() read a
false miss as a PASS. And several copies are not tests: deploy-hetzner.sh
exits 1 on a false miss, and the sshd drift watch would raise a false
security alert.

All 82 rewritten to `grep -q PAT <<<"$x"` (a here-string is not a
pipeline, so there is no writer to signal) by a script that only touched
the simple quoted-variable form and reported anything else. Checked: all
22 files pass `bash -n`, every file is a 1:1 line swap (82 lines), and
the 20 line-continuation sites keep the here-string before the trailing
backslash (the first draft of the rewrite got those wrong; caught in a
dry-run diff before anything was written).

#587's comment is corrected so it stops teaching the wrong threshold.

Gate: scripts/test/no-grep-q-in-a-pipe.ts ratchets it repo-wide,
including forms the rewrite skipped (e.g. "$(cmd)" | grep -q), and
self-tests that its detector still fires. Proven by restoring the
original deploy-hetzner.sh line.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:57:19 -07:00
CatoandClaude Opus 5 923f0bf4ef fix(feedback): one declaration of the summary shape, and a legible assertion (#859)
Two follow-ons found by the gate from the previous commit.

1. The summary SHAPE was declared three times. NotificationPanel and
   NotificationsPill each carried a structural copy of
   ProjectFeedbackSummary. A second declaration never breaks at runtime,
   which is why it survives - it just quietly stops seeing any field the
   real type gains. Both now import it, and the gate has an eighth check
   that refuses a re-declaration. I only spotted the panel by hand; the
   gate found the pill.

2. scripts/hetzner/test-retire-site.sh failed once inside a full verify
   ("expected output to mention 'DRY RUN'") and then passed 25/25
   standalone. The cause is still unknown - it only misses under
   concurrent load - and it was undiagnosable after the fact because the
   assertion prints what it WANTED and never what it GOT. has() now dumps
   the first 400 chars of the actual output on a miss, in the three
   hetzner suites that share the idiom. Proven by mutating an assertion to
   look for a string that is not there.

Not claiming the flake is fixed. Claiming the next occurrence will say
what happened instead of costing an hour of guessing.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 12:21:35 -07:00
CatoandClaude Opus 5 c8ebc5708d test(e2e): widen the dispatch window past a measured cold start (#766)
The window was twenty minutes and guessed. On 2026-09-15 a cold-start agent
on the box — fresh PTY, boot, trust prompt, then the task — wrote its handoff
at 13:44 for a dispatch injected at 13:23: twenty-one minutes to answer
`git status`. The check aborted at 13:43 and reported a broken loop that was
one minute from succeeding, which is the worst thing a health check can do.

Thirty minutes in the script, thirty-five on the box timer (the timer runs
six-hourly, so the extra slack costs nothing and the check must outlast the
slowest healthy path it exercises).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 05:58:04 -07:00
CatoandClaude Opus 5 fe9b396e4d feat(uptime): watch the studio site, the one public host nothing watched (#763)
bitbaum.orangecat.ch was in neither register. It is static files Caddy
serves straight from /opt/bitbaum/app, so it has no port, no unit and no
repo path, and it can no more hold an apps.conf row than annushka can —
which is exactly the case EXTRA_TARGETS exists for. Its own header says
why: still public, still on the one box, still unwatched reproduces the
blind spot the sweep was written to close.

It mattered little while nothing linked to the site. It matters now: all
nine package READMEs point at it, the org and personal profiles point at
it, and as of today /hire/ takes waitlist signups through it. An outage
there is silent lost work, and the first person to notice would be someone
who had already decided to get in touch.

Its health route is `/` — a static site's homepage IS its health — declared
in HEALTH_PATHS rather than left to the /api/health default, so it reads UP
instead of joining the LIMITED "no health route" list.

Verified against the live fleet, not just the table: the sweep now probes
16 targets and bitbaum answers health:200. 65/65 test-uptime-sweep.sh pass.


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 04:54:57 -07:00
CatoandClaude Opus 5 58174f45ef fix(hardcoded): give every duplicated constant one home (#758)
* fix(hardcoded): give every duplicated constant one home

A sweep of all 44 repos' default branches for literals that duplicate an
existing source of truth. Loki's share, in four groups.

WRONG, and live on the public footer. src/config/fleet-site-copy.ts still
called the Zürich clinic "VitaReBa", a name retired on 2026-09-10 — its own
title says "Vita · Metabolische Psychiatrie & Systemische Longevity". The
generated fleet-sites.ts carried it onto loki.orangecat.ch, where it was
serving until this commit. Fixed at the copy file, which is the one place that
owns a site's own words, and the footer regenerated from it.

WOULD HAVE WRITTEN STALE DATA. scripts/seed-fleet-site-urls.ts kept a hand-typed
slug → URL map "read 2026-08-06". Two of its fifteen entries pointed at hosts
retired since (aoz-wohnen.orangecat.ch, revampit.orangecat.ch), so running it
would have filled empty live_url columns with addresses that only 308. It now
derives the map from apps.conf — the same register the footer is generated from
— which also fixes the six live sites the hand list never had. Verified: 19
sites, zero retired hosts.

THE BOX ADDRESS, in seven places. scripts/hetzner/_box-env.sh has been the SSOT
for it all along and sixteen scripts source it; four did not, and the shared
deploy workflow — reused by ~20 repos — had the IP inline twice, so moving the
box meant twenty edits. The workflow now reads the org-level Actions variable
HETZNER_IP and fails loudly if it is unset, rather than ssh-ing to an empty
string. loki's own deploy.yml had `vars.HETZNER_IP || '<literal>'`, a fallback
that guaranteed the variable was never needed and so never noticed if wrong.

ONE LAPTOP, baked into shipped code. site-cd-local.ts listed /home/g/.ssh and
/home/ubuntu/.ssh as deploy-key candidates beside os.homedir() — which already
IS those paths, since loki-app runs as `ubuntu` and a laptop runs as its owner;
both spelled one homedir for one named person. install-push-deploy.sh wired
hooks to /home/g/dev/loki, link-prod-runtime.ts to /home/g/dev/bitbaum, and
scripts/fleet printed an install line only true on one machine: all now DEV_ROOT
or the script's own resolved path.

The two scripts in scripts/local are INSTALLED BY COPY into ~/.local/bin and run
there by systemd timers, so they resolve _box-env.sh beside the real file first,
then under DEV_ROOT, and exit loudly if neither exists — a security check that
cannot find its target must not look like one that found nothing.

Deliberately unchanged: the slug alias map (the mechanism that makes a rename
safe), an executed migration's data row, the retired-handle detector's own
handle list, and test fixtures reproducing past incidents.

Verified: fleet-sites-derived in sync (14 sites), bash -n on every edited
script, and the branch's only remaining literals are in scripts/test fixtures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(push-deploy): the generated hook must not bake one laptop's path

install-push-deploy.sh writes the hook body through an UNQUOTED heredoc, so
$HERE expanded at generation time and the absolute path of one machine was
committed into every repo's .husky/pre-push. kivvi and botsmann both carried it;
anyone cloning those repos got a hook pointing into a stranger's home directory,
and re-running the installer would have put it straight back after those repos
were cleaned.

The hook now resolves ${DEV_ROOT:-$HOME/dev}/loki/... at RUN time, so the
generator stops re-introducing what the cleanup just removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 02:03:58 -07:00
Cato 171b00cf93 fix: register dedicated Substrata database (#738) 2026-09-15 23:17:52 -07:00
CatoandClaude Opus 5 baa8e2e6fb chore(aoz): follow bitbaum/aoz-housing -> bitbaum/aoz-begleitung (#732)
The repo was renamed today. It was the last place the product was still called
Housing: the name row in fleet's registers/retired.json retired "AOZ Housing" as
the PRODUCT name on 2026-09-10, but the repo kept it, and the repo is public.

The deploy name `aoz-wohnen` is deliberately NOT renamed with it. It is an
infrastructure identifier — systemd unit, /opt path, database — nothing on the
box keys on the repo name, and moving it would touch a live site for no visible
gain. apps.conf's comment block already said as much and still does.

The load-bearing change is apps.conf's fourth field. repo-metadata-audit.mjs
keys the register on that path's BASENAME, so while it read /home/g/dev/
aoz-housing the join against GitHub missed and every metadata check for this
repo was silently skipped — the audit went green by not looking at it. The local
checkout was moved to match and its three worktrees repaired (`git worktree
repair`), not pruned: they hold branches.

Two test failures worth keeping, because both were the rename telling the truth:

  - project-mention asserted that "the AOZ housing rebuild" resolves to the
    project. With the slug renamed it does not, and should not. The case exists
    to prove "a slug with a hyphen, typed with a space" matches, so the INPUT
    moved to the current name rather than the expectation being loosened.
  - tab-match asserted a terminal tab literally named "AOZ Housing" matches the
    slug. Same thing: the fixture now uses the name the tab would actually have.

Consequence worth naming: someone who types "aoz housing" at Loki will no longer
be understood. There is an alias mechanism for exactly this shape
(register/build.ts maps the deploy name to the repo), but wiring the retired
name into mention-matching is a product decision, not a rename chore.

Left alone on purpose: scripts/db/retire-stale-projects.ts, whose data row
records the project names the database actually held when that migration ran;
and content/thoughts/*.md, published essays — one of which quotes a filesystem
path observed during a debugging session, so rewriting it would falsify the
anecdote.

The production user_projects row was updated too (name and git_url), because the
database is a second copy of the repo identity and a past rename left 21 rows
pointing at a dead account. New URL proven to resolve: 431bae7.

Tests green: fleet-register 44, project-mention 28, tab-match 10, fleet-map 7,
loki-project-ranking all.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 12:17:25 -07:00
CatoandClaude Opus 5 2d49a2d1c2 fix(register): heidi is served, and the register said it was a prospect (#727)
heidi.orangecat.ch answers 200 and has since it launched. Its apps.conf row
said `prospect`, and because the studio site derives from this register, that
word was rendered on heidi's public page.

`live` in this column means the process is SERVED — a provisioning fact, like
`client-app` two columns over. It is not a release claim, and nothing in this
fleet makes one: everything is beta, OrangeCat included (fleet AGENTS.md,
"Names agents must share"). So this row now reads `live` and bitbaum renders
"Beta — running, not released", which is both true statements at once.

src/config/fleet-sites.ts is derived from this file and is regenerated here
rather than hand-edited — scripts/test/fleet-sites-derived.ts caught the drift
before CI did, which is the entire point of having the pair.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 04:37:36 -07:00
CatoandClaude Fable 5.1 ac02ee25aa fix(box): the builder probe runs through a login shell, like the runner (#716)
The runner launches agents with 'bash -lic', which sources ~/.bashrc — and
~/.bashrc on the box still exported the retired account's
CLAUDE_CODE_OAUTH_TOKEN. The probe skipped the profile, said ok, and every
real agent was refused. Probe the way the agent is launched or the probe
proves nothing.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 22:15:15 -07:00