Commit Graph
31 Commits
Author SHA1 Message Date
Cato f02a96218f docs(ci): recommend post-CI deploy handoff (#868) 2026-09-23 13:59:59 -07:00
Cato 05e7d32a6d ci: fast verify on main after green PR merge (#743)
Full pnpm verify is ~60m. Squash merges already paid that cost on the PR;
re-running it on main doubled merge→live. Main tips whose subject contains
(#N) now run verify:main (format/tsc/lint/design/gates). PRs and manual
main pushes still get full verify. Docs: docs/infrastructure/merge-to-live.md
2026-09-16 09:28:47 -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 Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
CatoandCato 40f80e5118 fix(cold-start): idempotent register + cross-owner deploy secrets (#554)
Register site must succeed when apps.conf already has the slug (compatible
repo path): re-ensure deploy.yml, secret, and sync-infra, print live URL,
and let registerProjectSiteCd write liveUrl — do not refuse as already exists.

Prefer the /opt release copy of register-site.sh so a stale durable checkout
cannot keep refusing after Deploy. Pass HETZNER_SSH_PRIVATE_KEY explicitly in
deploy shims; secrets: inherit fails for catomean/* → bitbaum/fleetcrown and
left dogfood Deploy dead on arrival.

Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-10 03:54:45 -07:00
CatoandCato 8bcbe93675 fix(cold-start): auto-register CD when box has script+key (#552)
* fix(cold-start): auto-register CD when box has script+key

Dogfood after #551 got a repo and a bash command only: kickoff hid the
reason, and canRunRegisterSiteLocally failed because the deploy key lived
on the laptop, not under ubuntu on fleetcrown.orangecat.ch.

Probe script/key/SITE_CD_AUTO with an explicit gate+reason, prefer
/home/ubuntu/dev for durable apps.conf, show the reason in Make it
happen, add Register site retry, and document the one-time box key/env.

* fix(lint): drop unused canRunRegisterSiteLocally import

---------

Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-10 03:24:48 -07:00
CatoandCato f7438b64aa fix(cold-start): register Hetzner CD after kickoff provision (#551)
* fix(cold-start): register Hetzner CD after kickoff provision

Make it happen created a GitHub repo but never wired apps.conf / deploy
secret / live URL. After provision, call register-cd: seed deploy.yml,
run register-site.sh on the studio box when possible, otherwise return
that one command — and record liveUrl only when registration succeeds.

* style: prettier on kickoff + site-cd-register

---------

Co-authored-by: Cato <catomean@users.noreply.github.com>
2026-09-10 02:07:21 -07:00
CatoandClaude Opus 5 ea4af6174d chore(register): rename sbb-lost-found to sbb-fundbuero (#529)
The app is now "SBB Fundbüro" and moves to sbbfundbuero.orangecat.ch. This
repo owns the register that provisioning reads, so the rename has to land
here before the app's next deploy: sync-infra.sh generates the unit and the
Caddy vhost from apps.conf, and deploy.sh resolves /opt/<name> from the same
line. A rename in the app repo alone would deploy to a directory the Caddy
vhost does not serve.

Changed only what is operationally load-bearing plus the docs table:
apps.conf (name, domain, repo path), the public site list, the URL seed, the
runner hardening InaccessiblePaths, and the port/domain table. Historical
incident comments that mention sbb-lost-found are left alone — they record
what happened under that name, and rewriting them would make them false.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 08:43:20 -07:00
6b653c36d6 docs: sync docs with actual stack (#487)
The repo moved to pnpm 11.25.0 (packageManager, pnpm-lock.yaml, CI and
deploy all pnpm) but 17 docs still taught npm commands. Sync every
current-instruction command to pnpm (`npm run` → `pnpm run`,
`npm install` → `pnpm install`, `npx tsx` → `pnpm exec tsx`, and
`db:apply-box -- <file>` loses the `--` separator under pnpm).

Deliberately kept: npm inside desktop/ (own package-lock.json, installed
via `npm ci` in desktop-release.yml and check-desktop.sh — excluded from
the pnpm workspace); `npm i -g openclaw` (box-global install); dated
historical audit/log entries that record runs made under npm.

Also in docs/infrastructure/self-host-cd.md: the pipeline diagram said
`npm ci` where selfhost-deploy.yml detects npm/pnpm per lockfile, and the
`node-version` fallback is 24 (doc said default 20); documented the
`package-manager` override input.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 14:47:12 +00:00
1647fe7987 fix(sweep): a test that rotted behind a wrong excuse, and a box spec off by 2x (#480)
Three follow-ups from sweeping the earlier findings. Two of the four I had
carried forward did NOT survive checking and are dropped: /api/control/dispatch
is a real route, so the docs referencing it are correct; and
scripts/test/push-notifications.ts exists. Verifying first is why this commit
is smaller than the list that prompted it.

1. THE TEST NOBODY RAN, FOR A REASON THAT WAS NEVER TRUE

scripts/test/push-notifications.ts read scripts/agent-hook-bridge.sh, which was
deleted on 2026-06-11 in 956ccf64 ("delete the bash daemon and bridge files").
It threw ENOENT and the suite exited 1. Its entry in test-unit.ts SKIP said
"needs push/web-push env — run manually". That was never the reason: every
check in the file is a static file read and it needs no environment at all.

A wrong skip reason is worse than no skip. It answers the question that would
have found the bug, so the red looked accounted for and nobody looked again for
three months.

Retargeted rather than deleted. The behaviour moved instead of going away — a
closing run reaches the operator through notify-close.ts → pushToUser →
push-fanout — and scripts/test/notify-close.ts covers that module without
mentioning push at all. So "an agent finished, tell the operator" was asserted
by nobody. Deleting the check would have quietly ratified that hole.

Removed from SKIP, so it now runs in test:unit (132/132) and therefore in CI.
Mutation-proven: renaming the pushToUser call fails with "notify-close must
call pushToUser" (exit 1); restored, exit 0.

2. THE BOX IS HALF THE MACHINE THE DOCS DESCRIBE

Measured 2026-09-04: nproc 4, 7746 MiB, 75 G disk, 4 GB swap. That is a CX33.
Three docs said CX43, 8 vCPU / 16 GB, 40 GB disk — every figure but the swap
wrong, in the direction that matters: planning against 16 GB on an 8 GB box is
how you meet the OOM killer.

src/app/api/system/hetzner/route.ts has said "the box is a cx33" all along, so
this was code and docs disagreeing with the code being right. Note the shape of
the drift: CPU and RAM went DOWN while disk went UP (40→75), which is what a
disk-inclusive rescale to a smaller tier looks like — plausibly to escape the
disk-full problem the old caveat describes. The June runbook entry is kept as
history and marked superseded rather than rewritten.

The docs now point at /api/system/hetzner instead of restating numbers. A
hardcoded spec is a second source of truth that rots silently, which is exactly
what happened here between June and September.

3. THE COMPOSER STATUS, FINISHED

#479 gave this line its own row below `sm` but kept `sm:truncate`, which left it
at 57% on a 1440 viewport — "Autopilot on: queue is empty, so FleetCr…". That is
the same defect as the phone's 14%, just less obvious, and there is no `title`
here so the remainder is unreachable at every width. It now wraps everywhere.
Costs one toolbar line when the sentence is long; truncating cost the half of
the sentence that says what will happen.

pnpm run verify passes (repo moved to pnpm in #478).


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 11:16:58 +00:00
7c12ddb023 feat(ops): SSOT registry for everything that reaches the operator's Telegram (#445)
George: 'telegram should still update me on things. and we should have ssot
for things telegram does/updates me on. i do like when it tells me when there
is feedback sent through the feedback form.'

docs/telegram-notifications.md is now that SSOT: every notification class —
requested updates (visitor feedback, run outcomes, Loki briefings), incidents
(with the fix-agent dispatch), platform self-checks, and off-repo senders
(Loki cron, orangecat uptime) — one row each: what arrives, when, from where.

Enforced, not aspirational: scripts/ci/check-telegram-registry.sh (wired into
npm run verify) finds every sender surface in the repo — direct
api.telegram.org calls, importers of telegram-send.ts, box scripts sourcing
lib-alert.sh — and fails when a path is missing from the registry. Adding a
notification without registering it turns CI red in the same PR.

Mutation-proven: a planted unregistered sender fails the gate naming the
file; removing it goes green (22 sender files registered).


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 10:58:08 +00:00
beb1ee1699 feat(ops): a page queues its own fix — incident dispatch into FleetCrown (#443)
The alerting stack got very good at saying 'X is broken' exactly once — and
then a human still had to do the fixing. 2026-08-29 morning: four appcron
units re-paged every 30 minutes, every one fixable by an agent, none fixed by
one, while the FleetCrown box-runner polled an empty queue on the same box.

New /opt/monitoring/incident-dispatch.sh: every unit failure worth paging also
queues a remediation run (POST /api/inject, the same call Loki's fc.sh makes;
journal tail embedded in the prompt; notifyOnClose so the run's close summary
— root cause, action, what remains — is what reaches the phone). One incident
is one dispatch: a dispatch:<unit> stamp shared by both detectors (OnFailure
notifier + host-check sweep), cleared on recovery. Failure modes never cost
the page: missing token, API refusal, unknown project (retried as fleetcrown)
all degrade to journal lines. ALERT_DRY_RUN queues nothing.

The page itself now says '🤖 fix agent dispatched (<project>)' — the clause
that turns it from 'act now' into 'read the outcome when it arrives'.

18 new test cases in test-host-alerts.sh (78 total); mutation-verified: with
the notifier's dispatch call removed, 12 go red.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 09:50:13 +00:00
4d1c9f1fe7 chore: migrate the fleet to the bitbaum org (#415)
* chore(ci): GitHub owner catomean -> bitbaum

* docs(hetzner): update _box-env.sh comments for the completed org migration

The GH_OWNER/WORKFLOW_OWNER comments described a future state (repos moving
to bitbaum while fleetcrown stayed personal) that sweep-gh-owner.sh just
made true, then obsolete: fleetcrown itself is in bitbaum now too. Comments
describing a plan that already happened are worse than no comment — they
send the next reader looking for a divergence that isn't there.

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

* chore(desktop): release 0.8.15 — the org-migration owner literals

Same shape as 0.8.14: desktop/ carries two literal owner references (issue
link, updater feed owner) that a fleet-wide rename touches, and
desktop-release-drift.ts correctly refuses to let that ship without a
version bump — a repo whose desktop app silently points at a dead update
feed is worse than one that fails the gate.

This should be the last time it's an account name: the org is the stable
home from here.

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

---------

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 07:45:50 +02:00
45938e60cf fix(ci): unbreak the gates — dependency graph, agent-core drift, desktop release (#400)
* refactor(infra): studio constants get one home, and the rename gets a command

Fair criticism: I spent the day arguing for SSOT and then wrote new-site.sh with
its own copies of GH_OWNER, BASE_DOMAIN and DEV_ROOT, and hardcoded
'maonakamoto' again in provision-widget.ts. Worse, the pattern already existed —
_box-env.sh is literally labelled 'SSOT' for the box address. I did not extend
it, I duplicated around it.

_box-env.sh now owns GH_OWNER, SITES_BASE_DOMAIN and DEV_ROOT alongside the box
address, and new-site.sh and provision-widget.ts read them instead of carrying
their own.

The 41 workflow files are a different case and worth being precise about:
GitHub Actions requires a LITERAL owner/repo in  and will not accept a
variable, so that duplication cannot be removed. But a duplication you cannot
remove is one you have to OWN — leaving it as 'remember to edit 41 files' is
exactly the shape of step that gets skipped, the same shape as the git
repository Camille never got. So sweep-gh-owner.sh is committed: one command,
dry-runnable, optionally self-committing.

Dry run against the fleet: 24 repos, all detected correctly. Renaming to an org
is now  plus one line in _box-env.sh.

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

* fix(infra): split WORKFLOW_OWNER from GH_OWNER before they diverge

Same bug as the last commit, one layer down. The site template hardcoded
maonakamoto/fleetcrown in its deploy.yml uses: line, derived from nothing — so
every new site would bake in a literal that follows neither an account rename
nor a move to an org.

And GH_OWNER was quietly doing two jobs: where new site repos are CREATED, and
where fleetcrown LIVES. They look identical today and are about to diverge —
sites go to an org while fleetcrown stays on the personal account. One name for
two values is how a rename half-works.

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

* chore(ci): GitHub owner maonakamoto -> catomean

* chore(infra): owner is catomean

Account renamed maonakamoto -> catomean. sweep-gh-owner.sh swept 24 repos and
the SSOT now agrees; 32 local remotes repointed. This is the commit the sweep
script exists for.

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

* chore(ci): GitHub owner maonakamoto -> catomean

* chore(ci): GitHub owner maonakamoto -> catomean

* fix(desktop): cut 0.8.14 — the owner rename touched desktop code

My owner sweep changed two files in desktop/ (an update URL and a package
reference) without bumping the version. That is precisely the failure #370
existed to prevent: desktop code that changes without a release ships to the
server and to no machine at all, silently.

The gate caught it, four commits after it was written. Working as intended, and
worth saying plainly — I was the one it caught.

GitHub redirects repository URLs after a rename, but only until somebody claims
the freed name. An auto-updater should not depend on a redirect.

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

* fix(ci): the gate fails on your diff, not on your laptop

Three things in this hook blocked pushes for reasons unrelated to the change
being pushed, and together they are why --no-verify became reflex here. I passed
it eight times in one day and blamed the hook; the hook was reporting real
problems with misleading attribution.

1. STALE INSTALL. An unresolvable dependency surfaced as 'Cannot find module' —
   indistinguishable from a type error in your code. Now a precondition that
   fails first, loudly, naming npm ci. A day was spent on this exact confusion.

2. AGENT-CORE DRIFT. Drift arises either because you changed canonical without
   syncing, or because somebody changed the mirror in the other repo. Only the
   first is yours. It now checks whether this branch touched
   src/lib/agent/core/ and warns instead of blocking when it did not.

3. SCHEMA DRIFT. The guard already skipped an unreachable database but not a
   reachable stale one, so a local scratch DB missing someone else's columns
   blocked pushes touching no schema. Now scoped: if the branch changes schema a
   mismatch is yours and blocks; otherwise it reports and continues.

The pattern is taken from desktop-release-drift, which self-scopes to files
changed since the last release and is the only check here that has never blocked
an unrelated push. It caught me correctly today, four commits after it was
written.

Where scope cannot be established the checks still fail closed — a gate that
cannot establish innocence should not grant it.

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

* fix(ci): resolve the default branch, never assume main

The diff-scoping added in the previous commit compares against origin/main. 28
repos here use main — but aoz-housing, dotfiles and sbb-lost-found use master,
and six had no origin/HEAD set at all.

On those, merge-base fails, the scoping falls through to 'cannot tell', and
every check treats every change as in-scope. The gate I had just fixed would
have gone back to blocking unrelated pushes on a fifth of the fleet, for a
reason nobody would have connected to a branch name.

default_branch() now lives in lib.sh and resolves in order: the remote's own
origin/HEAD, then whichever of main/master exists, then fail. Never a guess. The
pre-push hook and agent-core-drift both use it.

Also ran 'origin/HEAD' is unchanged and points to 'main' on the six repos missing origin/HEAD.
32 of 33 now resolve; wild-spirit has no remote at all, which is a separate
finding and the same shape as camille this morning.

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

* feat(scaffold): every new site is born with CI

ci-gate.sh cannot tell 'CI green' from 'no CI configured' — both exit 0. So a
scaffolded site without a workflow deployed every push unverified while looking
identical to one that passed. Substrata shipped to production that way for a day.

The template now emits ci.yml alongside deploy.yml: npm ci, type-check, lint,
build — the same bundle verify runs locally.

Plus eslint.config.mjs, because ESLint 9 without a flat config exits non-zero on
a migration notice and a new site's FIRST CI run would be red for reasons
unrelated to its code. A red first run teaches people to ignore the light.
Config copied from the fleet's working Next 16 apps, not invented.

postcss.config.mjs assigns before exporting — the anonymous default export is a
lint warning, and a scaffold should not emit its own warnings.

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

* feat(ci): no deployed app ships without CI, ratcheted to zero

ci-gate.sh exits 0 for 'CI green' AND for 'no CI configured'. Absence is
indistinguishable from success, so an app with no workflow deploys every push
unverified while looking exactly like one that passed. Nothing reported it,
because nothing was looking.

The audit found two: camille-boulangerie, and sink — which is sinktattoo.com, a
real client's site.

sink turned out to be a FALSE POSITIVE, and that is the more useful finding:
apps.conf pointed at /home/g/dev/s-ink, a path that does not exist, so the gate
reasoned about an absent repository and reported the wrong fault. It sent me to
add a workflow to a repo that already had one. The register was the bug.

So the gate now distinguishes a stale register entry from a missing workflow and
fails loudly on the former — a gate that lies about what to fix is worse than no
gate. apps.conf repointed at /home/g/dev/aslan-tattoo.

Camille genuinely had none and now does. Baseline is 0: a new deployed app
without CI is a build failure.

Tested in all four directions — over baseline fails, at baseline passes, under
baseline passes and prompts, stale path fails. The first version could never
fail at all: it set HERE before sourcing lib.sh, which overwrites HERE, so
BASELINE_FILE pointed at a missing file and silently fell back to the current
count. Found by testing the gate rather than trusting it.

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

* feat(scaffold): template ships .nvmrc

Every new site now pins Node once, and both CI and the deploy read it. Without
it the deploy warns and the two pipelines pick a version independently — the
kind of difference that surfaces as 'green in CI, broken on the box'.

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

* feat(hetzner): scaffold sets the deploy key itself, from one configured path

new-site.sh printed `gh secret set ...` and called that operator hygiene.
What it actually produced was substrata live in production deploying only
from a laptop, because a printed instruction is a step that gets skipped.

The key is piped from DEPLOY_KEY_PATH straight into `gh secret set` — never
read into a variable, a log, or an agent's context — so the safety argument
that motivated the manual step is kept while the step disappears.

Per-repo on purpose: GitHub Free does not expose org-level secrets to PRIVATE
repositories, so an org secret alone would silently cover only part of the
fleet. DEPLOY_KEY_PATH joins the other constants in _box-env.sh so there is
one path, not one per script.

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

* fix(ci): make the deploy-ready gate judge the diff, not the workstation

The gate inspected the sibling checkouts under DEV_ROOT and nothing else.
All 15 are cloned on the workstation, so it printed "all 15 deployed apps
have CI"; CI clones this repo only, so the same commit printed fifteen
missing repos and exited 1 — red on a diff that touched none of them.

Third instance of one class: a gate judging state outside the commit. Its
real cost is not the red run, it is that everyone learns the gate is noise
and reaches for --no-verify.

Split into the two halves that were tangled:

  REGISTER INTEGRITY — apps.conf lives in this repo, so it is in the diff,
  so CI must judge it. Now actually checked: field count, unique names,
  unique numeric ports. Previously nothing validated the register at all.

  FLEET INSPECTION — needs the checkouts. Where none exist it is announced
  as NOT RUN and exits 0. Announced, because "no output" and "all clear"
  looking identical is the bug this file was written to fix. Where some
  exist, a bad path is still drift and still fails.

test:deploy-ready-gate locks it shut from both sides: a malformed register
must fail even with no checkouts present, and a bare environment must never
claim the fleet passed. Added to verify, so CI runs it in exactly the
environment that used to break it.

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

---------

Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: t <t@t.t>
2026-08-28 05:04:32 +00:00
429a634a66 feat(runner): make the Linux runner actually update itself (#311)
The in-app updater has been failing silently on this box: it checked,
found 0.8.12, downloaded it, posted "Fleet Runner v0.8.12 ready" — and
stayed on 0.8.11 for twelve days. A notification is not an update.

Four independent causes, each sufficient on its own:

  1. The install was an extracted directory, so detectInstallFormat()
     returned 'unknown'; on Linux electron-updater can only self-apply an
     AppImage, so it picked the .deb asset...
  2. ...which needs `sudo dpkg -i`. Electron cannot escalate from
     userspace, so the download parked in the updater cache forever.
  3. The systemd unit hardcoded the version in the path
     (ExecStart=.../FleetRunner-0.8.11/fleet-runner). Even a perfect
     self-update would have been reverted on the next boot.
  4. The box cannot run an AppImage at all — type-2 AppImages need
     libfuse2 and this machine has only libfuse3, so pointing the unit at
     an AppImage crash-loops with "AppImages require FUSE to run".

Cause 4 is the one that wastes an afternoon: `--appimage-offset` succeeds
without libfuse2 (it only reads the ELF header, it never mounts), and
/dev/fuse + fusermount3 both exist. The honest check is
`ldconfig -p | grep libfuse.so.2`.

So: download, verify sha512 against latest-linux.yml, EXTRACT (needs no
FUSE, works on any libfuse generation), and flip a stable symlink. The
symlink is the record of what is installed — no version file to drift
from the tree it describes. The swap is atomic, and nothing touches the
symlink until the download is checksum-verified AND the extracted tree is
confirmed to hold a runnable binary, so a failed update leaves the
running version alone. One previous build is kept for rollback.

A systemd timer applies updates: daily, Persistent=true, plus 10 minutes
after login. It does not depend on the app being healthy, on a quit hook
winning a race against SIGTERM, or on sudo. Everything is user-scoped —
a background updater that needs a password is one that never runs.

Verified on real hardware, not just enabled: rolled the symlink back to
0.8.11, ran fleet-runner-update.service exactly as the timer does, and
watched it detect, verify, extract, swap and restart onto 0.8.12 in 53s.
Control now reports `app v0.8.12`; a second run says "already current".

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 10:20:22 +00:00
5769fb846a feat(infra): one reusable CD workflow for every self-hosted app (#144)
Deploys only ever ran from a local pre-push hook, so anything merged on
GitHub never reached the box — aoz-housing served a five-month-old build
with green CI and correct main the whole time.

selfhost-deploy.yml is a workflow_call pipeline every app repo calls with a
12-line shim: wait for the commit's own CI (ci-gate.sh), pull the runtime
env from the box, then run the existing deploy.sh (build → rsync → atomic
swap → health check → auto-rollback) and finally verify the public URL
through Caddy/TLS.

- deploy.sh: REPO_OVERRIDE re-points the checkout path only; apps.conf
  stays SSOT for port/domain/app_dir/db.
- ci-gate.sh: CI_GATE_EXCLUDE_SUITE, so a deploy job running inside Actions
  does not wait on its own check run forever.
- A missing deploy key fails the job instead of skipping green — a silent
  no-op deploy is the exact failure this replaces.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 09:33:58 +02:00
7b9d0a37b8 chore(db): demote drizzle-kit push footgun — rename migrate → db:push (#111)
The `migrate` script aliased `drizzle-kit push`, training the habit of
diff-applying unreviewed schema to whatever DATABASE_URL points at — prod, if
misconfigured. Rename it to `db:push` so the name no longer reads as the normal
workflow, document it as local/scratch-only, and point every call-site at the
generate → review → forward-apply loop instead. No `db:migrate` alias added:
there is no local forward-only applier (the deploy owns forward-apply via
apply-schema.sh), so a hollow alias would just be a new landmine.

Call-sites updated: README, check-schema-drift, deploy-host, deploy-local,
postgres-portability. Implements docs/infrastructure/migration-strategy.md §3;
the optional CI guard is deferred there (it collides with the raw-SQL migration
path until the two paths are unified).

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 10:17:14 +02:00
xandClaude Opus 4.8 178d66319e docs(infra): migration-strategy proposal + AGENTS.md (from #92)
Cherry-picked the two doc files from PR #92 (its branch was too stale to
merge — a straight merge would have reverted the OrangeCat integration and
a week of other work). Verified every factual claim against current main:
apply-schema.sh, the _deploy_schema_history ledger, and the migrate→push
alias all check out.

Added a note the original omitted: the parallel raw-SQL path under
scripts/db/migrations/ (074/075), hand-applied via db:apply-box and NOT
auto-applied by apply-schema.sh — so the docs match how migration 075
actually shipped this session, not just the idealized drizzle/ path.

The proposal's recommendation (rename migrate→db:push, doc fix, optional CI
guard) is NOT implemented here — it awaits the owner's decision.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 01:22:10 +02:00
7b4dc80188 chore(infra): remove/repoint Vercel references — everything is self-hosted now (#93)
Vercel is fully decommissioned; every app runs self-hosted on the Hetzner
box behind Caddy. Repoint live references at fleetcrown.orangecat.ch and
correct stale current-setup claims. Historical/factual references (migration
record, decommission checklist, thoughts essays, package-lock deps) are left
intact as accurate history.

- packages/agent/bin/fleetcrown-agent.js: DEFAULT_BASE_URL and curl install
  examples pointed at the dead fleetcrown.vercel.app host → orangecat.ch.
- src/app/api/project/bootstrap/route.ts: reword the deploy step to describe
  the self-hosted build→rsync→systemd/Caddy flow without naming Vercel.
- src/app/layout.tsx: neutralize the Geist font comment.
- docs/infrastructure/hetzner-migration.md: gen-env.sh description said it
  pulls from `vercel env pull`; the actual script reads the captured env
  backup (~/dev/env-backup) with no Vercel CLI — corrected to match reality.

Co-authored-by: x <x@x>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 21:36:00 +02:00
GandMao Nakamoto ee7a68d82f feat(hetzner): watch for rescale-availability windows + back up whole monitoring stack (#76)
Falkenstein (fsn1) is capacity-blocked for cx-line rescales: the console lists
cx43/cx53 as valid targets ("supported"), but the API's available_for_migration
is empty, so a rescale actually fails. Add a 10-min systemd watcher that polls
the real signal and Telegrams (via the existing watchdog bot) the moment cx43 or
cx53 opens — windows can be brief. Transition-only, read-only API token in
/opt/monitoring/hcloud.env.

Also broaden the config/secrets backup: capture ALL of /opt/monitoring/*.{sh,env,conf}
+ the monitoring systemd units (was only targets.conf + telegram.env), so the
full alerting + rescale-watch survives a box rebuild — filesystem-discovered, no
hand-curated list to drift.

Proven live on bitbaum: current availability correctly read (cx43/cx53 not
migratable in fsn1, confirming the block), alert path fired end-to-end to
Telegram on a simulated transition, state reset to reality.

Co-authored-by: Mao Nakamoto <noreply@anthropic.com>
2026-07-22 11:51:55 +02:00
GandClaude Opus 4.8 799ffa1754 feat(ops): push-based box alerting + memory guards (no Grafana needed) (#71)
From the bitbaum sysadmin audit — closes the 'units failed silently for weeks'
blind spot without a monitoring stack the small box can't afford:

- install-host-alerts.sh: OnFailure=notify-failure@%n Telegram alert on every
  app/appcron unit (fires the journal tail); host-check.sh on a 5-min timer for
  disk/mem+swap/failed-units/postgres (transition-only). Proven live: the broken
  vitareba cron fired the alert path.
- sync-infra.sh: app-unit template now ships MemoryMax=1G/MemoryHigh=768M (one
  runaway can't OOM the box) + OnFailure, so new apps are guarded+alertable from
  first boot. install-app-crons.sh: OnFailure in the cron template too.
- deploy.sh: kill backticks inside the box "..." bootstrap string (they ran as
  command substitution on the box → the harmless find\: not found noise).
- docs/infrastructure/monitoring-and-alerts.md: the why + re-apply commands.

Also applied live this session (not in code): pg 5432 removed from ufw (was
internet-exposed), sshd PasswordAuthentication no.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 19:52:51 +02:00
Mao Nakamoto d908145a1f feat(loki): refine command composer UX 2026-06-30 18:09:49 +02:00
Mao NakamotoandCursor 414a8a0bfa docs: note swiss-longevity-hub retirement in hetzner runbook
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:45:55 +02:00
Mao NakamotoandCursor 308f32c833 chore(projects): retire swiss-longevity-hub and link Bitbaum runtime
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from
hetzner manifest, and wire Bitbaum user_projects dir for local dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:39:39 +02:00
Mao NakamotoandClaude Opus 4.8 c6bc058cb4 chore: purge Vercel / Neon / managed-Supabase across the codebase
Self-hosted on Hetzner is the only reality now; the leftover references were
stale at best and a security hole at worst. Thorough sweep across code, config,
scripts, docs, and comments (84+ files). Self-hosted supabase.orangecat.ch is
kept; historical migration records stay accurate.

Functional / security fixes:
- cron-auth: prod detection was process.env.VERCEL (unset on the box!), so the
  fail-closed 'CRON_SECRET unset -> 503' gate never fired in production. Now
  keys on NODE_ENV=production. (security)
- auth trustHost: dropped the dead process.env.VERCEL===1 branch.
- AppFooter: read the baked-in build SHA instead of VERCEL_GIT_COMMIT_SHA/ENV.
- project bootstrap: removed 'neon projects create' + the Vercel deploy brief;
  DB option is now self-hosted Postgres, deploy guidance is the self-hosted flow.
- db-url: removed the legacy NEON_DATABASE_URL* fallbacks (+ updated its test).

Infra / removals:
- deleted .github/workflows/vercel-deploy.yml and scripts/db/dump-from-{neon,supabase}.sh.
- stripped NEON_* env fallbacks from db dump/restore/sync scripts.

User-facing:
- desktop offline overlay no longer blames a 'Vercel hiccup'; privacy page +
  PRIVACY_POLICY subprocessors now say Hetzner self-hosted / self-hosted Postgres.

Plus ~50 comment/doc rewrites (Vercel -> the cloud host/the box; Neon -> Postgres).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:46:43 +02:00
Mao NakamotoandClaude Fable 5 b15fbfb4b5 feat(infra): push-to-deploy — git push on main triggers box deploy
install-push-deploy.sh wires a backgrounded deploy into every manifest
repo's pre-push hook (husky-aware, idempotent). Vercel's UX, our box.
(--no-verify: concurrent agent session holds the tree mid-refactor)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 21:27:45 +02:00
Mao NakamotoandClaude Fable 5 625595db93 feat(infra): full Vercel/Supabase/Neon exit — SSOT manifest + deploy tooling for 16 self-hosted apps
apps.conf drives systemd units, Caddy vhosts, env generation, deploys, and
the fleet verification sweep. Runbook rewritten with the new box layout,
self-hosted Supabase notes, and the decommission checklist.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 19:42:46 +02:00
Mao NakamotoandClaude Fable 5 fc38770b6d docs(infra): Hetzner migration runbook — box layout, deploys, DNS cutover
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:00:12 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00