175 Commits
Author SHA1 Message Date
CatoandClaude 0281dce5cb fix(privacy): signed-out fleet register and health show only what /fleet shows (#1780)
* fix(privacy): signed-out fleet register and health show only what /fleet shows

/api/fleet/register returned the owner's whole register (hidden rows, internal
descriptions) to anyone. Signed out it now returns /fleet's listed rows with
/fleet's fields only and no description, via one loader shared with the page.
The full register needs the owner's session/token or the control bearer.
/api/health answers ok/status/app to strangers; detail needs the bearer. The
live-commit readers (auto-merge, deploy check, ship-report) move to the
public release receipt.

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

* test(unit): quarantine the 12 browser tests an agent sandbox cannot run

Explicit tracked list (scripts/test/quarantine-browser.json), skipped off CI
only and printed as QUARANTINED (no Chromium in sandbox). CI runs all of them.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 07:45:38 +01:00
Cato b1a8ab38b8 fix(deploy): establish receipt visibility from the workflow event (#1737) 2026-11-15 17:38:15 +01:00
CatoandClaude Fable 5.2 137ff5d1fb fix(ai): Loki reads and writes the box's AI usage log; fleet-env usage-log points every app at it (#1709)
* ops(fleet-env): usage-log points every app at one AI usage log through the fleet file

launch.sh.tmpl sets AI_USAGE_DIR, but a launch script is only rewritten by
a site sync, so after #1704 no running app had it and Settings > AI said
the server is not writing the log. Every launch script already sources
/opt/fleet/env with export on. usage-log makes the directory, writes the
one line there once, and restarts the apps one at a time.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(ai): Loki reads and writes the box's usage log without the launch variable

Loki's launch script predates /opt/fleet/env, so after the box was pointed
at one usage log Loki still had no AI_USAGE_DIR: the card said the server
was not writing a log. lib/ai/usage-dir takes the box's directory when the
variable is unset and it exists; instrumentation adopts it at boot (and
names the app LOKI). Loki walks its own chain, so the package cannot see
its calls: recordUsage reports each answered call to the log.

scripts/test/usage-dir.ts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* docs(env): AI_APP_ID in .env.example

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* ops(fleet-env): where and retire look beyond the app layout

The platform's Google key was retired from /opt/fleet/env and the app env
files on 2026-11-13, but nothing had looked at the builder's env
(/opt/loki/runner/.env), the named runners' (/etc/loki/runners/*.env) or the
Telegram gateway's (~openclaw/.openclaw/.env), where a copy of the same key
could still be read by a process that spends. where and retire now also
sweep /opt, /etc/loki, /home and /root for env files (not examples, not
node_modules, not releases), reading root-owned ones through sudo.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 13:41:20 +01:00
CatoandClaude Fable 5.2 8b3727e464 ops(fleet-env): retire a key everywhere in one command; GEMINI_API_KEY is no longer a fleet key; ai-kit 1.26 (#1704)
* ops(fleet-env): retire a key everywhere in one command; GEMINI_API_KEY is no longer a fleet key; ai-kit 1.26

GEMINI_API_KEY sat in /opt/fleet/env as a free tier. The Google project had
billing and every app read the key: about $567 on 10-11 Nov 2026. On
2026-11-13 it was still set there, with eight apps on an ai-kit that puts
Google in the free chain.

- fleet-env.sh where KEY: every env file on the box that sets KEY, by
  fingerprint. retire KEY: its line in /opt/fleet/env and in every app env
  becomes a dated comment (the value is kept), and the app units restart one
  at a time so none keeps the value it started with.
- fleet-keys.conf drops GEMINI_API_KEY, so seed never brings it back.
- fleet-env.yml offers where and retire with a key input.
- @bitbaum/ai-kit ^1.26.0: Google out of the free chain, paid AI off unless
  an app opts in, daily caps.

test-fleet-env.sh covers where, retire (value kept, other lines untouched,
no value printed, seed does not restore) and the refusal of a non-credential.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* test(ops): four .env cases that need an unreadable file are not run as root

chmod 000 is how the section makes a .env unreadable, and root reads any
file. In an agent's sandbox (uid 0) the four cases could only fail, on main
too, and stopped every push that touched scripts/hetzner. They print as not
run; CI and a developer's machine run them as an ordinary user.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* ops(launch): every app on the box writes to one AI usage log; ai-kit 1.27.0

launch.sh.tmpl exports AI_USAGE_DIR=/opt/fleet/ai-usage where that
directory exists and AI_APP_ID from the app's directory name, unless the
app's own .env sets them. @bitbaum/ai-kit 1.27.0 then writes one line per
model call there (app, vendor, model, outcome; never content). fleet-env.yml
creates the directory. Kivvi canaries 1.27.0, so the rollout gate no longer
passes 1.26.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 11:26:30 +01:00
CatoandClaude d493876bb0 test(live): the OrangeCat rail's browser doors are driven on the live site, from the box (#1700)
orangecat-rail-check.yml (on demand) runs scripts/test/orangecat-rail-e2e.ts
on the box: it signs real requests with the rail's own secret, read there
and never printed, as the operator's linked OrangeCat actor, and drives what
a Cat Bot's walk_site and use_browser hands drive. A walk that must pass and
one that must fail with its picture; a browser session with open, numbered
elements, click, type, back, a password field refused, the box's own
network and the metadata address refused, close; and the doors' edges
(unsigned, stale, an actor with no account).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 08:44:03 +01:00
CatoandClaude Opus 5.5 74183f9410 fix(runner): a sealed session between tasks does not hold the runner's update; ops: runs-db (#1690)
* fix(check): the loop check prints the agent's screen before it aborts a quiet run

2026-11-12 16:30: the orangecat probe went to Claude Code (Grok's balance was
spent, #1689 routed around it), started, and at 16:55 read "Needs you: no
output for a while" with a clean checkout. Nothing said what the agent was
showing. The check now opens the session's peek stream for twelve seconds
and prints the last twenty lines, masked, before the abort.

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

* feat(ops): runs-db prints a project's last runs and stored handoff, read-only

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

* fix(ops): runs-db reads summary as text and finds the project's session row by name

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

* fix(runner): a sealed session whose project has no open run does not hold the runner's update

The drain counted a sealed session as idle only when its podman relay went
quiet. On 2026-11-12 an idle session's relay moved 3 to 10 KB a minute, so
every open session counted as working, each deploy's drain waited its six
hours behind them, and the runner on the box kept the morning's code all day.

That mattered at 17:00: a probe task to orangecat finished in seconds and
wrote its handoff at 17:00:00, but the old runner acked delivery at 17:00:05
without its injection time (the fix that sends it is on main and not on the
box), so the handoff "predated" its own delivery and the run sat at Needs you.

count_agents now reads the open runs from Loki's database, as
sealed-builds-ctl.sh stop-idle does: a sealed session older than fifteen
minutes whose project or lane has no open run is between tasks. When the
database cannot be read, the old rule stands. between_runs is pinned by
test-drain-and-restart-runner.sh (51 of 51).

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

* revert(check): the loop check's screen look; the peek stream takes a browser session only

It answered 401 to the check's agent token (2026-11-12 17:15), so it printed
nothing useful. runs-db (sealed-builds.yml) answers the same question from
the database: the handoff, its time and the run's delivery stamp.

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

* docs(handoff): Claude did the probe; the late delivery stamp and the drain that never restarts the runner

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 18:39:30 +01:00
CatoandClaude Opus 5.5 b0c6d58ebe fix(dispatch): a chat task does not walk into an agent that has run out; ops: agent-probe asks an agent on the box what it says (#1689)
* feat(ops): agent-probe opens one agent CLI in a sealed container and prints what it says

On 2026-11-12 the runner refused claude 16 times between 14:42 and 14:50 UTC
and grok once at 15:21, "usage limit is exhausted", and kept no screen to
show why. agent-probe (sealed-builds.yml, runs=<agent>) launches the agent as
the runner does, with the credentials sandbox.ts passes through (names only),
sends "Reply with the single word PONG" and prints the masked screen.

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

* fix(ops): the PTY probe answers a modern TUI's terminal queries and its trust prompt

grok drew nothing until the terminal answered its version query (ESC[>0q),
and claude stopped at the trust prompt of the probe's new folder, so the
first agent-probe runs (2026-11-12) never reached the composer.

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

* feat(ops): agent-probe asks one headless turn before the interactive one

grok draws nothing in the probe's terminal; a headless turn has no terminal
to negotiate and prints a quota wall as plain text.

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

* fix(dispatch): a task nobody pinned to an agent does not walk into one Loki has just watched run out

Live 2026-11-12: the orangecat project's agent was Grok, whose Grok Build
balance was used up ("402 Payment Required: Grok Build usage balance
exhausted", read with sealed-builds agent-probe), and every chat message to it
failed in fifteen seconds while Claude Code on the same builder answered.
Kickoff, Implement and the retry already route around a spent agent; the
chat's path, injectPrompt with no agent pinned, did not.

- lib/dispatch-agent-route: agentAvoidingSpent, the same providerChoiceFor +
  routeAroundSpent the kickoff uses; anything unreadable keeps the project's
  agent. Not a preference change.
- inject-core: used only when the caller pinned no agent; a rerouted run
  records reroutedFrom/reroutedBecause for the Watch page; agentNotice in the
  body.
- The chat's dispatch reply says which agent took the task and why.

scripts/test/dispatch-agent-route.ts. Checkpoint updated.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 17:22:59 +01:00
CatoandClaude Opus 5.5 43e1782b22 fix(builder): five agent sessions at once, not eight; idle sealed sessions can be stopped to free memory (#1687)
* docs(handoff): #1678 merged; the box still drops requests and Loki's deploys do not land

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): memory ceiling set at 10 GiB; Gemini spending cap in OrangeCat #1672

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

* fix(builder): five agent sessions at once, not eight; idle sealed sessions can be stopped to free memory

Measured on the box on 2026-11-12: a sealed session holds about 1 GiB, not
the 0.4 GB the cap of eight was sized at. With seven or eight open the
builder held 6.3 to 8.3 GiB, the box had 0.6 GiB left, swap was full, and
the kernel had stopped 37 processes for memory, live sites and the gateway
among them.

- AGENT_MAX_OPEN_DEFAULT is 5. LOKI_AGENT_MAX_OPEN raises it where there is
  room.
- sealed-builds-ctl.sh stop-idle (sealed-builds.yml): stops the sealed
  sessions that relayed less than 512 bytes over two minutes, the line the
  idle rule already uses for "no work". A working agent prints far more
  (its spinner alone). runs=dry lists without stopping. idle_sessions is
  pinned by scripts/hetzner/test-sealed-builds-memory.sh.

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

* fix(spend): the platform's Gemini key is not used where nothing caps it

The audit after the Gemini spend (2026-11-12) found the same platform key in
three places with no cap that refuses a call:

- Loki's own chat chain called Google whenever GEMINI_API_KEY was in its
  env. Google is left out of CHAT_CHAIN (UNCAPPED_PAID_PROVIDERS) until Loki
  has a cap that refuses, like OrangeCat's reserve_vendor_call.
- install-builder-agents.sh copied OrangeCat's key into the builder's env
  for the Antigravity CLI. An agent CLI cannot be capped in code; the
  builder now uses Gemini only with a key of its own, from a Google project
  with a per-day request quota.
- openclaw-media.yml fell back to OrangeCat's key for the Telegram gateway's
  image and video reading. No fallback: with no key of its own, media
  understanding stays off.

Keys already copied on the box stop mattering when the platform key is
replaced; the new key is never copied anywhere.

scripts/test/chat-chain.ts pins all three.

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

* fix(builder): stop-idle stops only sessions whose project has no open run

Bytes are not the signal: on 2026-11-12 eight sealed sessions at their
prompt each relayed 3 to 10 KB a minute through podman, so a 512-byte line
would have stopped none, and an agent waiting on CI prints nothing at all.
A session whose project (or lane) has no open run in Loki's database is
between tasks; one that does is kept, and so is any session under fifteen
minutes old. between_tasks is pinned by test-sealed-builds-memory.sh.

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

* fix(builder): between_tasks reads its list without a pipe into grep -q

scripts/test/no-grep-q-in-a-pipe.ts: grep -q exits at the first match and
can cut off the writer. A here-string has no writer.

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

* docs(handoff): the box recovered; spend caps; the owner's key steps

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 16:39:19 +01:00
CatoandClaude Fable 5.2 54a7024cdc fix(queue, runs, chat, ops): an idle run is closed before the next task starts; a blocked pull request is said in the thread; an address to Loki is not the loki project; the builder can be given a memory ceiling (#1678)
* fix(check): the on-demand loop check signs in on the box, and is red when it cannot ask

The first run of loki-loop-check.yml (2026-11-12, run 43188095136) printed
"down: loki e2e could not mint a session on the box" two seconds in, and
the job was green. Three things were wrong:

- The deploy ships the runner a fixed list of scripts and nothing under
  scripts/test, so on the box there was no test to run and no token
  script. The workflow now carries the check's own files with it.
- The check minted an Auth.js session cookie. Sign-in moved to AccountKit
  on 2026-11-01, where that cookie is no session. It now signs in the way
  a runner does: scripts/test/mint-check-token.ts mints an agent token for
  the operator that expires in two hours, the check uses it as a bearer
  and removes it on exit. The cookie mint stays as the fallback.
- A check that could not sign in exited 0. With the verdict asked for, it
  exits 1, and it says why (long strings masked).

scripts/test/loop-check-signs-in.ts pins all of it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): what production showed after the first fix, and why the check could not sign in

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(check): the loop check prints Loki's own reason for a task that does not start

Its first full run on the live site (2026-11-12, run 43191224470) ended
"still queued (Queued) after 35 min" and then guessed at the builder's
sign-in. The run route already answers the track's sentence for an open
run (detail), and the chat's reply says where the task went: the check
prints both, right after the dispatch and again when it gives up.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): the first full check on the live site, 4 of 5

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): why the probe did not start, in Loki's own words

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(chat): an address to Loki is not the loki project; the loop check reaches the project it was sent to

A project named in a message outranks the selected project, on purpose
(lib/loki-fleet-commands). The assistant is called Loki and so is one of
the projects, so "Loki, add a dark mode toggle" typed with orangecat
selected was sent to the loki project.

Found through the loop check on the live site (2026-11-12, run
43198552471): asked for project orangecat, it came back "Sent loki to the
cloud runner", because its marker was "[loki-e2e]". Three runs in a row
had waited behind the loki project's open run while reporting on a
project the probe never reached.

- project-mention: withoutAddressTo removes an address to the assistant
  before matching: the name at the start followed by punctuation, after a
  greeting, "@loki", or set off by a comma at the end. "Loki's sidebar",
  "in loki" and a bare "Loki fix the header" still name the project.
- loki-loop-e2e: the marker is "[e2e-probe]" and names no project, and the
  check fails at once when Loki dispatched to another project than the
  one it asked for.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): the probe had been going to the loki project; the routing fix

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(queue): a run that has gone silent gives its project to the waiting message

A project's shared session takes one message at a time: the claim gate holds
the next one until the run ahead has closed. A run closes when its agent
reports. An agent that ended its turn without reporting still has a process
at its prompt, and the reaper shelters a run with a live process for up to
MAX_RUN_HOURS, so the next message could wait twelve hours behind a session
that was doing nothing. On the live site (2026-11-12) messages sent through
Loki's chat read "This project is still on an earlier task" and were still
queued 25 to 35 minutes later.

- lib/orchestration/quiet-lane: the rule, pure. The runner beats while the
  terminal prints and while the agent waits at a sign-in or an approval. No
  beat for 20 minutes (twice the window after which every surface says
  Stalled), not waiting for a person, no command outstanding, and still so
  90 seconds after it was first seen: release. The second look covers a
  runner that could not beat for a while and whose first request back is
  the claim.
- db/queries/quiet-lane: reads those facts for the run at the head of each
  lane a message waits in, through olderOpenRunSql, and closes it with the
  reaper's own verdict (partial with the handoff note, else timeout with the
  sentence), ended at its last beat. No escalation.
- claimNextPendingCommand calls it before the gate, so the message is
  claimed in the request that closed the run.
- The waiting sentence carries the bound.

A working agent prints, so its beat is seconds old at any age and it keeps
its lane. Nothing is closed when nobody is waiting.

scripts/test/quiet-lane.ts, and five scenarios in
scripts/test/lane-and-reaper.ts against a real Postgres (13 of 13 locally).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(runs): a pull request that cannot merge is said in the thread, with the message that repairs it

The fleet's sweep merges a green pull request and leaves a red or conflicted
one waiting. A task sent from the chat that ended at such a pull request read
"done, it merges on its own" until somebody opened GitHub.

- feedback/fix-shipping: PrBlocker, prBlockerFor (a conflict when GitHub says
  mergeable: false, else the names of the checks that failed; cancelled and
  still-running are not failures), prBlockerNews (once per commit and reason).
- feedback/fix-shipping-refresh: readBlockers on the refresh input; only then
  are the head commit's check runs and statuses read.
- run-follow-notify: the fifteen-minute follower asks, and on news writes one
  line into the thread the task came from and sends one push. The line ends
  with the message to send ("<project>: fix the failing checks on <pull
  request> and push to the same branch."): a message naming a project is a
  task for it.
- Loki does not send the repair itself: no agent run nobody asked for
  (lib/auto-dispatch).

scripts/test/run-follow-notify.ts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): the 11:17 rehearsal failed on a slow box: sign-up 504, 96% memory, a 503 window

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): bots do not answer on the live site (502, 11:39 UTC); OrangeCat #1672; #1678 green

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(queue): only a run whose runner has reported output can be read as having stopped

A runner from before the beat existed reports nothing while its agent works.
Silence since delivery would have closed such a run after twenty minutes and
typed the waiting message into a working session. A run that has never
beaten now keeps its lane; one that truly never printed is the reaper's,
which closes it as never started from the runner's own unverified ack.

scripts/test/quiet-lane.ts, and a sixth scenario in
scripts/test/lane-and-reaper.ts (14 of 14 locally).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(ops): the box usage report prints the builder's memory budget and finishes on a slow box

On 2026-11-12 the box had 0.6 GiB available and no swap left, and the report
was cancelled at its 20-minute limit inside the first du. Each disk walk now
gets a minute. A new section prints what the runner unit holds, whether it
has a memory ceiling, and which cgroup the sandboxes' processes are in:
sandbox.ts relies on the unit's MemoryMax to bound sealed sessions.

Read-only, names and sizes only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): what holds the box's memory, measured; the builder has no ceiling

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(queue): an idle run is closed before the next task starts; the runner's six-hour stop and a turn answered in seconds are read correctly

Three faults in the idle rule (#1680), found by an independent review and
shown failing first in scripts/test/lane-and-reaper.ts against main (13
passed, 4 failed; 17 of 17 after):

- An idle run stopped holding its project but stayed open until the hourly
  reaper. The next task went into the same session, and its ready handoff
  closes every delivered open run of the project, so the idle run was
  recorded as done with the other run's summary. The claim now closes the
  idle run first, with the reaper's own function and sentence, and only when
  a task is waiting in that project (db/queries/idle-run-close).
- The runner stops beating six hours into a run. Half an hour later the run
  read as idle while it printed, and the next prompt went into a working
  session. A last working beat at that horizon is not read as silence
  (RUN_PROGRESS_HORIZON_SECONDS).
- A turn that ended before the runner began reporting on it never had a
  working beat, read as unknown and held its project for up to twelve hours.
  Every beat stamps lastBeatAt; a run the runner reports on that has printed
  no work since delivery is idle after the same half hour. A run with no
  beat of any size keeps its lane, as before.

scripts/test/idle-run-release.ts, scripts/test/lane-and-reaper.ts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(ops): the box usage report can be asked for memory alone

The disk walks took the whole 20 minutes twice on 2026-11-12, on a box that
was swapping, when only the memory was wanted. what=memory stops after the
memory sections.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* feat(ops): the builder can be given a memory ceiling, read and set from the Sealed builds workflow

Measured on the box, 2026-11-12 12:19 UTC: loki-box-runner.service held 6.3
GiB with MemoryHigh and MemoryMax at infinity, every sandbox process is in
that unit's cgroup, the box had no swap left, and the kernel had stopped 30
processes for memory since boot: the gateway 15 times, a live site 3 times,
a sandbox 3 times. Every site unit has a 1G ceiling; the builder had none,
though sandbox.ts relies on the unit's MemoryMax to bound sealed sessions.

sealed-builds-ctl.sh gains three modes, run from sealed-builds.yml:
- memory: read. What the builder holds, what bounds it, what the box has left.
- memory-set, runs="<GiB>": MemoryMax and MemoryHigh one below it, and the
  builder's processes are marked to give first when the whole box runs out.
  Refused when the ceiling is below what the builder holds now, because that
  stops sessions at once; "force" after the number sets it anyway. Nothing
  is restarted.
- memory-clear: undo.

Nothing is set by a deploy. It is a decision, applied by a person.

scripts/hetzner/test-sealed-builds-memory.sh, in test:ops.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(runs, chat): the blocked pull request notice is said once and its repair reaches the right project; an address to Loki is set off, and is the project when nothing else is

From the independent review of this branch, each finding confirmed by a
second agent told to refute it.

The notice:
- It would have repeated every tick. "Already said" lived in the ledger, the
  ledger is rebuilt on every refresh, and the dispatch card's own refresh
  does not read blockers. It is kept beside the ledger now
  (payload.prBlockerSaid, per reason), written once the line is in the thread.
- Its repair line named the pull request by link. The link carries the
  repository owner's name, and a project of that name won the match: the
  repair for loki went to Bitbaum. The line names the number, opens with
  "In <project>," and uses a verb the chat's own rule takes as a task, for a
  conflict as well. The test sends it through projectMentionedIn and
  looksLikeDispatchTask for four projects and both reasons.
- action_required and stale count as failed: neither turns green by waiting.

The address:
- "ok loki is broken, fix its header", "loki-loop-check is red" and "run the
  tests on @loki" lost the project; "Loki - add a toggle" kept it. An address
  is the name set off from the sentence (a comma, a colon, any dash with
  space around it, "please", "can you"), at the start of any sentence.
- "loki: fix the header" is read as an address, so a selected project gets
  the work; with nothing selected and no other project named, the name is
  the project (projectNamedByAddress, the last resort of both paths).

scripts/test/run-follow-notify.ts, scripts/test/project-mention.ts (114).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(ops): the builder's ceiling is a ceiling only; docs(handoff): the box's memory, the review's findings, what is ready and not applied

memory-set no longer sets MemoryHigh one below the ceiling: at the moment it
is set the builder holds close to the ceiling, and a mark under what it holds
would slow every session at once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): the box's memory now holds up OrangeCat merges: Browser smoke is red on main

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 14:09:49 +01:00
CatoandClaude Fable 5.2 64e2c6b543 fix(builder, runs): a held task waits minutes and says so; a build says when it is live (#1663)
* docs(handoff): checkpoint for building with Loki and with a Cat bot

The objective, the two journeys that count as done, how production can be
reached from an agent session, and the state when the work began.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* docs(handoff): what the investigation found, and what it did not reach

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(builder): a task held for the runner's update waits minutes, not for ever, and says so

While the cloud runner is behind the deploy the commands route hands it no
work-starting command, so the idle moment its restart waits for comes. The
hold had no end, and on 2026-11-12 the restart did not come: two runner
releases landed 35 minutes apart, the drain read "5 agent(s) working" on
every look for an hour, and the builder claimed screen peeks and nothing
else (Sealed builds run 43165605499). Every task a person sent sat queued
while the chat said a runner would claim it shortly.

- runner-update-hold: a held command is handed over once it has waited
  five minutes, and the hold applies only within two hours of the newest
  runner release. Running on last week's runner is recoverable; a task
  that never starts is not.
- claimNextPendingCommand takes the overdue rule. While holding, an empty
  at-once list claims nothing (it used to claim everything).
- The person is told why and for how long: in the chat reply, in the
  /api/inject answer (builderUpdating, message) and as the run track's
  headline while the job is unclaimed.
- loki-loop-check.yml: the end-to-end check of the live site on demand,
  with an optional real no-change task that must come back into its
  thread. loki-e2e-check.sh --report takes the project, the wait and the
  dispatch choice from its caller.
- sealed-builds.yml mode=activity: read-only, what each agent process of
  the runner read and wrote over a minute, so the drain's "working" can be
  measured for sessions it cannot read a status for.
- pre-push: the watchdog's sleep no longer holds the caller's output open
  for fifteen minutes after the push has landed.

Server and box scripts only: no runner code, no runner version.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

* fix(runs): a build tells the truth after the agent finishes, and says when it is live

A task sent from the chat ended at "done, pull request opened". What it
said next was wrong in several ways, and the one thing a person waits for,
that it went live, was said to nobody.

- The "done" message reads the pull request the runner itself reported
  (payload.prUrl from closeRunShipped, read by nothing until now) and asks
  GitHub with the token that can read the repository. The person's own
  OAuth token is refused on the organisation's repositories, so a run that
  shipped could be posted as "No pull request or push was found". The
  reaper's evidence lookup asks the same way.
- "Live" is read from the site: a merged change is live when the commit in
  the site's /.well-known/fleet-release.json is the merge or comes after
  it (feedback/served-release). Workflow-run labels are wrong on this
  fleet: a Deploy run is labelled with main's tip at its start, a batched
  merge has no Deploy run of its own, and OrangeCat's deploy is named CD.
  It only upgrades; with no receipt the workflow-run verdict stands.
- A chat build is followed to live on the fifteen-minute cron that already
  follows feedback fixes (run-follow-notify): on the change to live, or to
  a failed deploy, one line in the thread the task came from and one push.
  GitHub and the release receipt only, no model. Old news is not announced.
- A task that waits behind the project's earlier run says so in the chat,
  the /api/inject answer (queuedBehind, message) and the track, instead of
  "will claim it shortly".
- Isolated runs ship through a pull request: worktreePromptNote told every
  lane and one-off session to push straight to main.
- The close message no longer prints "Live: <address>" beside a pull
  request that has not merged.

Server only, plus one prompt line the runner reads at its next start. No
file under desktop/, no runner version.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:48:29 +01:00
Cato 51c6e238dc ops(box): see who holds Postgres connections, reap idle ones on request (#1651)
* ops(box): read who holds Postgres connections, and reap idle ones on request

* ops(box): reap also caps idle loki sessions at 15 minutes
2026-11-12 08:03:07 +01:00
Cato 0d8a06f099 ops(hetzner): check and repair a corrupt grubenv from a workflow, dry run first (#1636) 2026-11-12 05:14:12 +01:00
CatoandClaude ddd57fe562 fix(builder): sealed agents start after a reboot; the cloud builder caps open agent sessions (#1634)
* fix(runner): the cloud builder keeps at most eight agent sessions open

On 2026-11-11 the box had 27 agent CLIs open, about 0.4 GB each, beside 21
live sites on 16 GB. Memory ran out and every site went down. Plain shells
were capped at three; agent sessions were not capped at all.

- lib/agent-session-limit: eight by default (LOKI_AGENT_MAX_OPEN changes
  it), cloud builder only, shells not counted, re-opening an open tab is
  never refused
- /api/agent/launch refuses the ninth with a sentence that says to close
  one; Resume and New session already show that error
- launchAgentPty refuses it again: every way in ends there (launch,
  dispatch, switch, tabs restored after a restart) and the server's count
  can be one heartbeat old

Idle sessions are still not closed by themselves.

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

* fix(builder): sealed agents start again after a reboot; runner 0.8.64

After the power reset of 2026-11-11 every sealed agent failed with 'the
container failed to start: it exited before printing anything'. podman keeps
its runtime state under the runner's $HOME/.run, a real directory, so the
state outlived the reboot and podman refused every container ('current
system boot ID differs from cached boot ID').

- the sealed drop-in gets an ExecStartPre that removes that state when it
  was written before this boot, and leaves it alone otherwise
- sealed-builds.yml mode reset-runtime does the same by hand for a runner
  that is already up
- desktop/package.json 0.8.64 with its release note: the session limit
  changed the runner

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 14:39:00 +01:00
CatoandClaude c403e23fb2 ops(hetzner): the disk cleanup reaches what actually fills the box (#1631)
Its first complete run (2026-11-11, dry) would have freed nothing: every
app was already at two releases and the 127G in use was elsewhere. Six
tiers written from that day's usage report, each dry-run first:

- container logs over 200M are truncated (one was 2.2G), syslog rotated
- /opt/<app>/app-prev-* copies older than 14 days (kivvi kept seven from
  July), never the live app or the rollback target
- superseded browser downloads under ~/.cache: the newest of each is kept
- superseded agent CLI versions: the two newest are kept
- pnpm store prune
- node_modules and build output inside checkouts and agent worktrees idle
  for 14 days and not in use; source is never touched

The target percentage is an input (default 75). Database dumps and
Solon's 17G of places-snapshots are deliberately not here.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 13:07:04 +01:00
CatoandClaude cf7b404820 fix(ux): signed in means the app; a task shows what was asked; sessions lead with what needs you; key names for OrangeCat (#1629)
* design: Loki has no orange; the public call to action is the achromatic accent

The app's own buttons went monochrome on 2026-10-19; the public site kept
a warm orange (#ff5c00) on Start a project, Get started, the auth submit,
the focus ring and the essay progress bar. It is not Bitcoin orange and it
means nothing on a product that is not about Bitcoin (owner, 2026-11-11).

- --accent-warm, --accent-warm-hover and --public-accent are removed; every
  class that used them reads --accent-primary / --accent-hover, so one
  filled button exists in Loki and it is theme-aware
- --on-accent is the inverted text. It was a fixed near-black, which on the
  near-black light-theme accent left .ui-btn-xs.ui-btn-primary unreadable
- the focus ring and the public glow are neutral
- token-drift declares the divergence from @bitbaum/design-tokens; the
  widget theme is regenerated from the tokens

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(workbench): a failed task says why and gives the words back

Sent an OrangeCat task from the workbench on 2026-11-11. Claude was signed
out on the cloud runner; the status API said so with the fix, and the
composer showed the two words 'Dispatch failed' over an emptied box.

- dispatchFailureForPerson: a signed-out agent is named in the sender's
  words; any other reason is passed through instead of dropped
- the composer shows that reason under the label and offers 'Put my words
  back', since the box is cleared on send

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(nav): the phone's chat screen names Home, Projects and Terminal

The owner, signed in on a phone on 2026-11-11, could not find the terminal.
The chat is the default screen and hides the tab bar; its left button opened
a list of chats and nothing else, and its menu offered 'Projects' (which
only set the chat's project) and 'Everything else'. The page itself was
called Sessions, so no menu contained the word.

- CHAT_PLACES (config/navigation.ts) is one list of Home, Projects, Terminal
- the chat menu lists them by name, then 'All pages'; the item that sets
  the chat's project says so
- the chats panel the left button opens lists the same three, phones only
- the page is called Terminal in the nav, its title and its links

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(sessions): a signed-out Claude is one button in the chat view

A session opens in its Chat view. When Claude's login had expired, that view
showed the agent's own line, 'Please run /login', and reply chips that would
fail the same way; the 'Sign in /login' button existed only in the Terminal
view. The owner, on a phone, could not find how to sign in (2026-11-11).

The chat view reads the reply through the same detector as the terminal
(screenActions) and offers 'Sign Claude in', which types /login and switches
to the terminal where the link is printed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(ux): signed in means the app, and a retried task shows what was asked

Two more things the owner met on a phone on 2026-11-11.

- Opening loki.orangecat.ch while signed in showed the marketing page and
  its marketing menu; the way in was a button. A signed-in visitor now lands
  in the app (APP_HOME; RUNNER_HOME inside Fleet Runner). ?site still opens
  the homepage on purpose, and signed-out visitors are unchanged.
- A retried dispatch opens with the escalation block, longer than the 200
  characters isOperatorEnvelope read, so the whole packet ('Escalation
  state … rung 3/4', 'Exit contract') was drawn as the person's message. It
  is recognised now; the bubble shows the task, the packet is one tap away.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* feat(orangecat): tell OrangeCat which provider keys a person holds here, by name

The owner's xAI key was on Loki and not on OrangeCat: for the same linked
person Loki's chat answered on grok while OrangeCat's Cat sat on an
exhausted free pool, and neither product could say the other had a key.

The signed actor-status reply now carries modelKeys: vendor, model and the
last-characters hint, one per vendor, never a custom endpoint and never a
key. OrangeCat uses it to suggest adding the same key there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* fix(sessions): the phone's session list leads with what needs you

The picker listed every open session in the order it was opened: 27 rows,
'Loki 2' to 'Loki 15', with the three waiting on the owner somewhere among
them (2026-11-11). orderSessions puts waiting, working and finished
sessions first, with the one in use, and folds the merely-open ones behind
one row, 'N more open sessions'.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

* ops(hetzner): a read-only report of what uses the box's memory and disk

On 2026-11-11 the box sat at 91-95% memory and 91-93% disk; both sites
reset connections and CI could not sign in against production auth, and
nothing could say what was using either. disk-cleanup.sh reclaims disk;
nothing measured memory.

box-usage.yml runs scripts/hetzner/box-usage.sh over the same SSH setup as
box-doctor. It prints memory by program (names only, never a command
line), agent CLI and browser counts, out-of-memory kills, container
memory, and the largest directories, and changes nothing.

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

* fix(ops): the disk cleanup measures within a budget, so it reaches its plan

Its first run (2026-11-11, dry) was cancelled at 30 minutes having printed
four sizes and planned nothing: du on /opt alone took 14 minutes on a disk
full of node_modules, and the script measures every release before it
plans a single tier. Sizes are for the reader; what was freed is read from
df. Each size now gets 45 seconds and prints 'over 45s' instead of waiting.
The inventory also names /home/ubuntu and the agent directories under it,
which the first run never reached. Workflow limit raised to 60 minutes.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 10:38:32 +01:00
Cato 7909050674 ops(hetzner): add a dry-run-first box disk cleanup workflow (#1623)
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 12:21:24 +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 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 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 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 bca4720538 ci(backups): a merge that touches the backup installer applies it to the box (#1572)
install-backups.sh reached the box only when a person ran it over SSH, so
#1564 (dumps written 600) never arrived: the nightly dumps, which hold every
row of a product, stayed 644. install-backups.yml applies it on a merge that
touches it, or on dispatch, like install-box-alerts.yml: the runner, its
timer, and one backup at once. It then tightens the dumps already on disk to
600 and counts the files per mode in the log; any file still not 600 fails
the run. Names and modes only.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 00:16:01 +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 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 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 ec00b7ec16 fix(ops): analysis-beta bootstrap runs by dispatch only (#1554)
It registered biaslens on 2026-10-22; biaslens has deployed through its own
deploy.yml behind the rollout gate since. Running it after every loki CI
redeployed biaslens out of band through deploy.sh, which no longer finds
the runtime files it expects, so it failed on every main commit.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 11:16:36 +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 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 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 169f920055 fix(desktop): Linux AppImage keeps the Chromium sandbox on (#1521)
Every Linux launch passed --no-sandbox. afterPack.cjs wrapped the
Electron binary in a stub that added it unconditionally, the .desktop
Exec= line carried it (electron-builder's AppImage default), and the
systemd unit from install-fleet-runner.sh passed it again. The reason
was real but narrow: inside an AppImage the setuid chrome-sandbox can
never work (the FUSE mount is nosuid), so where unprivileged user
namespaces are also blocked Chromium aborts at FATAL. Everywhere else
the namespace sandbox works without any setuid helper, and the flag
switched off the renderer sandbox #1479 had turned on.

- desktop/scripts/linux-launcher.sh replaces the stub. It runs
  Chromium's own probe (create a userns, write its maps, nest another)
  and the setuid-helper check for .deb installs, and passes
  --no-sandbox only when neither is available (or as root). It then
  prints why and how to fix it, and sets FLEET_RUNNER_SANDBOX_OFF.
  It also reports a --no-sandbox that arrives on argv, including the
  one electron-builder's AppRun appends silently.
- The main process shows that reason as a notification.
- linux.executableArgs is [] so the .desktop entry stops passing it.
- The systemd unit no longer passes --no-sandbox.
- The stale-instance pgrep no longer requires --no-sandbox in argv.
- Packaged-build test: test-linux-sandbox.sh starts the real AppImage
  under Xvfb and checks the live process tree (main argv; renderer
  seccomp-bpf and its own user namespace). ci-linux-sandbox.sh runs it
  with Ubuntu's userns restriction off (must be sandboxed) and on (must
  still start, with the notice). New PR workflow
  desktop-linux-sandbox.yml, and a step on the Linux release build.
- Version 0.8.62 with its changelog entry.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 19:18:22 +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 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 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
CatoandClaude 49f0771666 ops(register): a daily check that the box's register matches main (#1493)
register-site.sh writes a new row into the box's checkout first and
opens a PR to carry it to main. When that PR stalls, the two registers
disagree without anyone being told, and main hands the port out again:
biaslens and signin both on 4038 (#1404, #1492). register-drift.yml
reads the box's apps.conf over the deploy SSH each day and fails on a
box-only or differing row (names and ports only); a main-only row is
reported as the box checkout lagging.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-31 20:46:03 +01:00
CatoandClaude 847be47b64 ops(hetzner): provision-db workflow — a host database without a laptop (#1487)
provision-db-on-box.sh was only ever run from a laptop, so a registered
app with no box env (signin) failed every deploy until someone did. The
new dispatch-only workflow runs the same script on the runner over the
deploy's SSH key, in its own concurrency group. provisionable-db.sh
gates the input on the register: only a host database under the name
the script derives from the slug. Names only in the log; the script
never overwrites a key, so a re-run is a no-op.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-31 19:26:13 +01:00
Cato 2ff28da1ed fix(deploy): expose only the public package receipt path (#1448) 2026-10-27 18:32:15 +01:00
Cato d8584cc8cf ci: publish and verify Loki package release receipts (#1447) 2026-10-27 18:00:32 +01:00
Cato f26465c56b fix(deploy): fail closed when receipt visibility is unknown (#1439) 2026-10-26 10:32:04 +01:00
Cato cfa4d0766a feat: include configured workspace projects in release receipts (#1438) 2026-10-26 08:17:29 +01:00
Cato f2cd986c7c fix(deploy): keep CI runtime environment outside source checkout (#1435) 2026-10-25 19:08:18 +01:00
Cato 9b85906350 feat(deploy): stage public Fleet artifact receipts beside served apps (#1430) 2026-10-25 18:49:40 +01:00
CatoandClaude c0bd46806d fix(box): app-secrets runs in its own concurrency group (#1422)
GitHub keeps one pending run per concurrency group and cancels the older
pending run when another arrives. The first app-secrets run queued behind a
deploy in `deploy-prod` and was silently cancelled by the next deploy
(2026-10-22 21:16, no job ever ran). The workflow touches one app's env and
restarts that app; a deploy does not edit .env, so it needs no lock with
deploys — only with itself, per app.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 23:43:08 +02:00
CatoandClaude Fable 5.1 8c9c9b3c01 feat(box): app-secrets — generate an app's machine secrets on the box from GitHub (#1419)
* feat(box): app-secrets — generate an app's machine secrets on the box from GitHub

The secrets an app needs that no human holds: a cron bearer token the box's
own timer presents, and a Web Push (VAPID) key pair. Until now they were a
"generate this and paste it into /opt/<app>/shared/.env" ask handed to the
owner, who on 2026-10-22 — heidi's channel notifications waiting on exactly
that — rightly declined to run openssl for a value nobody will ever read.

scripts/hetzner/app-secrets.sh holds the registry (app|VAR|kind: hex32,
vapid, literal) and the rules: it adds only what is missing and never
overwrites, treats a VAPID pair as one unit, prints names and never values,
and restarts <app>-app only when it added something. Values are made on the
caller's side and travel to the box on ssh's stdin, never in argv or a log.
.github/workflows/app-secrets.yml runs it from GitHub over the deploy's SSH
(show | ensure), then re-runs install-app-crons.sh so a timer exists to
present the new CRON_SECRET.

First registered app: heidi (CRON_SECRET, VAPID_*, subject = the site's
contact address). Checked against a fake box: show, ensure, a second ensure
that adds nothing, the half-pair refusal; the generated pair is 65 + 32
bytes and web-push accepts it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

* test(terminal): the swipe test drags a finger that stops, over a deeper buffer

terminal-swipe-browser failed twice on one commit in CI (1 !== 0: the
"as far back" note was already showing after the first swipe) and passed
on main an hour earlier. Two things made the first swipe land on the
oldest line instead of short of it:

- The synthetic swipe lifted at full speed. CDP delivers the twelve moves
  a millisecond or two apart, the scroller reads that as a very fast
  finger, and the glide after a flick runs on that speed — on a quick
  runner one 300px swipe glided past every kept line. Six still moves
  before the lift decay the smoothed velocity to nothing (×0.2 each), so
  a swipe now moves exactly what the finger moved.
- 120 lines was no margin: at 390px the fitted font gives ~66 rows a
  screen, so only ~54 rows sat above the fold and a 300px swipe (~54 rows
  at that cell height) reached the top exactly. 300 lines leave 180 rows
  after the first swipe; the "to the top" loop allows twelve swipes.

Measured locally: start 234 → 180 after one swipe, top reached inside the
loop, the note on the swipe past it; three runs green.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 23:12:48 +02:00
CatoandClaude 105f75ef88 feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#1417)
chatkit 0.14 carries the contract both ways; this is Loki's side of the
fleet chat-review loop (docs/architecture/chat-review.md).

- Thumbs under every Loki answer: chatkit's AnswerActions with onFeedback
  replaces the hand-rolled "Bad answer" button and ReportAnswer form. The
  thumb goes to POST /api/chat/feedback (new chat_feedback table, migration
  0128); a thumb down is still filed as a report in Loki's own inbox through
  the same plumbing the old button used (lib/loki/answer-report-file.ts).
  The terminal's Loki rail and the prompt Run sheet pass onFeedback to
  ChatThread.
- GET /api/chat/review-export: Loki's day of conversations as
  ChatTranscript[] behind the shared CHAT_REVIEW_TOKEN (bearer, constant
  time, 503 while unset), scope derived from Loki's own prompt
  (lokiChatScope). Never a temporary chat; no names or user ids.
- src/config/chat-review.ts (SSOT): the four products, their export URLs
  and repos, the night's budgets.
- Cron review-chats at 03:40: fetch each product's export, then start one
  agent run on the product's Loki project (found by gitUrl, as its owner)
  carrying chatkit's CHAT_REVIEW_INSTRUCTION + reviewPrompt for every
  conversation and the door to file findings through (widget token + agent
  pass, Origin = the product). The route calls no model: no box timer may
  spend the free AI tier (no-free-background-ai), so the judge is the
  project's agent, the way AI review reads a live page. Outcome per product
  under debug_logs crons/review-chats.
- share-chat-review-token.yml: generate the token on the box into Loki's
  env, copy it to heidi, orangecat, substrata when absent, redeploy all four;
  the value is never printed.
- .env.example, docs/architecture/chat-review.md, link from the widget doc.

Verified: pnpm run verify green through test:unit (540 files) and the
remaining gates; test:ops fails only on .env ownership in the root sandbox.
Thumbs rendered at 390px in headless Chromium: 44px targets, no sideways
scroll, the app receives {messageId, verdict, reason} on Send.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 19:56:40 +02:00
CatoandClaude 48b0dc04cc feat(mailgate): every app host receives mail at hello@, delivered signed to the app (#1412)
loki-mailgate is the receiving half of the fleet email standard: one
public address per app on its own host (hello@<app host>), no mail server
or mailbox per app.

- Receive-only SMTP on :25 (smtp-server). Routes by apps.conf (Loki's live
  copy, refreshed by every deploy, plus the one installed beside it), so a
  new site gets mail after the next deploy with no step here. Accepts only
  hello@, postmaster@ and abuse@; refuses everything else at SMTP time, so
  it never bounces and cannot relay.
- SPF / DKIM / DMARC checked (mailauth); failures are marked, not dropped.
- Spooled to disk before "250", then POSTed to
  http://127.0.0.1:<port>/api/mail/inbound signed with the fleet key
  MAIL_INBOUND_SECRET (mail-kit 0.2 inbound contract), retried with backoff
  until the app says 2xx. Delivered mail is pruned after 14 days: the app's
  own retention governs its copy.
- Bundled to one file; a systemd unit with CAP_NET_BIND_SERVICE as ubuntu,
  ProtectSystem=strict; install-mailgate.sh creates the secret and its own
  STARTTLS key and opens 25/tcp; the manual Mailgate workflow tests,
  bundles and installs. test:mailgate joins verify.

Checked end to end against the bundle: hello@skif accepted and delivered
with a valid signature; another mailbox and an unknown host refused 550.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 18:46:06 +02:00