418 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
CatoandClaude 1236487dd8 feat(site-cd): name the first admin when a site is created (#1779)
When Loki registers a new site for a person, their OrangeCat subject is
written to the site's runtime env as OWNER_ACTOR_IDS (fleet AGENTS.md,
"The back office", rule 2). Only in the run that creates the env, never
over a line already there, and only when the subject is a plain account
id. No linked OrangeCat account: skipped with one log line.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-30 22:23:20 +01:00
Cato 964777b7ac Make Memory explain projects, next actions and the research behind them (#1740)
* feat: connect project purpose, next actions and research in Memory

* test: resolve superseding essays through the real dynamic route
2026-11-30 05:51:51 +01:00
Cato c0ab1f8644 fix(runs): a run with no agent is never Working or Needs you (#1749)
Run status now reconciles with the runner (lib/run-status), once, in the
run-track loader that /api/control/sessions, Watch and the run and command
routes all read:

- an open run whose agent the runner no longer has (a fresh snapshot taken
  after delivery does not list its tab, or the runner reported the agent
  exited) is Failed, cause agent_gone, "Agent exited without answering;
  Retry" (botsmann 51bbcc27 and loki 3a5a7c2b read Needs you with nothing
  listening);
- a finished run is Done or Failed, keeping what is left to do with its
  change in nextAction (six sessions read working weeks after their agents
  finished);
- the run and command routes take the run's status over the track's live
  word, so they cannot disagree with the session list.

A pull request the agent named in its handoff and opened during the run is
the run's even on a branch the runner never saw: an agent working in its own
worktree pushes from another branch than the session's checkout, and run
57632eae's track said "Nothing reached GitHub" beside loki#1747. Loki still
acts only on pull requests from the run's own branches.
2026-11-29 19:54:25 +01:00
Cato 0e2db3e4b8 fix(ops): a wake proxy left failed after a site goes offline is not an incident (#1753)
Taking a site offline stops its wake socket and proxy and keeps both unit
files. A proxy that was already failed stays in systemd's failed set, the
not-found sweep does not see it, and nothing will start it again. keller-wake
was that record: offline since 2026-11-01, then dispatched with an empty
journal. Offline now clears the failed state, and the sweep clears a wake
proxy whose socket is not enabled. A proxy whose socket is still enabled
still pages.
2026-11-29 17:42:23 +01:00
CatoandClaude 11d49dd560 docs(infra): verified server facts in hetzner-migration box layout (#1768)
* docs(infra): verified server facts in hetzner-migration box layout

Put the gitea and bitbaum server facts, each dated with how it was
verified, in the existing box-layout section and drop the stale bitbaum
spec text they replace (2026-09-04 measurement, historical disk caveat;
git history keeps both). Add `Last verified: 2026-11-23` at the top.

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

* docs(infra): delete servers.md; README points at hetzner-migration.md

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 10:41:34 +01:00
CatoandClaude 0aadc7d940 feat(telegram): the linked notification chat talks to the owner's Cat (#1769)
A message (text and/or photo) from a linked chat that is not /start or
/stop is acknowledged at once and handed, after the response, to
OrangeCat signed with x-loki-signature + issuedAt on the shared
ORANGECAT_WEBHOOK_SECRET rail. OrangeCat stores it in the person's
conversation with the Cat. The Cat's answer comes back through the new
signed POST /api/orangecat/telegram-reply and is sent to that person's
own linked chat with an "Open in OrangeCat" button (the no-button rule
is unchanged). A message that cannot reach the Cat always gets a
one-line reason. The new senders are registered in
docs/telegram-notifications.md.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 08:59:43 +01:00
CatoandClaude Opus 5.5 ff2d7cb6b7 Pictures out of Postgres and off the disk, into a private R2 bucket (#1771)
* feat(media): keep pictures in the private R2 bucket, drain them out of Postgres

The owner's rule: pictures live in Cloudflare R2, not in Postgres or on the
box's disk, and the database gets cleaned up.

- src/lib/media/r2.ts: a small S3 client for R2, SigV4 by hand (node:crypto
  + fetch, no SDK), on the fleet's PHOTOS_S3_* names. Everything is private:
  MEDIA_PRIVATE_S3_BUCKET, or private/loki/ in the photos bucket. Unset means
  behaviour exactly as before.
- Chat pictures and report screenshots are written to the bucket when it is
  configured; the row keeps the key (additive migration 0140: nullable
  object_key and screenshot_keys). Reads try the bucket, then the old column.
  A write the bucket refuses stays in Postgres, so nothing is lost.
- A throttled drain started from instrumentation moves what Postgres still
  holds (chat images, report screenshots, executed commands' attachments):
  small batches under a transaction-scoped advisory lock, upload, HEAD to
  verify length/type/MD5, then key-and-null in one statement; error backoff,
  IMAGE_DRAIN=0 kill switch, progress on /api/health under `media`.
- Commands that have not run keep their base64: runners hold no bucket
  credentials. Retry puts moved bytes back before re-sending.
- Bot shots, private tile shots and preview pictures go to the bucket when
  configured, the temp folder otherwise; bucket caches keep their age limits.
- Deleting a chat or an account deletes its objects by prefix.
- Dropping the emptied columns stays a manual step (apply-schema.sh refuses
  DROP COLUMN): docs/infrastructure/media-storage.md.

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

* fix(media): private pictures only in MEDIA_PRIVATE_S3_BUCKET, never the photos bucket

The photos bucket (fleet-media) gets a public domain, so a private Loki
picture must never fall back into it. The private store now needs
MEDIA_PRIVATE_S3_BUCKET; unset, or equal to PHOTOS_S3_BUCKET, counts as
unconfigured: pictures stay in Postgres as today, the drain does not run,
and the env check warns in one line.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 07:21:50 +01:00
CatoandClaude Opus 5.5 29bfe8012a feat(browser): Terminal → Browser — watch a bot's browser live and take it over (#1772)
The browser Loki's agents and Cat Bot already drive (lib/bot-browser) gets
a screen: a third view of a session beside Chat and Terminal, beside the
conversation on a wide screen and in its place on a phone, with the agent
box under it.

- CDP screencast while someone watches (6 fps, newest wins), drawn by the
  existing RobotBrowser, which gains onTap
- one wheel: a person's step takes it; every bot step (a look too) answers
  TAKEN_OVER until hand-back, and the bot's next look carries handedBack
- the password/code/card refusal shows as "<bot> needs you" with Take over
- caption, pointer on the bot's target, "What happened" timeline (never
  typed text); native <select> offered as a picker; dialogs said in words
- memory: every browser's process tree measured (PSS), closed over 700 MB
- doors: /api/browser/live + /input (a signed-in person, own browsers only),
  /api/browser/step (the account's ck_ token, for Terminal agents),
  /api/browser/sessions; cloud-builder accounts only; demo denied
- /screen redirects to /terminal?view=browser
- scripts/test/screen-browser.ts: end to end at 390px and wide

Measured on the laptop: one live browser 229–236 MB PSS.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 22:11:03 +01:00
CatoandClaude 8c5033baef docs(infrastructure): servers.md is the one place for server facts (#1767)
Owner's standing instruction (2026-11-23): stale documents keep misleading
agents. Applies the fleet AGENTS.md rule "Documents go stale" to loki:

- docs/infrastructure/servers.md holds the dated facts for gitea and bitbaum
- hetzner-migration.md's Box layout spec is marked SUPERSEDED and points there
- docs/README.md states the Last verified convention and points at the rule

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-23 20:54:56 +01:00
345f63b099 fix(telegram): a chat that stops receiving is an alert, and a picture never vanishes silently (#1765)
* fix(telegram): a chat that stops receiving is an alert, and a picture never vanishes silently

On 2026-11-23 a screenshot of an event sent on Telegram reached nothing: no
agent turn, no booking, no alert, no error. The owner's chat bot is collected
by the OpenClaw gateway (long polling), and the only health check asked
whether the gateway answered HTTP, which it can do while its Telegram channel
collects nothing.

- check-gateway also asks Telegram for the chat bot's inbox (getWebhookInfo,
  read-only, lib/telegram/inbox.ts): a webhook set on the polled bot, or
  updates waiting on two ticks in a row, raises telegram_inbox_stuck once and
  says so in the chat (outbound still works when inbound is dead); it clears
  on recovery. Skipped while the gateway itself is down.
- Loki's notification bot can no longer take over the chat bot: the same
  token in TELEGRAM_NOTIFY_BOT_TOKEN is ignored (env.ts warns), since its
  setWebhook would cut the gateway off from every owner message.
- ensureWebhook re-registers when Telegram reports 401/403 (a rotated
  AUTH_SECRET left the URL matching and every update refused), keeping the
  queued updates; the route logs refused calls (throttled).
- A photo or image file sent to the notification bot gets a reply saying it
  was not read or booked and where to send it, and is recorded; a failed
  reply is logged instead of swallowed.

Test: scripts/test/telegram-inbound.ts with a Telegram photo-update fixture.

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

* docs(telegram): register the chat-bot inbox probe (src/lib/telegram/inbox.ts)

check-telegram-registry failed on #1765: inbox.ts calls api.telegram.org
but had no row in docs/telegram-notifications.md.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: catomean <catomean@users.noreply.github.com>
2026-11-23 20:54:54 +01:00
CatoandClaude 986131a2ca docs(handoffs): record phone-first ops breakage of 2026-11-23 and plan (#1766)
Co-authored-by: Claude <noreply@anthropic.com>
2026-11-23 20:54:51 +01:00
Cato b1a8ab38b8 fix(deploy): establish receipt visibility from the workflow event (#1737) 2026-11-15 17:38:15 +01:00
Cato 85192684b9 feat(memory): explore project connections and export agent handoffs (#1735)
* feat(memory): explore project connections and export portable agent handoffs

* fix(memory): use the last report when development log dates tie
2026-11-15 17:00:52 +01:00
Cato e599c83fde Measure agent cost per verified outcome on 50 development cases (#1721)
* feat(evals): account for verified outcomes across fifty development cases

* test(evals): align spoken-walk replay with its recording clock

* fix(dev): preserve check status during push watchdog cleanup
2026-11-14 15:09:08 +01:00
CatoandClaude cd90093f72 fix(orangecat): the fleet map links only project pages that answer; a build log is not a post (#1716)
* fix(widget): the edge tab says "Feedback" and is 44px to hit

OrangeCat's UX audit (chrome#13, 2026-11-12) found the widget's edge tab a
24px-wide dark sliver marked only with the spiral: the hardest control on a
near-black page to see, and half the 44px touch minimum.

- The tab button is 44px wide; its inner 12px is transparent padding and
  the visible handle is the outer 32px.
- The handle is the surface ringed in the text colour, so in either mode
  one of the two clears 3:1 on near-white and near-black host pages.
- A visitor's tab shows a speech bubble and a vertical "Feedback" label,
  named "Send feedback"; the owner's tab keeps its live dot and mark and
  now shows "Watching" / "Paused".
- Still an edge tab, never the round launcher it replaced.

The browser test now asserts the 44px width, the name and the label, and
measures the visible handle for Minimize's "smaller than the button".

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

* fix(fleet-map): publish an OrangeCat project link only when the page answered

The fleet map emitted the stored orangecat_project_id without asking, so
Bitbaum's tile on orangecat.ch opened a project page deleted there (404).
/fleet already probed its links; the map, which other sites copy, did not.

The map now keeps only links whose page answered a read-only HEAD. An
incomplete answer is asked again after a minute instead of ten.

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

* fix(orangecat): a build log is not a post; a deleted project can be let go

Closed runs and dev-log entries are no longer sent to OrangeCat's timeline.
They were 78 of 80 posts on its public feed ("e2e ok, no changes", pull
request numbers, commit hashes). They stay in Loki; the one moment still
sent is a project going public. The backfill does not queue switched-off
moments, and the activity switch is removed with the feed it governed (the
stored answer is kept). Decision written in src/config/orangecat-publish.ts
and docs/architecture/cross-product-identity-bridge.md.

"Take it down" now clears the stored id when OrangeCat's API says the
project does not exist, instead of answering that OrangeCat is too old.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-14 10:57:42 +01:00
CatoandClaude Fable 5.2 56dc385a86 docs(handoff): state at handover: what is live, what is unproven, the plumbing plan (#1708)
* docs(handoff): Talk waits for the chatkit canaries; how to bring it back

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

* docs(handoff): state at handover: what is live, what is unproven, the plumbing plan

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-13 12:41:48 +01:00
CatoandClaude d17723cd7e docs(handoff): Talk waits for the chatkit canaries; how to bring it back (#1706)
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 12:00:50 +01:00
CatoandClaude Fable 5.2 deb825bd99 feat(orangecat): a key saved in Loki can answer the person's OrangeCat bots (#1703)
* feat(orangecat): a key saved in Loki can answer the person's OrangeCat bots

A person who gave Loki their model key was asked for it again on OrangeCat.
The key now stays in one place: OrangeCat asks Loki, over the signed rail and
as the linked account, to make the chat completion.

- user_model_keys.for_orangecat: per key, off by default
- POST /api/orangecat/model: keys, share, models, complete
- never the person's own endpoint; chat fields only; 240 calls an hour per
  account; the key is never returned or logged
- Settings → Your model: 'Also for your OrangeCat bots'

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

* feat(orangecat): the model door carries native tool calls

A bot offered its tools as prose guesses at them; every model was trained on
its vendor's own function format. The door now passes function definitions
and tool turns through and returns the calls the model asked for. OrangeCat
runs them as the person; Loki runs none.

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-13 09:52:47 +01:00
CatoandClaude Fable 5.2 5987663b6c fix(check): the rail check types into a search field; the walk and a bot's browser pass 15 of 15 on the live site (#1701)
* fix(check): the rail check types into a search field, not the button that says search

First run on the live site (2026-11-13, run 43387876987): 14 of 15. The one
failure was the check's own: it picked "Open search", a button, as the
field to type into. It now takes a field, and a failed step prints Loki's
sentence.

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

* docs(handoff): the walk and a bot's browser exercised on the live site, 15 of 15

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-13 09:01:04 +01:00
CatoandClaude Fable 5.2 5199fff1dd feat(orangecat): a browser of its own for every bot; a picture a thread can show (#1697)
* feat(orangecat): a browser of its own for every bot; a picture a thread can show

Cat Bot's computer use (OrangeCat docs/PARITY.md, plan step 2), Loki's half.

POST /api/orangecat/browser, on the signed rail for the linked account, takes
one step in the bot's browser: open, click, type, press, scroll, back, look,
close. Every answer carries what the page now shows: address, title, the
readable text, what can be clicked or typed into (numbered, so a model that
cannot see pictures can still drive), and a picture.

- lib/bot-browser: one session per (account, bot) in Loki's own Chromium,
  the whole context kept out of the private network, cookies kept between
  sessions in a file only this server reads. Closed after three idle
  minutes, twenty at the outside; two at once on the box, and a session in
  use is never closed for another. The page reader is sent as a string: a
  bundler that names inner functions made it read every page as empty.
- lib/bot-browser-rules: pure. A bot never types a password, a sign-in code
  or a card; the step stops and says the owner does that.
- lib/bot-shots + GET /api/orangecat/shot/[token]: a thread shows a picture
  only from a web address, so pictures are kept a week under a name nobody
  can guess. The site walk now answers a failed page with that address
  instead of bytes.
- page-picture exports its private-network guard and its browser lookup, so
  there is still one of each.

scripts/test/bot-browser.ts (11), site-walk.ts (13). Driven for real from a
sandbox browser against orangecat.ch: open, numbered elements, click by
label, scroll, back, a password field refused, a private address refused.

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

* docs(handoff): Cat Bot parity with Grok Bot, the running checkpoint

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-13 07:20:09 +01:00
CatoandClaude 10e77f144b docs(handoff): OrangeCat main green and deployed at 19:09; the migration fix that landed (#1693)
Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 20:25:20 +01:00
CatoandClaude Opus 5.5 6e96590fae fix(check): the loop probe asks for a summary unique to the run; the check passes 5 of 5 on the live site (#1692)
* fix(check): the loop probe asks for a summary unique to the run

2026-11-12 18:28: the orangecat probe went into the live Claude session that
had written "e2e ok — no changes" at 17:00. The handoff already said it, so
Claude left the file as it was, its time stayed 17:00:00, the run's delivery
(now the claim time, 18:27:45) was later, and the run sat at Needs you. A
token per run makes the agent write, and proves the handoff is this run's.

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

* docs(handoff): the loop check passes 5 of 5 on the live site

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 20:08:00 +01:00
CatoandClaude Opus 5.5 c8713738e4 fix(runs): delivery falls back to the claim time, so a finished agent's handoff closes its run while the runner is behind (#1691)
* feat(ops): runs-db runs=open lists every open run, read-only

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

* fix(runs): a run's delivery falls back to the claim time, so the agent's own handoff closes it while the runner is behind

2026-11-12 17:00: the orangecat probe was claimed at 16:59:5x, Claude did it
and wrote its handoff at 17:00:00, and the runner, still on the morning's code
because its update waits on the drain, acked at 17:00:05 without its injection
time. deliveredAt was the ack time, the handoff "predated" it, and the run sat
at Needs you.

The prompt cannot reach the agent before the runner claimed it, so the claim
time is a floor that never postdates the injection. Used only when the
runner reports none; deliveryStampFor still bounds it.

scripts/test/delivery-claim-floor.ts (shows the old stamp leaving the run
open and the claim time closing it). 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 19:20:35 +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 5d057688a1 fix(ux): what the signed-in audit found first: a short message wraps, a field vanishes, pages slide on load (#1688)
* feat(fields): sixteen text boxes get the microphone; chatkit 0.25

Fleet experience standard, step 9. The experience audit counted 34 hand-made
text areas with no microphone; it now counts 17, and package-plan.json sets
the ceiling at today's counts so the number can only fall.

- @bitbaum/chatkit 0.22.1 -> 0.25.0. Composer behaviour and the class names
  Loki overrides are unchanged; LOKI_VOICE keeps the transcribe route's own
  sentence (showServerDetail), which names the fix.
- <TextArea> (components/ui/text-area.tsx): Loki's one adapter over chatkit's
  DictationField, drawn to match ui-input. Sixteen files use it. One file is
  exempt with its reason on its first line (URL paths, one per line).
- Field takes htmlFor, so its label names the control and a press on it
  focuses the field.
- A signed-out visitor's microphone is the browser's own recogniser
  (VISITOR_VOICE): the server leg answers 401 without a session, so on
  /change the mic recorded a whole take and then failed.
- The widget chat bundle budget goes 40 -> 41 KB: 41,414 -> 41,614 bytes
  gzipped, the two new dictation problems a person can act on.

The other seventeen wait for props the shared field gains in
bitbaum/chatkit#85 (autoFocus, onKeyDown, onBlur/onFocus, name, inputProps).

The stylesheet in this commit also carries the public-site rules of the
next one.

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

* feat(public): say it on the first screen; a shorter homepage; a header that stays

The way in
- The homepage's one action is the shared composer. What a signed-out
  visitor says is kept in the tab (lib/first-words), shown back on sign-up
  and handed to the new-project form at the end of onboarding or sign-in.
  With a sentence carried, onboarding does not ask for a project name, a
  folder and a GitHub address first.

The homepage
- 10.66 -> 7.48 phone screens at 390x844, 6.6 -> 5.11 at 1440x900.
- Three figures for the three steps, drawn in tokens (LoopFigure).
- Three problems on the homepage, all twelve on /why. Where it runs is one
  sentence and two links. The closing block is the shared FinalCta.
- One label for sign-up everywhere: Start a project.

Header, menu, footer
- The header was sticky in name only: .ui-public-surface was overflow:
  hidden, which made it the sticky container. overflow-x: clip.
- The phone menu takes focus, keeps Tab inside and hands focus back.
- The Product menu opens on a press, not on hover.
- Navigation and Sign in show from 1120px (was 1280px).
- A 2px focus ring, on the public surface and as the app-wide fallback.
- A skip link. Four footer groups instead of five.

Corners
- An unknown address outside the app drew the framework's bare 404 with no
  way back; the in-app one said Back to Today and went to Loki; the error
  page printed the raw error; the loading placeholder drew cards on pages
  that are rows. The share image leads with the headline.

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

* fix(ux): dates render once; rows say the part that matters; a person's words

- APP_LOCALE is a server variable, so a client component formatted dates in
  the default locale while the server used the configured one: a hydration
  error on /approvals with APP_LOCALE=de-CH. next.config.ts hands the same
  value to the browser as NEXT_PUBLIC_APP_LOCALE.
- Home's running rows lead with the live step. A phone row holds about
  thirty characters and every row read 'Next best step · Editing src/app/pa…'.
- The workbench's three rows on a phone were each cut before the words that
  say what the row is for.
- Terminal without cloud access, Home's first-run row and the widget row use
  the person's words (computer, Loki button), not ours (runner, widget).

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

* docs(ux): the November UX pass, the public surface map, the changelog

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

* feat(fields): the remaining text boxes get the microphone; chatkit 0.27

The second step of the fleet's experience standard for Loki. The shared
field gained what a form's text area needs in bitbaum/chatkit#85 (0.27.0):
autoFocus, onKeyDown, a submit key, a field-level blur, name, inputProps.
Sixteen more files move onto <TextArea>; the experience audit goes
bareTextareas 17 -> 1 and the ceiling in package-plan.json follows.

Kept, file by file: Cmd/Ctrl+Enter saves where Cmd+Enter did (goal and
person notes, project description, the idea step), Escape still cancels,
Enter still sends an interview answer and confirms a queued prompt, notes
still save when focus leaves the field, and an inline editor no longer
closes when its microphone is pressed. The studio's forms still read their
text by name from the native form. The scheduled job's prompt keeps the
mono face and spell-check off. ProjectBriefFill's separate Speak button is
the field's own microphone now (the same transcribe route).

Left: control/prompt-input.tsx, a prompt box with its own attachments and
paste-to-attach. It is a composer, not a form field.

Checked: tsc, lint, the design gate, file inputs, 599 unit-test files; in a
browser, autofocus, both submit keys, Escape, save on blur and not on the
microphone, 44px microphone and 16px text at 390, and the chat and Home
composers after the bump.

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

* test: a git fixture cannot reach the real repository from a hook in a linked worktree

A hook run from a linked worktree exports an absolute GIT_DIR, which
overrides git -C <sandbox>. dispatch-launch-dir.ts ran its fixture commands
with that environment, so a pre-push from a second worktree wrote a
test@test init commit onto the branch being pushed and set core.bare = true,
a test identity and a hooks path of /dev/null in the real config. Nothing
reached the remote; the repository was repaired by hand.

worktree-workspace.ts already clears those variables for itself. The unit
runner now clears them once for every test, and dispatch-launch-dir.ts does
so for a direct run. Checked: with a bogus GIT_DIR inherited, the test
passes and the real repository is untouched.

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

* docs(ux): the text boxes' second step, and what is left

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

* chore(deps): chatkit 0.28.1, where a dictated take respects a field's maxLength

bitbaum/chatkit#87, found while reviewing this branch's converted fields.
0.28 also draws a visible border on the composer while it has keyboard
focus and stops thread-following from scrolling the page up.

Checked on 0.28.1: the chat, Home and homepage boxes at 390px in both
themes (text goes in, send enables, no sideways scroll, no console
errors), tsc, lint, the design gate and the widget size test (41 KB
budget holds).

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

* Revert "feat(fields): thirty-two text boxes get the microphone; chatkit 0.28.1"

This reverts commit 2f2f3756a2, reversing
changes made to 7f8e731b08.

* fix(ux): what the signed-in audit found first: a short message wraps, a field vanishes, pages slide on load

Seven groups of signed-in screens were audited in a browser on 2026-11-12
(docs/development/ux-audit-signed-in-2026-11.md): 84 findings, each with a
measurement. These are the blockers and the shell-wide ones, each reproduced
on main first and measured again after.

- A sent message was capped at 75-90% of a stack that shrinks to fit it, so
  it always wrapped: "What's going on?" was 106px on two lines where one
  line needs 141px. The cap is on the stack now.
- Onboarding: the "Project name" field was replaced by a read-only row as
  soon as the name was not empty, that is after one keystroke. The row is
  for a repository that was picked.
- A wrong password said nothing: Auth.js answers a refused sign-in with 200
  and the reason in `error`, and the forms tested `ok`. One helper,
  lib/auth/sign-in-result.
- A sentence carried from the homepage over 300 characters ended in
  "Invalid body": 2000 kept by the homepage, 300 in the form and the route.
  One number (config/project-brief); only the GitHub repository description
  is cut, at a word. The refusal is drawn beside the button.
- Revoking a computer's token took one tap and removed the row even when
  the server refused. It asks in a sheet and reads the answer.
- Every desktop load slid the page: the server drew the sidebar open and
  the browser folded it. The choice is in a cookie the layout reads; layout
  shift 0.19 -> 0.000 on Home, Projects and Approvals. The chat's "Recent"
  list is hidden by CSS, not by a viewport test after load: 0.5 -> 0.03.
- The app has a skip link ("Skip to content" is the first Tab stop; the
  page's first control was the 22nd). The sidebar's navigation is named,
  the logo link is named, and a folded rail item shows its name on focus.
- The desktop notifications panel is a dialog on <body>: its click-away
  layer was trapped in the top bar by the bar's blur, so a click on the
  page went through, and Escape did nothing.
- The More sheet, the Sessions drawer and the command palette take the
  keyboard when they open, keep Tab inside and give focus back.
- The account button and the page action in the phone top bar are 44px
  (40px circle inside), not 40.

Pins: scripts/test/ux-round-two.ts, scripts/test/project-brief.ts.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 16:51:49 +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 6a966ac6ae fix(sessions): the session walk says what tab-inject does, and tab-inject says when a task waits (#1674)
Traced 2026-11-12. On the cloud builder tab-inject queues a task that the
claim gate holds while an earlier run of the project is open (so it never
types into an agent mid-task), but it answered only ok, and the walk said a
running session gets the prompt typed into it. A prompt for a plain shell
was queued and answered 200, then refused by the runner.

- tab-inject: a task held behind an open run answers heldBehind (runId,
  startedAt, label) and a message, read with findQueueBlockers, the gate's
  own predicate; a prompt for a shell is 403 before anything is queued
- LOOP-WALK: 'give it a task' says it waits its turn; 'type into it' says
  how to send a message mid-task (bracketed paste, then Enter); open-tabs
  names are lowercase; the shell refusals are the real statuses
- scripts/test/session-walk-truth pins the routes and the text together


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 14:08:47 +01:00
CatoandClaude 7f8e731b08 feat(ux): say it on the first screen; a shorter homepage; a header that stays (#1675)
* feat(fields): sixteen text boxes get the microphone; chatkit 0.25

Fleet experience standard, step 9. The experience audit counted 34 hand-made
text areas with no microphone; it now counts 17, and package-plan.json sets
the ceiling at today's counts so the number can only fall.

- @bitbaum/chatkit 0.22.1 -> 0.25.0. Composer behaviour and the class names
  Loki overrides are unchanged; LOKI_VOICE keeps the transcribe route's own
  sentence (showServerDetail), which names the fix.
- <TextArea> (components/ui/text-area.tsx): Loki's one adapter over chatkit's
  DictationField, drawn to match ui-input. Sixteen files use it. One file is
  exempt with its reason on its first line (URL paths, one per line).
- Field takes htmlFor, so its label names the control and a press on it
  focuses the field.
- A signed-out visitor's microphone is the browser's own recogniser
  (VISITOR_VOICE): the server leg answers 401 without a session, so on
  /change the mic recorded a whole take and then failed.
- The widget chat bundle budget goes 40 -> 41 KB: 41,414 -> 41,614 bytes
  gzipped, the two new dictation problems a person can act on.

The other seventeen wait for props the shared field gains in
bitbaum/chatkit#85 (autoFocus, onKeyDown, onBlur/onFocus, name, inputProps).

The stylesheet in this commit also carries the public-site rules of the
next one.

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

* feat(public): say it on the first screen; a shorter homepage; a header that stays

The way in
- The homepage's one action is the shared composer. What a signed-out
  visitor says is kept in the tab (lib/first-words), shown back on sign-up
  and handed to the new-project form at the end of onboarding or sign-in.
  With a sentence carried, onboarding does not ask for a project name, a
  folder and a GitHub address first.

The homepage
- 10.66 -> 7.48 phone screens at 390x844, 6.6 -> 5.11 at 1440x900.
- Three figures for the three steps, drawn in tokens (LoopFigure).
- Three problems on the homepage, all twelve on /why. Where it runs is one
  sentence and two links. The closing block is the shared FinalCta.
- One label for sign-up everywhere: Start a project.

Header, menu, footer
- The header was sticky in name only: .ui-public-surface was overflow:
  hidden, which made it the sticky container. overflow-x: clip.
- The phone menu takes focus, keeps Tab inside and hands focus back.
- The Product menu opens on a press, not on hover.
- Navigation and Sign in show from 1120px (was 1280px).
- A 2px focus ring, on the public surface and as the app-wide fallback.
- A skip link. Four footer groups instead of five.

Corners
- An unknown address outside the app drew the framework's bare 404 with no
  way back; the in-app one said Back to Today and went to Loki; the error
  page printed the raw error; the loading placeholder drew cards on pages
  that are rows. The share image leads with the headline.

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

* fix(ux): dates render once; rows say the part that matters; a person's words

- APP_LOCALE is a server variable, so a client component formatted dates in
  the default locale while the server used the configured one: a hydration
  error on /approvals with APP_LOCALE=de-CH. next.config.ts hands the same
  value to the browser as NEXT_PUBLIC_APP_LOCALE.
- Home's running rows lead with the live step. A phone row holds about
  thirty characters and every row read 'Next best step · Editing src/app/pa…'.
- The workbench's three rows on a phone were each cut before the words that
  say what the row is for.
- Terminal without cloud access, Home's first-run row and the widget row use
  the person's words (computer, Loki button), not ours (runner, widget).

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

* docs(ux): the November UX pass, the public surface map, the changelog

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

* feat(fields): the remaining text boxes get the microphone; chatkit 0.27

The second step of the fleet's experience standard for Loki. The shared
field gained what a form's text area needs in bitbaum/chatkit#85 (0.27.0):
autoFocus, onKeyDown, a submit key, a field-level blur, name, inputProps.
Sixteen more files move onto <TextArea>; the experience audit goes
bareTextareas 17 -> 1 and the ceiling in package-plan.json follows.

Kept, file by file: Cmd/Ctrl+Enter saves where Cmd+Enter did (goal and
person notes, project description, the idea step), Escape still cancels,
Enter still sends an interview answer and confirms a queued prompt, notes
still save when focus leaves the field, and an inline editor no longer
closes when its microphone is pressed. The studio's forms still read their
text by name from the native form. The scheduled job's prompt keeps the
mono face and spell-check off. ProjectBriefFill's separate Speak button is
the field's own microphone now (the same transcribe route).

Left: control/prompt-input.tsx, a prompt box with its own attachments and
paste-to-attach. It is a composer, not a form field.

Checked: tsc, lint, the design gate, file inputs, 599 unit-test files; in a
browser, autofocus, both submit keys, Escape, save on blur and not on the
microphone, 44px microphone and 16px text at 390, and the chat and Home
composers after the bump.

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

* test: a git fixture cannot reach the real repository from a hook in a linked worktree

A hook run from a linked worktree exports an absolute GIT_DIR, which
overrides git -C <sandbox>. dispatch-launch-dir.ts ran its fixture commands
with that environment, so a pre-push from a second worktree wrote a
test@test init commit onto the branch being pushed and set core.bare = true,
a test identity and a hooks path of /dev/null in the real config. Nothing
reached the remote; the repository was repaired by hand.

worktree-workspace.ts already clears those variables for itself. The unit
runner now clears them once for every test, and dispatch-launch-dir.ts does
so for a direct run. Checked: with a bogus GIT_DIR inherited, the test
passes and the real repository is untouched.

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

* docs(ux): the text boxes' second step, and what is left

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

* chore(deps): chatkit 0.28.1, where a dictated take respects a field's maxLength

bitbaum/chatkit#87, found while reviewing this branch's converted fields.
0.28 also draws a visible border on the composer while it has keyboard
focus and stops thread-following from scrolling the page up.

Checked on 0.28.1: the chat, Home and homepage boxes at 390px in both
themes (text goes in, send enables, no sideways scroll, no console
errors), tsc, lint, the design gate and the widget size test (41 KB
budget holds).

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

* refactor(ux): the text boxes and the chatkit raise leave this pull request

The staged rollout gate holds any pull request that raises a shared
package until both chatkit canaries serve that exact version. On
2026-11-12 kivvi and causius served chatkit 0.25.0, the gate could not
match kivvi's deployment receipt to its current commit, and this pull
request raised Loki from 0.22.1 to 0.28.1, so it could not merge.

Everything else in the pass needs no package change. This commit undoes
the three text-box commits (3bae0c40, b210b7c8, 1228a37d) and keeps what
they carried that is not about text boxes:

- the public styles for the homepage, the header, the footer, the skip
  link and the carried sentence (they were committed with the first
  sixteen text boxes);
- the visitor's microphone: the composer adapter takes voice="visitor"
  (the browser's own recogniser), used on the homepage and on /change,
  where the server leg answers a signed-out request with 401;
- the homepage box's shorter placeholder, which fits a 320px phone.

package.json, pnpm-lock.yaml and package-plan.json are main's again.
The write-up says where the text boxes are and what they wait for; the
changelog entry no longer announces them.

The text-box work is unchanged at 1228a37d and follows as its own pull
request.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 13:33:44 +01:00
CatoandClaude 7ea443c528 fix(mcp): session links name their builder, and a dispatch hands back the link (#1673)
loki_sessions and loki_session_read built their links as a bare
/terminal?project=, so a phone that last chose 'Your computer' opened the
laptop's session of the same name instead of the cloud one (traced
2026-11-12; fixed for the HTTP routes in #1657). Both now use
sessionOpenUrl, which names the cloud builder, and loki_dispatch passes on
the openUrl inject-core returns, in its text and structured content.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 12:34:53 +01:00
CatoandClaude Opus 5.5 a1b009f26e feat(sessions): a token reads its sessions and what was said in them (#1661)
* feat(sessions): a token reads its sessions and what was said in them

An agent that starts Claude Code in a Loki session (tab-inject) could read
the screen (#1641) but not the conversation: the parsed transcript was only
readable over the cookie-only transcript stream, and since #1644 over
OrangeCat's signed rail.

- lib/session-reads: the list, one run, or one project with the last things
  said in its conversation, moved out of the signed route unchanged, so two
  doors share one copy
- GET /api/control/sessions: the same reads with a session or ck_ token
  (?project=, ?runId=, ?items=), no-store
- every row names its session and carries openUrl, the same session in
  Loki's Terminal on that run (lib/dispatch-card sessionOpenUrl)
- the list says it is cut at 25 and carries total, so a cut list is never
  read as the whole one
- LOOP-WALK's Session walk names the read; tests pin both doors to the one lib

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

* fix(sessions): the conversation read is current, on the session's builder, and never ends a person's view

Traced end to end before merge (2026-11-12):

- a cached conversation was served forever: after the first read sent
  peek_stop the runner stopped streaming, so a later read returned the same
  copy without the agent's answer. The cache now counts only while someone
  is watching; otherwise the read waits for a frame posted after it asked.
- peek_start and peek_stop carried no channel, so the owner's laptop runner
  could take a read meant for the cloud session (transcript null). They now
  name the project's builder (projectPreferredChannel).
- the read counted its viewer under a key of its own, so its peek_stop could
  end a person's live view of the same session on a phone. It now shares the
  Terminal's viewer count (same user, tab and channel).
- a cloud link carried no source, so a phone that last chose 'Your computer'
  opened the laptop's session of the same name. sessionOpenUrl names the
  cloud builder, and each row's link uses the session's builder.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 12:32:25 +01:00
CatoandClaude 510d8e2a14 fix(runs): whose pull request it is, after the review of #1643 (#1666)
* fix(runs): whose pull request it is, after the review of #1643

A review of the merged attribution change found the remaining ways a run
could claim, or act on, a pull request that is not its own:

- The fix ledger decided "this run's" by time alone, and on that basis
  could merge (auto-ship) or put back into draft a pull request somebody
  opened on another branch, when the handoff named it. auto-ship
  prOwnership: Loki acts only on a pull request on one of the run's own
  branches; it reports one as the run's when it is on them, or, for a runner
  too old to report branches, when the handoff names it.
- Evidence recorded before #1643 was never checked again, so run 70d1a78d
  kept loki#1636. It is checked with GitHub once and removed when foreign;
  Watch no longer falls back to evidence the ledger called foreign, and other
  views do not trust unchecked old evidence.
- The window had no end, so an earlier run sharing a branch with a later one
  claimed the later run's pull request. It ends 15 minutes after the run.
- Only the ten newest pull requests were scanned; a busy repository pushed
  the run's own off the page. Pull requests are asked for by head branch.
- Legal branch names with # or + were dropped. The rules are git's.
- The runner also reports the remote branch a checkout pushes to, skips the
  repository's default branch whatever it is called, and its exit and
  shipped beats carry the branch. Runner 0.8.69.

scripts/test/run-evidence-ownership.ts.

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

* fix(runner): a run closes as shipped only with a pull request opened during it, and only then stops the agent

The runner's idle check took any open or merged pull request on the branch
the agent sat on. A session that carries on from an earlier run sits on that
run's branch, so a read-only probe was closed Done with the earlier run's
pull request, and the runner stopped the shared session whatever the server
answered (also when the run had already been closed another way).

- findShippedPr takes the run's start; a pull request opened before it is
  not this run's.
- The server says closed: true when the beat closed the run; the runner
  stops the agent only then.

Found by a review of the probe path (2026-11-12).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:59:44 +01:00
CatoandClaude 7dd29e12df fix(one-off): a fresh session stays one-off: nothing of the shared session goes in, nothing of it comes back (#1665)
Found by a review of the merged fresh-session change (2026-11-12):

- A retry (automatic after a refusal, or from Watch) re-sent a one-off as an
  ordinary message, into the shared session. It is retried as a one-off.
- /api/control closed the project's newest run from the SHARED session's
  handoff without checking whether it was a lane run, so a one-off could be
  closed with the shared session's summary, announced to its caller, and
  left running. A lane run closes only from its own session file.
- A one-off's prompt carried the project's escalation note ("diagnose the
  last failure") and, on the local runtime, the shared session's last
  handoff and an instruction to update the shared session file.
- A one-off's close advanced or cleared the project's escalation ladder.
- On the local runtime the shared tab's prompt and handshake files were
  written for a one-off, even when the request was then refused.
- OrangeCat's separateSession asked for a lane, which quietly queued in the
  shared session when no lane was free. It is a fresh session now: a
  session of its own, or a refusal with the reason.

scripts/test/one-off-stays.ts.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:37:12 +01:00
CatoandClaude b824a48686 fix(lanes): a lane starts clean: from main, in a new conversation, without touching the shared checkout (#1662)
* fix(lanes): a lane starts clean: from main, in a new conversation, without touching the shared checkout

A lane is a run beside the project's own session, in a worktree of the same
checkout on the cloud builder. A review of the merged runner fixes
(2026-11-12) found three ways it did not start clean:

- Its worktree was cut from the checkout's HEAD, which on the box is the
  shared session's run branch (loki/run-<id8>). The lane began with another
  run's unmerged commits and its pull request carried them. It now starts
  from the remote default branch (worktree-workspace laneBaseRef).
- Its checkout step ran git pull --ff-only in the folder the shared
  session's agent works in; the run branch tracks origin's default, so the
  live agent's files could move under it. A lane now only fetches
  (ensureBoxWorkspace pull: false).
- A dispatch that carried the project's sessionId kept it in a lane, so the
  lane ran claude --resume of the shared conversation in a new folder.
  A lane resumes nothing.

Also: a live lane reopened after a builder restart is looked for in its own
folder (pty-runtime's record), and traced back to its checkout for pruning,
not to the dispatch's laptop path.

scripts/test/lane-base.ts runs real git for each case. Runner 0.8.68.

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

* fix(lanes): a lane that cannot start says why in words the retry policy reads

A laptop lane for a folder that is not on that machine was refused as a
worktree failure, and a missing box checkout as "nothing was launched".
auto-reimplement-policy reads neither as a workspace problem, so both were
retried on a builder where they cannot work. Both now use its words
("does not exist on this machine", "nothing was launched here").

Found by a review of the merged runner fixes (2026-11-12).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:33:33 +01:00
CatoandClaude Fable 5.2 7718294354 fix(builder, composer): a silent sealed session no longer holds a runner update; the composer falls back to the cloud runner (#1676)
* fix(builder): a sealed session that has been silent for half an hour no longer holds a runner update

The drain restarts the box runner only when no agent is working. A sealed
session has no status file the drain can read: its agent lives inside
gVisor and the unit's cgroup holds only the `podman run` that relays its
terminal, so it counted as working for as long as it was open, and
sessions stay open for days.

Measured on the box, 2026-11-12 07:56 UTC (Sealed builds run 43178274733,
mode=activity): three open sealed sessions, one of them eighteen hours
old, relayed 0, 40 and 96 bytes in a minute while the drain logged
"3 agent(s) working — deferring restart" on every look. The runner stayed
two releases behind for hours, so the runner fixes merged that morning
were not running, and the commands route held new work for the restart.

- agent_is_busy: a sealed session that has relayed under 512 bytes a look
  for 30 minutes is not working. Shorter than that, or a quiet that
  cannot be told, still is: unknown is not idle.
- quiet_for reads the relay's cumulative byte counters and keeps its note
  under /run/loki-drain/<unit>, outside the drain's own process: every
  deploy starts a new drain, and a clock that restarted with it would
  never reach thirty minutes on a box that deploys several times an hour.
- The rule is the sealed session's alone. An unsealed agent that is not
  Claude still always holds the restart: its output was not measured.

What it can cost: a sealed agent stopped at a permission prompt in the
middle of a task prints nothing, so after thirty minutes of that the
restart goes ahead; the session reopens and its open run is closed.

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

* fix(composer): the project composer falls back to the cloud runner when the project's own builder is off

The chat reroutes a project pinned to an offline computer to the cloud
runner and says so (inject-core). The project composer for an idle project
(/api/control/tab-inject) asked for the routing decision without that
fallback: a project registered from a laptop queued for the laptop while it
was shut, with the laptop's folder as the place to start, and the answer
named no builder. The row sat until the reaper closed it an hour later.

- tab-inject passes the project's offline fallback, starts a rerouted
  dispatch in the folder the cloud runner clones into, and answers with the
  builder that took it and the reroute sentence.
- execution-access test pins the three.

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 10:23:40 +01:00
CatoandClaude 663661c565 fix(inject): a read-only probe ends Done on the builder it asked for, and a refusal by choice is not a failure (#1667)
* fix(inject): a read-only probe ends Done on the builder it asked for, and a refusal by choice is not a failure

Found by a review of the probe path end to end (2026-11-12):

- Every run's status went through the feedback-fix mapper, which calls a
  run that finished well with no pull request "Needs you, nothing shipped".
  A git status probe ended there. Only a feedback fix owes a change; any
  other run that finished well with nothing pushed is Done, cause
  finished_no_change (canonicalStatus expectsChange, from run-track-load).
- Neither POST /api/inject nor MCP loki_dispatch could ask for the cloud
  builder: zod drops unknown keys, so builderChannel vanished without a word.
  Both take it now (builderChannel / builder).
- A fresh session refused for lack of a free lane was closed as a failing
  run and advanced the escalation ladder; four of them paged the owner with
  no agent ever run. That refusal no longer counts.

scripts/test/probe-path.ts.

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

* test: two text pins follow the new shape of the inject route and the refusal close

busy-placement read the inject route's call on one line; refused-dispatch-
closes-run read closeRunUndelivered with a one-key options object. Both still
assert the same thing: the route passes session on, and a refused dispatch
closes its run quietly before the failure is reported.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 10:05:53 +01:00
CatoandClaude d128019ab9 fix(one-off): a fresh session ends with its run, on the builder it ran on, and says where it is (#1664)
#1640 closed a one-off's tab only when its own handoff closed the run. One
that never reported (reaped), was refused on its ack, or ended with a runner
restart kept its agent open in its lane, free to go on to something else and
holding a project lane and a builder agent session.

- one-off-close.ts: notifyRunClosed, which every close path calls once,
  queues close_tab for a one-off's lane tab; the handoff close no longer does
  it separately.
- The close goes to the builder the dispatch command names now. A queued
  dispatch moved to the other builder used to be closed on the first one,
  which answered "nothing to close".
- loki_dispatch's result carries the lane tab (sessionTab) and says it.
- A refused fresh session reads the lane count again before it says the
  project is full; a database error used to read as "wait for one to close".
- scripts/test/one-off-close.ts.

Found by a review of the merged runner fixes (2026-11-12).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:53:47 +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
CatoandClaude 220ea00416 fix(runs): the delivery track shows a pull request and commits only from the run's own branches (#1659)
#1643 tied live evidence to the run's branches, but the track's own read of
the repository (lib/repo-progress) still took the newest pull request opened
since the run began, and the newest push. That read is where run 70d1a78d's
"Pushed: <#1636's commit>" and its pull request came from (2026-11-12).

- readRepoProgress takes the run's branches; a pull request's head and a
  pushed ref must be one of them.
- run-track-load passes runBranches(run).
- scripts/test/run-branches.ts replays the incident against repo-progress;
  the three new checks fail on main and pass here.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:28:12 +01:00
CatoandClaude Opus 5.5 12e0357d8f feat(sessions): starting a session answers with where a person opens it (#1657)
* feat(sessions): starting a session answers with where a person opens it

An agent that starts Claude Code in a Loki session hands the owner the
session to look at, on a phone or a computer. The Terminal's address was
built only inside the app's own cards, so a caller had to guess it.

- lib/dispatch-card sessionOpenUrl: the full link to the session in Loki's
  Terminal, on that run when there is one, This computer for a local one
- tab-inject (live, dispatch, queued), /api/inject and MCP loki_dispatch
  (through inject-core, a parallel lane included) and agent/launch return
  openUrl
- LOOP-WALK's Session walk says so; scripts/test/session-open-url pins it

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

* fix(sessions): a session's link names its builder

A cloud openUrl carried no source, so the Terminal opened whatever source
that browser last chose: a phone that last picked 'Your computer' opened the
laptop's session of the same name instead of the cloud one the agent drove
(traced 2026-11-12). sessionOpenUrl now says source=cloud for the cloud
builder, and the screen capture's openUrl (POST /api/control/peek-tab) is
the same full link instead of a bare path.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:46:37 +01:00
CatoandClaude 85e8deac30 feat(mcp): a connected agent lists open sessions and reads what a session's terminal shows (#1653)
Over MCP an agent could send a task to a project's agent (loki_dispatch) and
was told not to poll: it had no way to see that the session was up or to
read what the agent answered. The HTTP side got both for a token in #1641.

- loki_sessions: agent sessions open on the owner's builders, each with the
  link that opens the same session in Loki's Terminal. Plain shells are
  never listed.
- loki_session_read: the end of one session's terminal output as plain text
  (escape sequences removed, redrawn and repeated lines collapsed). Queues
  the same peek_tab command as POST /api/control/peek-tab and waits up to
  twenty seconds; a builder that does not answer is an error that says so.
  A plain shell is refused before anything is queued.
- both read only, so both sit under loki.chat, as the scope rule requires.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:05:27 +01:00
CatoandClaude f873c3641c feat(orangecat): a person's bot files a finding into the feedback inbox over the signed rail, and reads it back (#1648)
A QA bot files through POST /api/projects/<id>/feedback with its own seat's
token. A person's OrangeCat bot has no Loki token: it acts over the signed
rail as the Loki account linked to its owner. It had no way to file.

- lib/feedback/agent-filing.ts is now the one body of a machine filing and of
  a report's status read (moved out of the two routes, unchanged in what it
  does: rate limit, idempotent replay, source agent, the owner's opt-in
  build; the two status shapes by seat)
- POST /api/orangecat/feedback: signed, fresh, the linked account, a project
  by name that the account has a seat on. A filing (words only) answers like
  the seat door; { feedbackId } reads the canonical status
- no second inbox and no second contract: both doors call the same body


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 07:03:57 +01:00
CatoandClaude 9253f40898 fix(runs): an open run has one status, read from the same facts as its track (#1647)
/api/orchestration/runs/<id> and /api/control/commands/<id> answered status
"delivered" / "working" while track.summary in the same response said
"Waiting for a runner" (2026-11-12). The word came from the command row, the
sentence from the run's events, and the run route treated every run as
executed and verified from the moment it was opened.

- RunTrack.live: Queued, Starting, Working or Needs you, decided in the same
  order as the track's summary; null once the run has finished.
- alignLiveViewWithTrack: while a run is open, both routes return status,
  label, detail and tone from the track.
- An open run is never "Delivered to agent" on a runner's ack alone: it is
  Starting until the agent prints after the prompt, then Working.
- The run route reads the run's own command row instead of assuming it.
- scripts/test/one-run-status.ts replays both contradictions.

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:37:29 +01:00
CatoandClaude ec0cd635ba feat(inject): session "fresh" starts a one-off session in its own worktree and closes it when it reports (#1640)
* fix(inject): a message to a busy project waits its turn; only a caller that asks gets a parallel lane

With parallel dispatch on, every dispatch to a busy project forked a lane with
a new agent session. A message sent to orangecat while a run was open
(2026-11-12) started a second agent instead of queueing behind the open run,
while the same message to loki queued: the difference was whether a lane was
free, not what the caller meant.

- orchestration/busy-placement.ts: the one rule. Busy means queue, first in,
  first out; a lane only for whenBusy: "lane".
- executeInject plans a lane only through that rule.
- feedback Implement asks for a lane, as before. /api/inject, the MCP
  loki_dispatch and chat dispatches are messages to the session and queue.
- scripts/test/busy-placement.ts pins the rule and those callers.

* feat(inject): session "fresh" starts a one-off session in its own worktree and closes it when it reports

A read-only one-off question typed into a project's shared session does not
stay one-off: "only run git status, then stop" was answered, and then the
session went back to its own plan and edited tests (2026-11-12).

- POST /api/inject and the MCP loki_dispatch take session: "fresh".
- The prompt gets a lane of its own whether or not the project is busy: a new
  agent in its own worktree, no resumed conversation, told it is a one-off.
- When it reports ready the run closes and close_tab is queued for the lane.
- It never falls back to the shared tab: without a lane it is refused with
  fresh-session-unavailable (409) and nothing is sent.
- scripts/test/busy-placement.ts pins the rule, the prompt, the close and the
  two entry points.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:33:10 +01:00
CatoandClaude 6bb3d7461c fix(runs): a pull request is a run's only when it is on one of the run's own branches (#1643)
* fix(runs): a pull request is a run's only when it is on one of the run's own branches

Run 70d1a78d on loki ran git status and nothing else; its page claimed
loki#1636 as its pull request and "Pushed:" with that pull request's commit.
#1636 was opened by hand on another branch while the run was open. "The
newest pull request since the run started" is a time window, not an
attribution.

- lib/run-branches: a run's branches are loki/run-<id8>, its worktree branch,
  and every branch its runner reported the agent's checkout on. Never main.
- findRepoWorkEvidence takes those branches; a pull request's head or a
  pushed ref must be one of them. Watch, the reaper's correction and the
  outcome post all pass them.
- The runner's progress beat carries the checkout's branch; the server keeps
  the list on the run (payload.branches).
- The two branch names have one source; the builder code re-exports it.
- scripts/test/run-branches.ts replays the incident against the real finder.

* chore(runner): 0.8.66 with its release note

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:16:35 +01:00
CatoandClaude 46ec257ad2 feat(sessions): an agent's token can list open sessions and read a session's screen (#1641)
An agent could start a project's coding agent in a Loki session, type into
it and close it with a ck_ token (tab-inject, tab-inject-raw, close-tab),
and could even ask for a capture of its screen (POST peek-tab), but the
list of open sessions and the capture's answer took a browser session only.
It could not see that the session was up or read what the agent answered.

- GET /api/control/open-tabs takes a session or a token
- GET /api/control/peek-tab/[id] takes a session or a token, no-store
- POST /api/control/peek-tab takes an optional channel and returns
  resultUrl and openUrl (the same session in Loki's Terminal)
- a plain shell's screen stays a signed-in browser's: a token gets 403 on
  asking and 404 on reading (lib/peek-access)
- LOOP-WALK gains the Session walk; scripts/test/agent-session-read pins it


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:54:44 +01:00
CatoandClaude fab5e0513a fix(inject): a message to a busy project waits its turn; only a caller that asks gets a parallel lane (#1639)
With parallel dispatch on, every dispatch to a busy project forked a lane with
a new agent session. A message sent to orangecat while a run was open
(2026-11-12) started a second agent instead of queueing behind the open run,
while the same message to loki queued: the difference was whether a lane was
free, not what the caller meant.

- orchestration/busy-placement.ts: the one rule. Busy means queue, first in,
  first out; a lane only for whenBusy: "lane".
- executeInject plans a lane only through that rule.
- feedback Implement asks for a lane, as before. /api/inject, the MCP
  loki_dispatch and chat dispatches are messages to the session and queue.
- scripts/test/busy-placement.ts pins the rule and those callers.

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:40:26 +01:00
CatoandClaude 96ec923169 fix(feedback): a closed report never tells a seat the owner has to act (#1637)
A Viewer or Reporter seat polling an archived report read 'the project's
owner or an editor has to act on it. Poll again later', and one marked done
without proof read 'needs the project's owner'. Nobody is going to move a
closed report. seatStatus now says so for closed_without_change and
done_unproven: who nobody, kind none, and what the filer can still do
(look at the live page, file a new report). Open reports are unchanged.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:24:12 +01:00