mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 14:27:21 +01:00
54f745dcd01bec6f66b511baf91fff00a8e50626
767
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2d49a2d1c2 |
fix(register): heidi is served, and the register said it was a prospect (#727)
heidi.orangecat.ch answers 200 and has since it launched. Its apps.conf row said `prospect`, and because the studio site derives from this register, that word was rendered on heidi's public page. `live` in this column means the process is SERVED — a provisioning fact, like `client-app` two columns over. It is not a release claim, and nothing in this fleet makes one: everything is beta, OrangeCat included (fleet AGENTS.md, "Names agents must share"). So this row now reads `live` and bitbaum renders "Beta — running, not released", which is both true statements at once. src/config/fleet-sites.ts is derived from this file and is regenerated here rather than hand-edited — scripts/test/fleet-sites-derived.ts caught the drift before CI did, which is the entire point of having the pair. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
71a7b44ee6 |
feat(ai): show what the day's tokens were spent on (#723)
* feat(ai): show what the day's tokens were spent on
"What are the current providers, with limits, what is spent and on what" could
not be answered. The limits were there; the spend was one number with no
breakdown, and fifteen features were not in it at all.
ROUTING WAS NEVER THE PROBLEM
Worth saying plainly because I got it wrong first: every caller already goes
through ai-kit's chain. callTextDetailed walks the same chainFrom() with the
same fallback as the tool loop. There is one router, exactly as this file's own
header claims.
The gap was METERING. callOneLink did the fetch, read the body, and threw the
response headers away — so every digest, brief and form-fill drew on the same
Groq pool the capacity page was reading, and the page never saw them.
ONE LINE COVERS FIFTEEN FEATURES
recordVendorQuota() in callOneLink. They all reach the vendor through there.
Refusals record too: a 429 is the most reliable reading there is, because it
corrects a counter that had drifted optimistic.
`feature` IS NOW REQUIRED, AND THAT IS THE DESIGN
No default. The compiler then named every caller that had not named itself —
19 call sites in 15 files — and each now declares a slug the page can show a
person: activity-digest, form-assist, calendar-extract, project-brief,
frontier-propose, frontier-judge (its own slug: the panel's value is being an
uncorrelated second lineage, so its cost is worth seeing separately), dod-gate,
hosted-runner-analyze, and the rest.
A default would have let the twentieth caller be invisible again. That is how
the first fifteen got there — not by anyone hiding them, but because the
cheapest thing to write was the unnamed thing.
A SECOND TABLE, NOT A WIDER ONE
ai_spend answers "what has THIS USER spent today" and is read by the admission
gate on every turn; it must stay a point read on one row per (user, day).
Putting provider/model/feature in its key would make the rationing path pay for
reporting. ai_usage answers the orthogonal question and is keyed
(day, provider, model, feature). The user dimension is deliberately absent —
recording the same fact twice is how two tables start disagreeing.
VISION AND WHISPER REPORT TOO
They have their own transports and I nearly left them out. They spend the same
vendor pools, so omitting them would have made the page complete-looking and
wrong — the failure this surface exists to end.
EMPTY IS NOT ZERO
The ledger starts empty each UTC day, so the page says "nothing recorded yet
today", never "nothing spent". Same three-state discipline the provider rows
already keep.
5 coverage checks defend the guard itself, including that nobody can quietly
restore `options: GroqOptions = {}` and reopen the hole. Verify green, 237.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
* chore: re-trigger CI (previous run stalled 5s after start)
The prior CI run for this branch froze with updatedAt five seconds after
creation and sat in_progress for 45 minutes, while every other branch's CI
completed in 3-5 minutes in the same window. A stuck runner, not a slow test —
two candidate causes in the change itself were tested and both disproved:
a unit test writing to a reachable database still exits, and importing the db
module against a live connection does not hold the event loop.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
3e736fb8d0 |
fix(contact): publish cato@orangecat.ch, an address that exists (#726)
mao@orangecat.ch was never a mailbox. The orangecat.ch mail service showed 0 of 1 addresses used — "You don't have an address yet on orangecat.ch" — so every security report, licensing enquiry, privacy request and investor mail sent to it bounced. Nothing reported that, because a dead address is silent by construction. cato@orangecat.ch now exists (created 2026-09-15, Infomaniak) and matches the public name in the org register. Swapped in the eight files that publish a contact: LICENSE, SECURITY.md, the privacy policy, the terms, the investor contact, the seed fallback, and a test fixture. NOT changed, deliberately: "Mao Nakamoto" as the named operator, data controller and copyright holder in LICENSE, TERMS, PRIVACY and the IP assignment memo. Replacing the party to a contract is a decision that may want a legal name rather than another pseudonym. docs/AUDIT_REPORT.md keeps the old address because it is a dated record of what was true then. Claude-Session: https://claude.ai/code/session_01DzY8KuwgUM7u95GVTpRL2m Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
b2b724289b |
test(e2e): the check reads the run's real status, and a rationed refusal is a skip (#725)
Two ways this check lied about a working product, both found by running it on
the box rather than by reading it.
It printed `still ?/- after 20 min` when a dispatch produced no outcome turn.
`GET /api/orchestration/runs/[id]` answers the DERIVED dispatch view
(status/label/terminal), not the raw row, so reading it as {state, outcome}
told nobody anything — exactly when the diagnosis mattered most. It now reads
`status` + `terminal`, so a closed run with no turn is named as a lost
notification and an open one as a stuck builder.
And it FAILED "knows the fleet" when Loki correctly answered "You've used your
share of today's free AI budget for now." The free tier is rationed by design;
on a six-hourly timer with Telegram on flip, that pages for a healthy product
until the alerts get muted. A test against a rationed dependency needs three
verdicts, so there is now SKIP-with-reason: it does not fail the run, it says
why, and it never retries a rationed refusal (which would only spend the next
window too).
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
ac6e118bb1 |
feat(fleet): publish what a project IS, not just where it runs (#724)
A project's problem, solution, mission, vision, roadmap and changelog already lived in its profile — four attribute keys, the `goals` table, and `user_projects.dev_log` — and were injected into every dispatch. None of them were readable from outside the database, so a site that wanted to show them had no choice but to type its own copy, and the copies rot: orangecat's public changelog stopped at 2026-07-31 while its main branch ran on to PR #1039. The map now carries all six. A page renders them instead of authoring them. WHAT IS PUBLISHED, AND WHAT IS DELIBERATELY NOT Each projection is an allow-list that drops a column sitting next to the one it keeps, because every one of those columns is on a row we now serve publicly: identity four attrs from PUBLIC_IDENTITY_ATTRS. The attribute table is OPEN (the UI lets anyone add a key) and already holds business_plan, competitors, partnerships and security_vulnerability. A deny-list, or "publish every attr", puts the next key someone types on the public internet by default. The allow-list is applied in the QUERY as well as the projection, so an excluded key is never read into the process at all. roadmap goal title, status, progress, target day, milestone TITLES. NOT goal.description: read in production today, those are internal engineering notes carrying acceptance criteria — "Acceptance: pushing main runs DB migrations", "HMAC entitlement webhook verified". A public roadmap is what we are working on and how far along, not the conditions under which an engineer may call it done. Completed goals stay; a roadmap that hides what shipped reads as though nothing ever does. changelog dev-log `done` and the day, newest first, capped at 20. NOT next/tests/todos/health — operator working notes, not entries. Null means nobody has written it; an empty array means the surface exists and is empty. A consumer must render those differently, so the shape keeps both. AND THE BUG UNDER THE WHOLE THING /api/fleet/register built its projection without a `description` key at all. load-map.ts passed it; this route never did, and usefulDescription(undefined) is null — so the register's ONLY prose field was null on all 35 rows, and the gap presented exactly like a register nobody had written descriptions for. One line. PROVEN BY MUTATION, NOT BY SHAPE 39 assertions, every one paired with the negative: the adjacent field is absent from the output. A test that only checked the happy shape would pass just as well with the filters deleted, so all three were broken on purpose and each turned the suite red — changelog spreading the entry, identity iterating the caller's keys instead of the allow-list, roadmap spreading the goal row. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
aa287aa2cf |
fix(hosted): a one-shot runner drains its work before it exits, so the thread hears (#721)
A hosted dispatch ran, Hermes did the task, the run closed `done/success` with its summary — and the conversation that asked for it never heard a word. Nothing errored. Nothing logged. `updateOrchestrationRun` fires `void notifyRunClosed(...)` — its contract is never to slow a close — and that call is what writes the outcome turn. The web server outlives such a promise for free. `hosted-runner.ts --once` is a 45-second cron tick: it drained the command and called `process.exit(0)` while the write was still in flight. - settle-background-work.ts: a bounded drain window (5s, HOSTED_RUNNER_DRAIN_MS), paid only by a tick that actually drained something. A window rather than a promise registry, because the void-call is this codebase's convention at dozens of sites and threading bookkeeping through all of them to repair one process boundary is the larger change. - loki-loop-e2e.ts now reads the run's state when no turn arrives, so the two halves can never be confused again: a CLOSED run with no turn is a lost notification (the work happened); an OPEN one is a stuck builder. That distinction cost an hour today. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ee03f3daa1 |
fix(control): name the button Attention actually draws (#722)
/control used to render Retry beside every failure. For "no running agent" that
button was a lie — the target is identically absent on every attempt, so it
fails identically forever — and it was replaced with "Start session".
failure-remedy.ts still records why.
The BUTTON was fixed. Two sentences describing it were not:
TerminalSurface "open Control — Attention shows Retry when the prompt
never started."
ControlInbox "Queued for X. If Attention shows Retry, the agent never
started."
Both describe the never-started case, which IS the no-running-agent case, which
is exactly where Attention deliberately shows "Start session" and no Retry at
all. So the flow ended by sending the reader to Control to hunt for a control
that is not drawn — after a dispatch, at the moment they most need it to work.
Nothing was broken enough to notice: the button that is missing looks the same
as a button you have not scrolled to.
WHAT CHANGED
The button words join the remedy SSOT as REMEDY_LABEL, AttentionBar renders
from it, and both sentences now interpolate the label for the case they
describe instead of typing one. Prose and button can no longer disagree,
because there is only one copy of the word.
THE GUARD
scripts/test/remedy-copy-agreement.ts asserts the mapping, asserts every remedy
has a label, and greps src/ for prose that promises "Retry" for a never-started
situation. It also proves its own detector is not inert by running it against
the exact sentence that shipped and against the corrected one.
Reintroducing the old sentence on a copy turns it red:
✗ no copy promises Retry for the never-started case —
found: src/components/terminal/TerminalSurface.tsx:544
tsc clean, eslint clean, prettier clean, unit suite green.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
a78b4b1e9a |
fix(runs): a fast task closes its run — delivery is stamped at injection, not at the ack (#720)
* fix(runs): a fast task closes its run — delivery is stamped when the prompt lands, not when the runner acks The e2e health probe did everything right and its run never closed. The agent was injected at 05:12:55, wrote `status: ready` at 05:13:06, and the runner acked at 05:13:11 — because between injecting and acking it spends up to eight seconds (plus retries) checking that the agent is actually generating. `deliveredAt` was stamped at the ack, and closeRunFromSession requires the handoff to POST-DATE delivery, so the run's own handoff read as stale. It sat `waiting` until the hourly reaper called it a timeout. Every task shorter than that check hits this, which is every health probe and most one-line fixes — the runs most likely to be used as proof that the loop works. The runner now records the moment of `injectPty()` and reports it in the ack; the server prefers it (`deliveryStampFor`) within bounds that keep the floor honest: never before the run was created (60s of clock slack), never in the future, otherwise the ack time as before. Tested on the verbatim timings above. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh * chore(desktop): ship the delivery-stamp fix as Fleet Runner 0.8.25 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
fadb7f4274 |
fix(terminal): a "Watch" link must open the thing it offered to show (#719)
Dispatch a prompt from Control and you get a "Queued — waiting for a builder"
banner with a Watch link. Clicking it opened a plain bash prompt showing a
week-old panic message. The agent was running the whole time; the page just
opened somewhere else.
WHY
Every watch link is `/terminal?project=<key>` with no source, and the terminal
resolved its source as `initialSource ?? mode.source` — where `mode.source` is
REMEMBERED IN LOCALSTORAGE. Anyone who had once picked Shell had every watch
link on Control silently redirected to a bash PTY, for that browser, forever.
Nothing errored. Nothing looked broken.
A shell cannot be the answer to a project link: it is a Loki-owned bash PTY
with no concept of project tabs — `stripTabs` is not even passed when the
source is "shell". So `?project=` plus a remembered "shell" is never what the
link meant.
THE RULE
A deep link that names a project resolves to an agent source. An EXPLICIT
`?source=shell` is still obeyed — that is the reader asking, rather than a
stale preference answering for them. Nothing else changes: opening /terminal
with no project still honours whatever you last chose.
The rule lives in src/lib/terminal-deep-link.ts so it can be asserted rather
than inferred from a component, and `fleetSurfaceHref` now takes an optional
source so callers that know where an agent runs can say so instead of leaving
it to be resolved.
PROVEN, NOT ASSUMED
- 8 assertions, both directions: the regression, the remembered-shell case with
no project (still shell), explicit ?source=shell with a project (still
shell), an agent source surviving a project link, a hosted plane with no
shell at all, and shell-as-only-source returning something usable.
- Reverting the fix on a copy turns two of those red — the test catches the
original bug rather than describing the new code.
- Driven in a real browser against a dev server, same URL, same browser, with
`loki:terminal-mode` seeded to `shell`:
before the fix -> the header reads "Shell" (the dead end)
after the fix -> the header reads "Cloud"
and the two negative cases re-checked live: no project -> "Shell",
explicit ?source=shell -> "Shell".
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
f7c4e35fdc |
feat(builder): a project can pin its work to the hosted runner — no Claude credential needed (#718)
builder_pref gains a third value, 'hosted'. A project pinned to it never touches a runner PTY: the dispatch goes straight to the hosted runner (Hermes in its own clone on the box, on the providers the box already holds keys for — Copilot, Gemini, Groq), and the hosted runner closes the tracked run with the pull request as evidence, so the outcome reaches the thread that asked, like any other run. Why now: the box's Claude Code credential died silently and every self-dispatch hung, while Hermes on the same box answered fine. The unattended path should not depend on a person's Claude subscription at all. - statuses.ts: HOSTED_BUILDER_PREF / BUILDER_PREFS (channels stay what they were — nothing claims 'hosted' from a queue); API enum widened. - inject-core: hosted branch before the channel pin; run id travels in the hosted_dispatch payload. - hosted-runner: closeHostedRun() through updateOrchestrationRun (outcome turn, ledger, escalation bookkeeping all fire); delivered stamp at claim. - Control → project profile → Runs on: third choice with its explanation. - docs/development/cloud-local-workflows.md: the tier in the SSOT table. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
a4529b94e3 |
fix(loki): the tool loop answers too, it does not narrate its plan (#717)
#709 stopped the Groq FALLBACK serving the model's plan as the answer. The same guard was missing on the tool loop — the path that serves nearly every turn. WHY GROUNDING CANNOT COVER THIS A plan asserts nothing, cites nothing and invents no proper noun, so it passes every rule in verifyAnswer while telling the operator nothing at all. That is exactly how it reached production: retrieval was fine, the answer was scratchpad, and every automatic check said the turn was clean. WHY THE GAP IS REAL AND NOT THEORETICAL openai/gpt-oss-20b — the model that demonstrably wrote "We need to answer: … We must cite each claim … Let's go through each:" and spent its whole budget on it — is link TWO of this chain. The only reason the leak has not been seen here is that gpt-oss-120b usually answers first. That is luck, and a fallback chain exists precisely for the times the first link cannot answer. MEASURED BEFORE ADDING IT Ran the detector over every assistant reply Loki has stored: 106 replies, fires on exactly 2 — both the same question, both from before the fallback fix, both genuine leaks. ZERO false positives on the other 104. That was the deciding number rather than the hit rate. A guard that misfires costs a second model call on a rate-limited free tier, which is the resource this whole week of work has been about conserving. THE CURE MUST NOT BE WORSE Four properties pinned, three of them about restraint: - a plan is retried ONCE, with the instruction the first attempt showed it needed — never a loop - a second plan is not an improvement, so it is not retried again - an EMPTY retry never replaces a real reply: a plan at least shows the model read the question - a good answer is never re-asked, so the common path costs nothing The retry carries no tools: the model already gathered what it needed, and the failure was in writing the answer, not in finding it. A failed retry leaves the first reply standing — losing the turn to protect its formatting is the worse trade. The stream is reset so the plan does not sit on screen above the answer. Proved by mutation: disabling the guard fails "the plan must not reach the operator" and nothing else. Verify green, 233 checks. Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ac02ee25aa |
fix(box): the builder probe runs through a login shell, like the runner (#716)
The runner launches agents with 'bash -lic', which sources ~/.bashrc — and ~/.bashrc on the box still exported the retired account's CLAUDE_CODE_OAUTH_TOKEN. The probe skipped the profile, said ok, and every real agent was refused. Probe the way the agent is launched or the probe proves nothing. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
263de2db0c |
fix(box): the builder probe tests the box sign-in when no env credential is set (#715)
The runner user had signed in to Claude Code on the box and that login worked. A stale CLAUDE_CODE_OAUTH_TOKEN in the runner env — the retired account — overrode it, and every self-dispatch hung. Deleting the env line was the fix; the probe then reported "no token" as DOWN, which was the runner's exact healthy situation. The probe now does what the runner does: API key, else env token, else the runner user's own sign-in. Only a missing sign-in file is a verdict. The DISABLED advice names the override. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
b95ef434b9 |
feat(ai): a third vendor Loki does not share with anything — Gemini (#714)
Loki's free chain had two vendors and both are SHARED. Groq's daily token pool
is org-wide and OpenRouter's 50 requests a day are account-wide, and on bitbaum
the same OpenRouter key serves ten apps — so those two links do not just run out,
they run out TOGETHER, for everyone. A Google project is per-app.
That is the property being bought here, not the model. ai-kit 1.8.0 adds Google
to `freeChain()`, so this is a dependency bump and nothing else — the chain comes
out of the package already ordered:
groq -> google -> openrouter
google models: models/gemini-flash-latest,
models/gemini-flash-lite-latest,
models/gemma-4-31b-it
google keyEnv: GEMINI_API_KEY
day capacity (all keyed): 250000
OpenRouter stays LAST on purpose: its unpaid tier is the scarcest pool in the
chain, so every other pool is drained before one of those 50 requests is spent.
Every id was verified with a real key on 2026-09-15 — 200 on the catalogue, a
NATIVE tool_call from each of the three, and a non-empty completion with
finish=stop. The `models/` prefix is deliberate: the catalogue lists all 56 ids
prefixed with no bare form anywhere, while /chat/completions accepts both, so a
bare id would serve perfectly AND be reported missing by the rot check forever.
ONE TEST HAD TO CHANGE, and it is the interesting part.
`ai-budget-gate.ts` set exactly GROQ_API_KEY and OPENROUTER_API_KEY, then
asserted capacity equalled the sum over EVERY provider in CHAT_CHAIN. That is
the same statement only while the chain has exactly two vendors; with three it
went red at 200000 vs 250000. The assertion was about capacity but was WRITTEN
as an assumption about how many vendors exist.
It now derives its keys from the chain, so a fourth vendor cannot silently turn
"all keyed" back into "some keyed". And it gains the case that was impossible
before: an UNKEYED vendor contributes nothing to the total — with two vendors,
"all keyed" and "some keyed" were the same set, so the subset could not be
stated at all.
(The identical bug existed independently in ai-kit's own chain.test.js and was
fixed there in the same release. Two repos reached the same wrong shape from the
same true premise.)
GEMINI_API_KEY is already installed in /opt/loki/app/.env, and the unit reads
that file (EnvironmentFile=/opt/loki/app/.env), so this takes effect on deploy.
Worth stating for whoever weighs it later: Google's FREE tier says content is
used to improve its products; the paid tier says the opposite. This is the
second-to-last link, reached only once the pools above it are spent.
Verified: pnpm run verify clean, 171/171 unit test files.
Claude-Session: https://claude.ai/code/session_01HJRuvHJEBd8t7iRA9Sb1iw
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
a22b6d4ae7 |
fix(security): one secret-scanning message per repo, skip forks, dry-run first tick (#711)
The per-repo read (#710) fixed a blind org endpoint and immediately sent 100 Telegram messages: the openclaw FORK carries ~100 open alerts for upstream's own test fixtures, and the loop paged each one. Now: forks are not read at all, N new alerts in one repo are ONE line counting by type, and the tick an install runs right after writing the check is journal-only so a change of data source never pages the whole baseline as "new". The test plants a fork with 100 alerts and asserts zero messages, and three alerts in one repo → one message. Claude-Session: https://claude.ai/code/session_01G6ax7X9GfarifcZUiqsVJm Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
efeabdec64 |
test(e2e): does Loki work as intended — asked of the live site, on a clock (#712)
Three testable meanings, one script, no browser and no mocks (scripts/test/loki-loop-e2e.ts, run as the signed-in operator through the same API the /loki page uses): 1. knows the fleet — a fleet-shaped question is answered from the studio map (all three pillars named, fleet_map among the retrieved sources) and the reply is an answer, not the model's plan for one; 2. publishes the map — /api/fleet/map is public with the pillars live, and bitbaum's map.json is the same map, recently generated; 3. closes the loop (--dispatch) — a request typed into a thread comes back into that thread as an outcome turn. A run that never returns is aborted with a [loki-e2e] marker so no test leaves the operator's queue hanging. Proven against production before commit: 3/3 without dispatch; with dispatch and the builder unauthenticated, the loop failed honestly inside two minutes with the runner's own diagnosis delivered into the thread. Scheduled on the box every six hours (install-loki-e2e-watch.sh -> loki-e2e-check.sh, alert on flip; the dispatch leg only when the builder-auth probe last said ok). pnpm run test:e2e:loki runs it from a laptop. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
e17e51921a |
fix(security): read secret-scanning alerts per repo, not from the org endpoint (#710)
The org-level secret-scanning endpoint answered [] on 2026-09-14 while botsmann's own endpoint listed three open alerts (Mailgun key, two MongoDB URIs), so the daily check would have stayed silent about every existing and future leak. Iterate the active repos instead; a repo whose alerts cannot be read (scanning unavailable on the plan, no access) is noted in the journal and skipped rather than counted as empty. Test fixtures follow. Claude-Session: https://claude.ai/code/session_01G6ax7X9GfarifcZUiqsVJm Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
b8aea45988 |
fix(loki): the Groq fallback answers, it does not narrate its plan (#709)
Asked "what projects do we have, name the three pillars" with the fleet map in context, the fallback (openai/gpt-oss-20b at low effort, 1024 tokens) replied "We need to answer: … We must cite each claim … Let's go through each:" and spent the whole budget describing how it would answer. No <think> tags, so stripReasoning let it through; grounding passed, because a plan makes no claims. Probed on Groq directly: gpt-oss keeps its reasoning in a separate field — this was the FINAL channel, the model thinking out loud because low effort gave it nowhere else to. - effort "medium" with a 2048-token budget, raised together as groq.ts documents, so the thinking happens in the hidden channel. - looksLikePlan() (pure, tested on the verbatim leak) catches a reply that addresses the model instead of the operator; one retry with an answer-only instruction, after a stream reset so the plan does not stay on screen. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
df113dc811 |
feat(security): threat detection for the box, the GitHub org and the laptop (#708)
A 2026-09-14 posture audit found the box well guarded (default-deny ufw, keys-only SSH, fail2ban, unattended upgrades, offsite restic) but blind: no intrusion or integrity detection at all, and the GitHub org with secret scanning off on all 48 repos and every marketplace action allowed with the box's root SSH key in an org secret. This adds the detection layer on the existing alert channel, so a break-in becomes one Telegram message within five minutes instead of a discovery months later. - install-security-watch.sh: security-check.sh (5-min timer) alerts on CHANGE only — guards down, sshd drift, edits to the files an intruder touches (sshd/sudoers/authorized_keys/cron/PAM/ld.so.preload/Caddy/ufw/ monitoring/units), new internet-facing ports, new privileged accounts, SSH logins from never-seen IPs that are not GitHub runners, processes from /tmp or miners, new setuid binaries, new containers, stale offsite backup, week-old pending reboot. Baselines seed silently; one grouped message per tick; every message ends with what to do. - github-security-check.sh (daily): new secret-scanning alert, new critical dependency alert, repo turning public, new member/collaborator/deploy key, Actions allowlist loosened. Every API call guarded: a failed call skips its check and keeps the baseline (the first version paged an error body as a policy change, and a wiped baseline would flood "new" next day). - Caddy JSON access log on every vhost (snippet + sync-infra template) and a fail2ban caddy-scan jail: 8 probes for /.env, /.git, wp-login, cgi-bin … in 10 min = 24h ban. Proven by scanning orangecat.ch from the laptop (tenth request refused); a real scanner was banned within minutes. - sshd drop-in: 3 tries, no X11, dead-peer detection, AllowUsers root ubuntu. - scripts/local/laptop-security-check (user timer, 30 min): new network listener, sshd running, screen lock off, upgrades off, ~/.ssh changes, new login account, gh identity change, week-old reboot; delivered through the box's lib-alert over SSH, desktop notification as fallback. - test-security-check.sh (test:ops): 39 assertions extracting the shipped heredocs; the property under test is "speaks once on change, never when nothing changed". - docs/telegram-notifications.md: every new message registered. Applied outside the repo in the same session: secret scanning + push protection on 41/44 active repos (3 private repos are not eligible on the plan) and as org defaults; Dependabot alerts + automated security fixes on all 44; org Actions policy = GitHub-owned + verified + an explicit allowlist of the 11 third-party actions the fleet uses. Claude-Session: https://claude.ai/code/session_01G6ax7X9GfarifcZUiqsVJm Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
5136a3b387 |
feat(projects): say whether something is being built, and one big Make it happen (#707)
A project kicked off from OrangeCat was dispatched at 22:31, its agent went silent after 113 bytes of output, and the reaper closed the run at 00:15. The next morning the page said "No live agent" in a card halfway down, with a text-xs "Run next step" beside it. Nothing answered "is anything being built?" either way, and there was no obvious way to start it. - lib/project-build-status: ONE derived answer (building / queued / stalled / idle + last attempt) from the runner's last observation, the run ledger and the commit list. A runner's `agentRunning` claim past the offline threshold is expired, not true; an open run past a grace window is stalled, not running. - ProjectBuildStatus: the first card on Now. Building → "Watch it work"; nothing running → "Last attempt timed out 1h ago after 1h 44m — nothing reached the repo" and a full-size Make it happen. Same label as the kickoff hero, because it is the same act; the strip yields to the hero when setup is still missing, so there is never a second CTA. - project_states lookup falls back from project id to every key a runner files the row under (display name, checkout directory, repo slug). 92 of 104 rows on the box have no project id, so the id-only lookup was blind for almost every project. - NowSection stops reporting "Agent process running" from an expired claim. - "Run next step" (xs, inside the Next card) is gone; the strip owns dispatch. Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
15fb484a50 |
fix(feedback): Implement gets a real builder, Working means a PTY, Telegram when Needs you (#705)
Phone evidence: Heidi sat Queued / fake Working / Stalled with cloud builder offline and no session on Cloud. Boss-mode: - Implement prefers the cloud box-runner, falls back to hosted Hermes when offline, and refuses with one next action instead of queueing into the void. - Working only when a runner heartbeat proves a real agent PTY; delivered with no output is Starting, then Not running — never fake Working. - Feedback/Control stay short (badge + next action; dig-in for why); Telegram pings when stalled or Check live waits (check-feedback-needs-you). |
||
|
|
ab1fa88cb5 |
feat(loki): tell Loki what the neighbour can make, and what it cannot (#704)
OrangeCat shipped a Studio: it renders video, music, longform writing and artwork, and revises them from plain-language notes. Loki knew nothing about it, so an operator asking "can I make a trailer for this project?" got a flat no — wrong, and the kind of wrong that sends someone looking for another tool. The tempting fix is to let Loki sound capable, which is precisely the failure LOKI_CAPABILITIES exists to prevent (it began after Loki invented a security sandbox and an Approve button that would book a calendar event). So the facts and the boundary land together: ORANGECAT_CAPABILITIES in config/ecosystem.ts states what OrangeCat can do, the preface interpolates those lines rather than restating them, and the same preface denies Loki every one of those abilities and hands over a real URL instead. scripts/test/loki-neighbour-boundary.ts pins both halves — that the preface reads the SSOT (no verbatim copy that could drift) and that the disclaimer still travels with it. The build handoff copy now says what OrangeCat is actually for, which is no longer only funding. Note: `pnpm run verify` could not run here — pnpm install fails in this sandbox on the private bitbaum/listkit tarball (403, no credentials). The changed files were checked against the repo's own Prettier 3.9.6 config and the new test's assertions were dry-run against the real sources; CI is the first place the full gate runs. Claude-Session: https://claude.ai/code/session_01U1q1XD74wJXyUAZktvMyW4 Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
f8f557a5ef |
feat(loki): a fleet-shaped question reads the studio map as one fact (#703)
"What projects do we have, which are live, name the three pillars" retrieved an essay (similarity 0.72) and answered that the pillars were Blog, Roadmap and Changelog. The map chunk existed in the index and lost the race: one long overview embeds worse than a focused essay. The shape of the studio is not something a similarity search should be trusted to find. A fleet-shaped question (what do we have, which are live, pillars, the studio, how many projects, what is loki for) now plans fleet_map FIRST — ahead of knowledge, because "what is X for" is a map question — and fleetMapFacts() hands the live map in as one 8k fact, the same overview the nightly reindex embeds and /api/fleet/map publishes. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
72adad45b8 |
fix(ops): the builder probe prefers an API key and says so (#702)
Policy adopted 2026-09-14: the automated path (autopilot, scheduled and multi-user runs) rides an Anthropic API key with a spending cap, never a person's subscription token; the subscription belongs to the operator's own interactive builds in the hosted terminal. The probe now uses the same precedence the runner does and its alert names both fixes in that order. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
366398d149 |
fix(fleet): a project with a live URL but no hosting row is live, and dev-log dates are days (#701)
loki and orangecat are served from the main Caddyfile, not apps.conf, so the map filed both pillars under "not live" next to their own live URLs, and bitbaum would have grouped them as Not live. liveUrl is the SSOT for served; the register row only adds kind/owner/since. Dev-log dates are timestamps in the DB and days on the map. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
275d162f44 |
feat(ops): hourly probe that the box builder's Claude Code token still works (#699)
The box-runner's CLAUDE_CODE_OAUTH_TOKEN belongs to the Claude account that minted it. When the operator moved accounts (2026-09-14) the box kept the old token; every dispatch printed "Your organization has disabled Claude subscription access for Claude Code" into a PTY nobody reads, went silent, and was reaped an hour later as "timeout". The product's whole promise was off and nothing said so. builder-auth-check.sh asks the builder one question with the runner's own environment and alerts on the state flip (ok / disabled / down), naming the fix. Installed hourly by install-builder-auth-watch.sh; tested against the verbatim line; the token never appears in output. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
c2f001a511 |
feat(fleet): publish the studio map — every project's purpose, layer, state and last movement (#698)
"What do we have, what is each thing for, where does it run, what is happening on it" was answered by the register (facts) plus 24 hand-written briefs, a showcase overrides file and an ecosystem config that all restate the register in prose and drift within days. The assistant could not answer it at all: no chunk in the knowledge index held the shape of the fleet, so "what projects do we have" came back as "Not in your data". - GET /api/fleet/map: the register join, plus per project the purpose line from its profile, a layer (the three pillars, product, client, demo, next), hosting state and owner, public doors (live, repo, OrangeCat, Solon), the dev log's declared next step, and what last moved (open runs, last run outcome, last log headline). Public and cached like the register; prices, paths and tokens stay out (api-route-auth names the reason). - src/lib/register/map.ts is pure and unit-tested; load-map.ts is the I/O half, shared by the route and the nightly reindex so page and assistant read the same map. - reindex-knowledge embeds one fleet_map overview chunk (owner-scoped): one line per project in a fixed order, so the fleet's shape is retrievable. bitbaum renders this map (its own PR) and publishes it as map.json; Cat on OrangeCat reads it into its context. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
81f4eeeb98 |
feat(loki): a dispatched run reports back into the thread that asked for it (#697)
A request typed into /loki ended at "Dispatch queued". The run closed hours later into run_events, a push notification and Telegram — everywhere except the conversation the person was typing in. Learning whether the work happened meant leaving Loki for GitHub, which is the trip this product exists to make unnecessary. - Chat dispatches now carry the conversation id and opt into close notification. On close, notifyRunClosed also writes an assistant turn of kind "outcome" into that thread: what happened, the pull request found in the repo during the run (which merges on its own once green) or the honest absence of one, and the project's live URL (run-outcome-format.ts, pure and tested; run-outcome-post.ts does the lookups). - While the newest turn in a thread is still a dispatch, the workspace re-reads the thread every 20s so the outcome appears without a reload. - The dispatch closing and the box agent contract now ask for auto-merge on the PR the agent opens: CI is the reviewer, a green PR merges and deploys by itself, and the old "never merge from here" no longer leaves work stranded behind a button nobody presses. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
95c40a9cd8 |
refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now share one name. 638 files, ~3,000 mentions: UI copy, config, env keys (FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs, articles, the deploy workflow other repos reuse, and nine file names. - Three article slugs carried the old name and had been shared; permanent redirects keep those links alive (next.config.ts). - test-no-retired-name.sh now also forbids the old product name across the whole repo, so the rename cannot creep back through templates and examples. - ASSISTANT_STACK collapses the product and the assistant into one entry, because they are now the same name. Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki` database and role, loki.orangecat.ch (old host 308s to it; /api, /widget, /embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases. The Resend sending domain stays fleetcrown.orangecat.ch until the new domain is verified in DNS. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
f3674d0952 |
feat(ops): report a real served rate, once the wins are visible (#694)
The sweep counted any line carrying a `link` field as a failure, which was right only while failures were the sole thing logged. The moment the app logs a served turn — the next commit in orangecat — that would have read a link answering seven calls out of ten as ten failures and alerted on it. So selection is by MESSAGE now, not by the presence of a field: "model call failed" and "provider failed, trying next fallback" are failures, "model call served" is a win, and the report divides one by the other. Where wins are not logged the output still says "a floor, not a rate" rather than inventing a denominator. A percentage derived from an unseen denominator is exactly the confident-but-wrong number this script was written to avoid. Mutation-checked: selecting on the field alone fails four of the new tests, including the one where a link that ONLY succeeded gets alerted on. 18 cases now. |
||
|
|
d32f6c9968 |
fix(ai): "spent" must never sit beside a number that says otherwise (#691)
Rendered the capacity page from the LIVE production table and read it. Groq's
per-minute window came out like this:
groq openai/gpt-oss-120b [spent]
3,984 of 8,000 tokens this minute
Half a tank, labelled spent. The STATE is right — 3,984 tokens buys no whole
answer, so the turn genuinely cannot be served from that window — but the word
contradicts the figure printed next to it, and a label that argues with its own
number is exactly how a dashboard gets called made-up.
So a shortfall is now its own fact:
groq openai/gpt-oss-120b [too low]
3,984 of 8,000 tokens this minute — under one answer's worth · back now
An empty tank still says spent. The two are not the same and they do not even
recover on the same timescale: a minute window with 3,984 left refills in
seconds, while 0 of 50 requests a day is back tomorrow. The summary counts them
apart for the same reason.
THE SUBTITLE CARRIES MEASUREMENTS, AND ONLY MEASUREMENTS
The same render showed the "also metered" line repeating a skip notice under a
row that already said it, and a stale counter phrased as "not measured recently
— this counter refills every minute", which does not even name which counter it
is talking about. Neither is a measurement. Both are gone; nothing measured is
hidden, because an unmeasured counter was never measured.
Quota-view checks 27 -> 31. Verify green.
Found by looking at the page rather than at the tests — which is the only way
either of these was ever going to be caught.
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
6b552296a6 |
fix(ai): show the limit that is actually stopping you (#690)
Groq meters three things. It publishes two.
At 13:26 today the capacity page had every reason to call Groq healthy:
tokens / minute header 2,672 of 8,000 left
requests / day header 999 of 1,000 left
tokens / DAY 429 body 227 of 200,000 left
The third is why "what needs me right now" returned a 503 to the operator. It
is stated once, in prose, inside the body of the refusal enforcing it, and
nothing was reading it.
TWO CHANGES, ONE IDEA
1. Record the counter only the refusal admits to. ai-kit 1.6.0 adds
readingFromRefusalBody; this wires it into the 429 path. A "size" 429 is
deliberately excluded — that reports THIS PROMPT being too big, a fact about
the prompt, not about remaining allowance.
2. One model, one row. Three bars per model is not more honest, it is less: it
invites the reader to average limits that do not average. The answer to "can
I use this right now" is the WORST counter. Counters are ranked by how hard
they block — exhausted, then skipped, then tightest known, then unknown — and
the leader is shown with the rest named underneath, so nothing measured is
hidden.
A STALE COMPLAINT MUST NOT OUTRANK A LIVE MEASUREMENT
A skip row says "at 13:27 we did not call this", and nothing ever rewrites it —
only another skip replaces it. So once the budget fix lets Groq through, this
page would have gone on insisting Groq is never reached, indefinitely, while it
was quietly answering. A reading taken later than a skip now supersedes it. Both
directions are pinned: the fix must show as fixed, and a skip newer than every
reading still leads, because then it IS the current fact.
TWO BUGS FOUND ON THE WAY
Both would have read as more numbers that do not add up.
- React was keying two rows identically. key={provider}:{model} already
collided, because Groq reports two counters for one model TODAY.
- summarise counted counters as providers, so a page with two vendors was
announcing "of 5 configured".
Grouping fixes the arithmetic at its source rather than papering over either.
Verify green. Quota-view checks 19 -> 27. The ai-kit side was proved by
mutation: breaking the arithmetic fails 3 of its 4 new tests.
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
f926f37811 |
perf(loki): stop skipping Groq on prompts it would have taken (#689)
Sizing a prompt and skipping a link look like the same question. They are not,
and answering them with one number was costing us the fastest provider we have.
WHAT THE PRODUCTION LOGS SAID
Yesterday's scoped catalogue got the feedback turn onto Groq for the first time:
[loki] turn via=tool-loop model=loki/groq/openai/gpt-oss-120b ms=1378
1.4 seconds, where the OpenRouter path measured 19-25s. But four other question
shapes were still walking past it:
skipped groq/openai/gpt-oss-120b (prompt ~5887 > 5400) <- 487 tokens over
skipped groq/openai/gpt-oss-120b (prompt ~6996 > 5400)
skipped groq/openai/gpt-oss-120b (prompt ~7790 > 5400)
skipped groq/openai/gpt-oss-120b (prompt ~8316 > 5400)
5,400 is not Groq's window. Groq's window is 8,000. The gate was built from
floor(8000 * 0.85) - 1400, stacking an estimator margin on top of a reply
reserve AND charging the margin against the reserve — a fixed allowance we
choose, which has no estimator error in it. The honest bound is 8000 - 1400.
THE TWO MISTAKES DO NOT COST THE SAME
Skip a link that would have answered
-> the turn goes to OpenRouter: 19-25 s, and one of only 50 free requests
a day. Measured today: that pool hit zero mid-eval and the next question
returned a 503 to the operator.
Try a link that refuses
-> Groq answers 429 in about a second and the chain moves on to that same
OpenRouter call. A per-minute refusal is rejected before processing, so
it costs nothing against the daily token pool either.
One second against twenty-five and a scarce request. A gate with that payoff
belongs at the hard limit. The 429 IS the safety net — which is exactly why the
estimator's 15% does not need to be charged twice.
SIZING KEEPS ITS MARGIN
Two functions now, because the asymmetry only runs one way. Sizing a prompt too
big is unrecoverable — it gets truncated, or the only link refuses it and there
is nothing to fall back to — so linkPromptBudgetTokens is unchanged and the loop
still sizes against it. Only the chain walker moves to the new ceiling. A
Groq-only deployment therefore still packs conservatively; it just stops
refusing to try.
Two tests pin the bounds apart, including that they only diverge for a
per-minute-metered vendor — elsewhere a second knob is a second thing to drift.
Effect: the 5,887-token turn now reaches Groq. Verify green, 11 budget checks.
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
684883549f |
fix(terminal): give the phone back its screen, and say where the shell runs (#688)
Three complaints, measured on a 390x844 phone before touching anything. TOO MUCH CHROME The page spent 204px above the terminal and 64px below it — 268px of 844, before a single line of shell. The terminal got 390px. An optional email reminder was 74px of that: not required, dismissible, and sitting on the one page where the viewport IS the product. It is now suppressed on /terminal specifically, not removed — it still appears everywhere else, and dismissing it there still silences it for good. Chrome above the terminal: 204px -> 130px. The terminal: 390px -> 480px, +23%. NO FEEDBACK The pane printed the raw lifecycle enum into its header — "provisioning", "starting". Those are our words for our state machine, not an answer to the only question being asked, which is whether the thing is working. They now read opening / starting / ready / idle / closed / failed, and a failure offers "Try again" instead of a dead end. WHERE IS THE WORK HAPPENING The pane never said. It knew: /api/workspaces resolves the cwd and then threw it away. The route now returns `cwd` and `home` alongside the handle, and the pane header shows the directory, full path on hover. The existing stall overlay gets it too, so "nothing came back" names the place nothing came back from. WHAT I GOT WRONG ON THE WAY, BOTH CAUGHT BY LOOKING A first pass truncated the path from the left with CSS `direction: rtl`. That moves the leading separator to the far end: /home/g rendered on the page as "home/g/". A shortened path is fine; a path that is a DIFFERENT path is not — it is the one string on that row someone might act on. Shortening now happens in code (src/lib/terminal-path.ts, 22 assertions), where the output is a real string that can be asserted. It lives in lib rather than beside the component because importing the component pulls xterm's stylesheet into the test runner. The same pass added a stall detector to the pane. TerminalView already had one — driven by ACTUAL OUTPUT rather than by lifecycle state — and mine fired a banner reading "No output yet" over a terminal with output plainly on it, twice, for two different states. Two detectors that can disagree is how a page starts lying. Mine is deleted; the real one now gets the location it was missing. pnpm verify green. Rendered and measured at 390px throughout. NOT FIXED, AND WORTH KNOWING The mobile key deck and composer only mount once a session is attached (`activeTab`), so a session that never attaches leaves the phone with no way to type and no way to retry from the keyboard. That is a real hole, but the fix is a layout decision about what the dock should show with no session, and it is not a change to make blind. Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
83968bae23 |
perf(loki): show the tools the question needs, accept all of them (#687)
Groq's window is 8,000 tokens per minute. A measured feedback turn was 10,153, so the preflight skips Groq on every single call and a whole free provider is never used — which is the direct reason OpenRouter burns its 50 requests a day. Cutting RECORDS to fit would recreate the failure this retrieval layer exists to end. So I measured where the tokens actually are before touching anything: system prompt (tools on) : 1,869 of which the catalogue: 1,328 native tool schema : 1,141 FIXED OVERHEAD : 3,010 tokens, before a single record That is 47% of a 6,442-token turn, spent on eighteen tool descriptions. Scoping the catalogue to what the planner already routed saves 1,100–1,700 tokens per turn. The feedback question goes 6,442 -> ~4,780, inside Groq's budget, without dropping one record. THIS REMOVES NO CAPABILITY, AND THAT IS TESTED Only what the model SEES narrows. The accepted-name set stays the whole registry and every handler stays reachable, so a model that names an unadvertised tool still runs it. A test advertises exactly one tool, has the model call a different one, and asserts it executes. Three more properties pinned: the tools for every planned source are always advertised; the core four are always present (the pulse and project list answer "what else", the knowledge index answers "why did we decide that", and propose_action is the only lever Loki has on the world); and a question nobody could route advertises EVERYTHING, because it might need anything. MEASURED FIRST, ON PRODUCTION Baseline across five real questions before changing anything: every answer grounded ok, both objective checks passed (named "Heidi" for the latest feedback, "34" for the project count) — and ZERO turns called a tool. The seed answered all five. So this reclaims tokens from capability that no measured turn was spending. The same five re-run after deploy is what decides whether this stays. 164/164 unit test files; 38 planner checks (up from 33), 17 loop checks (15). Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
3ccf63588b |
feat(ops): watch the provider the fallback chain is hiding (#685)
A fallback chain hides the thing it protects against. Groq answered 400 json_validate_failed to EVERY structured Cat call — prompt suggestions, the offer engine, both writing engines, the intent router — for days. Users got answers, the health route stayed green, and the only trace was a warn line in a journal nobody reads. It was found by hand. link-health.ts already makes a dead link cheaper (a 60s in-process breaker) but deliberately forgets, and forgetting is the problem: a provider can be down forever and the symptom is a slightly slower reply. ai-provider-check.sh reads the app journals over 24h, counts failures per provider/model, names the kind (json_validate_failed, rate_limit, 429), and alerts through the existing lib-alert plumbing — alert_transition, so it fires on a state flip rather than nagging daily. Three things it deliberately does NOT do: - It does not claim a success RATE. Failures are logged, successes are not, so this is a floor and says so. A monitor that implies more than it knows is how the registry audit came to report "zero adopters" for a package with eight. - It does not treat an empty journal as health. No lines is COULD NOT LOOK, and it alerts on that too. A monitor that cannot go red is worse than no monitor. - It never disables a provider. Which link to drop is a product decision with cost and quality on both sides; an automated answer would be wrong in the direction nobody notices. The test fixtures are verbatim lines from the incident, and they earned their keep immediately: they caught a trailing quote that counted one link as two, and kind-matching that silently excluded every fallback line — which is exactly where `reason` lives. Against the live journal it now reports groq at 2 failures in 24h, down from 11 before this morning's fix, so at the default threshold it stays silent. That is the fix confirming itself. |
||
|
|
c9c65360c1 |
fix(ai): the capacity page was describing a subsystem as if it were the system (#684)
George's reaction to the page as shipped: "this looks bad and is not actionable
and the numbers look like bullshit". All three were fair, and the third was the
tell — the numbers looked wrong because the page was describing one of three
answer paths while presenting itself as the whole picture.
Three false claims, from the journal rather than from reading the code:
1. "groq — configured, but it has not served an answer yet. Will be measured on
the next answer it serves."
Both halves false. Groq HAD served (through callGroqText, a path with no
meter on it), and it is being SKIPPED on every turn:
skipped groq/openai/gpt-oss-120b (prompt ~10153 > 5400)
skipped groq/openai/gpt-oss-20b (prompt ~8312 > 5400)
Four skips in six hours. It will never be measured, and the operator was
told to wait for that. The actionable truth — prompts exceed the window, so
this vendor is never reached, which is WHY the next one burns out — had
nowhere to live, because a row could carry a number but not a reason.
2. "Every measured provider is spent." One of two had been measured. True, and
it reads as evasion, because it quietly redefines "every" to mean "the one".
3. The gateway served most of today's answers and was not on the page at all.
So the page could report everything spent while Loki plainly worked. The
omission, not the arithmetic, is what made it read as untrue.
WHAT CHANGES
- A fourth state, `skipped`, distinct from `exhausted` — opposite problem,
opposite fix. Its consequence names the fix ("shorten the prompt or raise its
budget") because waiting changes nothing, and it is URGENT: a provider walked
past on every turn is capacity held and never spent.
- `provider_quota.note` (0069) carries the reason. `source: "preflight"` marks
a skip; `remaining` is 0 there only to satisfy a non-null column, so the
presenter keys on source and never reads that 0 as empty.
- Counts are always out of the TOTAL: "1 spent, back in 4 hours · 1 never
reached · (of 2 configured)".
- Rows are ordered by CHAIN POSITION, not recency. Recency put the last link
above the link that precedes it, directly under the words "this is the last
link".
- The gateway is listed as an unmetered path, because it answers.
19 presenter checks (up from 15), 164/164 unit test files.
Claude-Session: https://claude.ai/code/session_01Nm2REqtdsVsvjukBU2maCz
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
a3f6b6805b |
chore(apps): heidi gets a database (#682)
heidi's row read `db=-`, meaning the deploy's schema step skipped it. It is about to ship drizzle migrations for study groups, and `apply-schema.sh` resolves the target database from THIS column rather than from the app's DATABASE_URL — so without this line the migrations would be silently skipped, exactly as botsmann and printcraft shipped green for months while the pipeline never saw a file. The database, role, pg_hba rules and credentials are provisioned on the box. Provisioning set default privileges FOR ROLE postgres in heidi's public schema, because the schema step runs as the superuser: a table a migration creates is owned by `postgres`, and the app role is granted nothing on a table it does not own. That is the failure vitareba's schema-usable health check exists to catch, and on that database it was repaired by hand afterwards — `pg_default_acl` there is still empty. Setting it before the first table exists is cheaper than granting after every one. The rest of the row was checked at the same time, per the lesson from the hirnli/evig mix-up: port 4025 matches launch.sh, repo_path, domains, owner and app_dir are all current. Only `db` was wrong. Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
f637036f17 |
feat(feedback): say WHY the agent is quiet, not just that it is (#679)
* feat(feedback): say WHY the agent is quiet, not just that it is George dispatched a fix at 15:45:29. The first output arrived at 15:58:43 — thirteen minutes later, and only because he opened a terminal by hand and found the agent sitting at a Claude sign-in. The row said "the agent never reported any output". True, useless, and the reason was ten seconds away. Silence has two meanings and the operator can only act on one. "Thinking" is nobody's problem; "waiting for a human" is theirs, right now. The runner could already tell them apart — detectAuthFailure reads the transcript for a 401 or a /login notice — but it only ever asked ONCE, inside an 8-second window at inject time. That run passed the check and then went quiet, and nothing looked again. The heartbeat is the thing that watches the terminal for the whole run, so it is where the question belongs. After 90 seconds of no output the runner asks, and the answer rides the next beat; the route stamps payload.blocked and emits one `blocked` event per stretch; the row reads "Needs you to sign in" with Watch opening the terminal where you answer it. 90 s is chosen so the reason is ready BEFORE the ten-minute mark forces the row to say something. One subtlety worth the test that pins it: a blocked agent prints nothing, so the "no output, no beat" rule would have suppressed exactly the beat carrying the reason. Silence WITH a reason is now the message — still one beat per window. detectAuthFailure moved to desktop/src/main/agent-auth.ts: the poller starts the heartbeat, so importing it back would have been a cycle. 163/163 unit files, lint, check:desktop, prettier green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(desktop): 0.8.23 — the runner says why a quiet agent is quiet Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
69b5926ff4 |
chore(register): delete the six experiment sites, and gate what let them linger (#678)
* chore(register): delete the six experiment sites, and gate what let them linger Six sites from dogfood and site-factory runs on 10-11 September were still live today, five with GitHub repositories behind them. Two of them read as real Zurich businesses that do not exist — "Velokiosk — Bike Repair at Zürich HB" and "Kaffeeklappe – Kaffee to go in Zürich Wiedikon" — on the founder's own domain. Nobody decided to keep them. They were never removed once the thing they proved was proved. All six are gone from the box (service, vhost, /opt, checkout, port, row, workflows, and this box's deploy key revoked from each repo first), and the five repositories are deleted. This removes their rows here, which had drifted from the box copy. The gate is the point. check-no-experiment-litter.sh fails the build when a generated throwaway name reaches the committed register — a dated suffix (-sep11-0040) or a throwaway prefix (dogfood-, factory-, probe-, e2e-). No grace period: spinning one up for an hour leaves no trace here, so committing its row IS the moment a test becomes permanent. It matches names, not kinds. A first version judged kind=demo and flagged sbb-fundbuero and camille-boulangerie, which are real work that happens to sit at demo status — exactly the false positive that gets a gate widened until it catches nothing. No product is ever called factory-sep11-0040. * docs(retire): delete the project first, or the box puts the site back Deleting the six sites in the obvious order looked like it worked — units stopped, vhosts gone, directories removed. Two minutes later: [box-prepare] cloning velokiosk-sep10 <- github.com/bitbaum/velokiosk-sep10 and three of the six checkouts were back. A FleetCrown project row that still names a dirPath is a standing instruction to restore the site, and it is invisible from the box, so the box cannot know the site was retired on purpose. The order is now part of the documented cleanup. |
||
|
|
27b7e403f8 |
feat(ai): what is left at each vendor, and what happens when it runs out (#677)
FleetCrown enforced a daily AI budget with no interface at all: a user was
refused and never learned why, or what their share had been. And nothing
anywhere knew how much was left at the VENDORS — the constraint that actually
decides whether the next answer happens.
Settings → AI now shows it, and the numbers come from the answers we already
paid for rather than from asking.
WHY OBSERVED AND NOT POLLED
The obvious design is a cron that asks each provider how much quota remains.
That design reports a FULL TANK DURING AN OUTAGE. Measured on one live key,
within the same second:
GET /api/v1/key -> limit_remaining: null, usage_daily: 0
POST /chat/completions -> 429, x-ratelimit-remaining: 0 of 50,
"Rate limit exceeded: free-models-per-day"
Both are OpenRouter's answers about the same account, and the account was
locked out. Its usage endpoint tracks money, free models cost nothing, and the
limit that binds is a request count that endpoint never reports.
So the recorder hangs off the existing model call and reads the rate-limit
headers off every response, success and refusal alike. No extra request, and no
quota spent to discover how much quota is left.
A NUMBER WITHOUT AN ACTION IS DECORATION
No row shows a bare percentage. Each says what is left in ANSWERS, when it
returns, and which provider takes over — because "78%" tells you nothing you
can do and "about 40 answers, then it moves to OpenRouter" tells you whether to
care. Tokens are translated because nobody has an intuition for a token.
THREE STATES, NEVER TWO
known · unknown · exhausted. A vendor nobody has called today has no reading,
and it is drawn as UNKNOWN with the reason stated — listing only what has been
measured would let the page read as the whole fleet while omitting the provider
about to serve the next turn. A per-minute counter read six minutes ago also
reverts to unknown rather than reporting a number that expired.
DETAILS THAT ARE LOAD-BEARING
- `key_owner` is a non-null text column, not a nullable user_id. Postgres treats
NULLs as DISTINCT in a unique index, so a nullable owner would let the
platform accumulate one duplicate row per observation while the upsert never
found its target — a rollup silently becoming an append-only log.
- The recorder is never awaited, cannot throw, and imports the db lazily. A
telemetry write must not add latency to an answer someone is waiting for, nor
fail it and demote a working vendor off the chain.
- A unique INDEX rather than a CONSTRAINT so the migration can carry
IF NOT EXISTS, which the box's forward-only applier requires.
- 0067 is hand-written: drizzle-kit generate stops on an interactive prompt in
this schema, and apply-schema.sh globs numbered .sql rather than reading the
journal — as 0065 and 0066 already did.
FIVE DEFECTS CAUGHT ON THE WAY IN
Two by reading it back: a stale-write guard that was a tautology
(eq(observedAt, observedAt) is always true), and an unreachable sub-minute
branch (40 seconds rounds UP to 1). Three by the gates: prettier on the
workspace file, react-hooks on a synchronous setState in an effect (which also
exposed a real unmount race), and the dead-exports ratchet on a single-counter
read written for a router that does not exist yet — deleted rather than
baselined.
163/163 unit test files; 15 new checks on the presenter, which is pure.
Co-authored-by: Cato <georgy.butaev@revamp-it.ch>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
ac8c25597c |
fix(teardown): stop offering a repo deletion no token can perform (#670)
* fix(teardown): stop offering a repo deletion no token can perform
Deleting a project with ?deprovision=delete-repo returned
502 {"error":"GitHub delete failed (403)",
"detail":"Must have admin rights to Repository."}
found by running the whole create-and-reverse path against production.
The cause is not a permissions mistake: GitHub requires the delete_repo
scope, and neither credential this product holds asks for it — the org
token has gist/read:org/repo/workflow, the user OAuth grant has
read:user/user:email/repo/workflow. So no FleetCrown token can ever
delete a repository, and the button offering it could only ever fail.
That is the right security posture, so keep it and make the product
honest about it instead:
- the teardown UI drops the delete option and links to the repository's
own Settings page on GitHub, where the owner has rights we never borrow
- a delete attempted through the API reads GitHub's x-oauth-scopes header
(sent on every response, errors included), and when delete_repo is
genuinely absent says so, lists what the token does have, and gives the
URL — rather than echoing a 403 nobody can act on. A token that DOES
hold the scope and still gets 403 keeps the real message.
- retire-site.sh --repo delete refuses up front, before the service,
vhost and files are gone, instead of failing at the last step
Verified against production: repo creation 200, archive 200, publish to
OrangeCat then take it down (public page 200 -> 404), project delete 200.
scripts/test/repo-delete-capability.ts pins both halves of the contract
and fails if either comes back.
* fix(retire): warn while it is a plan, refuse only when told to go
CI runs a GitHub token without delete_repo, so the new preflight aborted
the DRY RUN and took the whole retire-site suite with it. A plan that
cannot run is still worth reading: it now says the scope is missing, and
only --go refuses outright, before anything is torn down.
The test stubs both answers from gh rather than inheriting whichever
token the machine happens to hold — CI has no delete_repo, a laptop may.
|
||
|
|
3a8f152cf4 |
fix(feedback): the auto-merge safety guard was decoration — an audit, and what it found (#669)
* fix(feedback): the safety guard was decoration, and four siblings of it
A first-principles audit of the loop, written as if the auto-merge had already
gone wrong. Five defects, none of them stylistic.
1. THE OWNERSHIP GUARD DID NOT EXIST. decideAutoShip takes fromOurDispatch and
refuses when it is false; the single call site passed a hardcoded true. The
pull request is resolved from PROSE the agent wrote, so a handoff that merely
mentions a number ("same approach as PR #42") would have handed #42 to the
merge call — and #42 can be a person's unrelated work. It is now established
from GitHub's created_at: a run row exists before any agent touches the repo,
so its pull request is always newer than the run. One minute of slack for
clock skew; anything older belongs to a previous attempt or to someone else.
2. THE CACHE FOUGHT THE THING THAT FILLS IT. The refresher resolved the pull
request preferring the reaper's evidence; the cache-validity check read only
the handoff. A run whose evidence and handoff named different pull requests
could never satisfy the check, so every inbox request re-fetched GitHub for
that row, forever. resolveFixPrRef is now the one answer both ask for.
3. A PAUSE NOBODY COULD LIFT. One failed deploy pauses a project's automatic
shipping. The scan counted resolved and archived rows, and a deploy_failed
ledger is terminal — so the pause never ended and nothing in the product
could end it. Only open rows count now: resolving IS the operator saying
they handled it.
4. STARVATION DRESSED AS A RATE LIMIT. The inbox refreshes at most 8 ledgers
per request and took them in list order — newest first. Everything past the
eighth was never looked at again. Oldest-first makes the cap a rate limit;
the count is logged rather than silently dropped.
5. THE SAME ROW BEHAVED DIFFERENTLY IN TWO PLACES. runnable was only on the
cross-project inbox, so the project page offered Implement on a project with
nowhere to work and answered with a 422 toast instead of "Connect a
repository". Both lists carry it now.
And the gap the audit was really for: NOBODY WAS TOLD WHEN A FIX WENT LIVE, OR
WHEN A MERGED FIX FAILED TO DEPLOY. The loop announced a visitor filing and an
agent's run closing — and a run closes at a pull request, which is the exact
claim the ledger exists to stop making. That was survivable while a human
pressed merge. It is not survivable now that FleetCrown merges and deploys onto
a live site unattended: a failed deploy after an automatic merge is the worst
state this system can produce, and it was silent. notify-shipped.ts announces
both, on a ledger TRANSITION so each fix speaks once, naming whether FleetCrown
merged it.
Every rule that used to live in a loop is now a pure exported function with
tests — projectsPausedByBrokenDeploy, prOpenedByRun, fixCheckedAtMs,
resolveFixPrRef, shipAnnouncementFor — because today's lesson was that testing
the rule while the wiring goes untested is how a feature ships inert.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs(telegram): register the fix-shipped notifier
Every path that can reach the operator's phone owes a row saying what arrives,
when, and from where. The gate is right to refuse without it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(feedback): meet the alert gate where it looks, and stop two labels overstating
CI caught what I had not run: scripts/test/alert-registry.ts reads the alert
types a file raises by scanning it, and FAILS on a file it cannot read rather
than skipping one. A ternary at the call site made this file unreadable to it.
That is the right kind of gate — it refuses to pass vacuously — so the types
are literal `type:` fields now, and the branch reads better anyway because the
severity differs with the type.
Two labels also claimed more than they measured, the same class this whole
audit is about:
"Report → fix" is stamped when the operator presses Confirm, so the number is
dominated by how long they took to look, not by how fast the loop shipped. It
says "Report → confirmed" now.
FeedbackInbox's own docstring still described "Needs you / In progress /
Shipped" grouped by DB status — the arrangement replaced precisely because
status cannot answer the page's one question.
160/160 unit files, lint, prettier, tsc, design and both registry gates green.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(feedback): pin the ownership guard to the real merge and the real mistake
The best pin available for prOpenedByRun is production. On
dogfood-site-sep10-1201, run 1ff0be72 started 16:13:25 and its pull request #3
was opened at 16:15:37 — two minutes in, and it merged for real. The pull
request the parser wrongly named, #1, was opened at 10:21:48, six hours
earlier.
So the guard admits the merge that legitimately happened and rejects the exact
pull request that yesterday's bug resolved. It is a second, independent line of
defence against that failure: prose said #1, but #1 predates the run.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
e5f8e8ea49 |
fix(loki): let it think, and fetch the thing you asked about (#668)
Asked "what do you think about heidi", Loki answered:
...`.
Everything is clean and strictly compliant.
</think>An opinion or assessment is: Not in your data.
…and then listed every record containing "Heidi", including two unrelated
people who happen to be named Heidi. Four defects, stacked.
## 1. A model's private reasoning was persisted as the answer
There is a literal `</think>` in the database. This repo already knew the
trick — TWICE, in `frontier/propose.ts` and `orchestration/dod-gate.ts` — and
both copies exist to make JSON parse. The one path a HUMAN reads had none.
`stripReasoning` now lives once, at the model seam next to
`stripToolCallLines`, and is applied at all four seams (tool loop, groq
buffered, groq streamed, gateway). The two old copies call it.
`lastIndexOf` rather than a regex is load-bearing: the leak had a CLOSING tag
and no opening one, because the head of the reasoning was lost upstream. A
`<think>[\s\S]*?</think>` pattern matches nothing there.
While streaming, nothing can know text is reasoning until the tag arrives — so
the gate now RETRACTS what it showed the moment the tag proves what it was.
## 2. It was forbidden to have a view
`buildContract` says every claim must cite a record (1) and anything without
one gets exactly "Not in your data." (3). An opinion is not a record, so the
model looked one up, failed, and refused. It was obeying the contract exactly.
ai-kit's OTHER builder, `buildAssistantRules`, already carries the equivalent
carve-out as its rule 5 ("general knowledge … is not covered by rules 1–2").
The typed-record builder never grew one — so the WEAKER contract is the usable
one and the stronger contract forbids reasoning.
Rules 7–10 are added as a NARROWING, inserted INSIDE the contract section:
the contract opens with "this overrides every formatting instruction below",
so a narrowing placed after the records would be outranked by the rule it
narrows. Both grounded paths share one assembly point, because the production
refusal came through the gateway while the loop carried the same defect.
The durable fix belongs upstream in `buildContract`; noted in the module.
## 3. Retrieval fetched the wrong subject
This was the one that made the answer useless, and it survived the prompt fix.
`peopleFacts(userId, message)` searches by the message. `documentFacts(userId,
message, limit)` searches by the message. `projectFacts(userId)` ignored it:
projects came back in table order and were then head-sliced. With ~30
registered projects that is a lottery, and the `Heidi` PROJECT lost it — while
the people search matched two contacts by name. Retrieval chose the subject of
the answer, and chose wrong. No prompt rule can recover a record that was
never fetched.
Projects the message NAMES are now ranked ahead of the slice. Pure, in its own
module because `sources.ts` imports `@/db`, which throws at load without a
connection string — and this repo's unit suite is env-independent.
## 4. A citation the verifier could not see
Found only by running it: nemotron cited `【F16】` in fullwidth brackets. Both
readers are ASCII-only, so the verifier's unknown-citation check silently had
nothing to check, and the renderer printed the handle verbatim as plumbing.
Normalised at the seam, before verification.
## Verified
Against REAL production records through the read-only tunnel, same question:
Heidi is an active project — status active [F16]. Its recorded description
is "Learn to understand and text in Zurich Swiss German.
heidi.orangecat.ch" [F16]. The latest development log notes the creation of
a /check page … and a PR #4 that has not yet been merged [F16].
No reasoning tags, no refusal, ASCII citations, 0 grounding violations.
Three new pure suites, each proven by MUTATION: removing the judgment clause
fails 7/10 checks; a no-op `stripReasoning` fails 3. The prose-gate test
replays the exact production bytes.
Claude-Session: https://claude.ai/code/session_018SCNNZ3cqMFzQtuGe6e1V9
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
c1a69a4004 |
feat(retire): unpublish from OrangeCat, stop a dead site redeploying, and clear what delete left running (#667)
Three leftovers from the teardown work, each one something created that could not be undone. UNPUBLISHING WAS IMPOSSIBLE. Publishing a project to OrangeCat created a public page and wrote a back-link that nothing could clear, so `already_published` was a permanent verdict: the page stayed up, and the only recourse was to sign in to OrangeCat and change it by hand. The status primitive that would fix it lives behind their session auth, which a bearer-token integration cannot call. "Take it down" now sits beside "Published" and sets the OrangeCat project back to `draft` — the state that is owner-only there (their public list is `active` and `completed`, mirroring the row-level policy) — then forgets the link so publishing again works. Nothing is deleted: the project, its funding and its wall survive, which is why this is unpublish and not delete. Their half is bitbaum/orangecat#977 (PATCH /api/v1/projects/[id]); a FleetCrown pointed at an OrangeCat without it gets a message saying exactly that rather than clearing our back-link and leaving their page public. A RETIRED SITE'S REPOSITORY KEPT DEPLOYING IT. deploy.yml fires on every push to main and would rsync to a box path that no longer exists; ci.yml and auto-merge.yml keep merging agent PRs into a project that is gone. Deleting a site now disables its workflows — before archiving the repository, because an archived repository refuses every mutation including that one. Disabled rather than deleted: gh workflow enable brings them back if the site is rebuilt. DELETING A PROJECT LEFT WORK RUNNING. The audit tables were the wrong worry: orchestration_runs, agent_sessions, prompt_history and control_audit_events all carry project_key beside project_id, so nulling the id leaves them readable by name — that is history, and deleting it to tidy a foreign key would destroy the only account of work that really happened. Two things ARE different and are now cleared: project_states, the Control card's live state, which has no id to null and would silently re-attach to a new project reusing the name; and unexecuted pending_commands, which a runner would claim and dispatch into a project that no longer exists. The danger zone says which of the two happens, because "nothing says so" was half the complaint. Verified: pnpm run verify green; 36 assertions on retire-site.sh (extended to pin that a site taken OFFLINE keeps its workflows and its deploy key — only a delete removes them). Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
4e29a12578 |
feat(loki): the chat shows its work — streaming, a stop button, one rail (#665)
Loki did more work than any other surface in the app and showed the least
of it. A turn is up to three model rounds with real retrieval in between —
it searches your people, reads your projects, queries the knowledge graph —
and all of it happened behind one static "Loki is thinking" line for as long
as it took. `runLokiTurn` has always returned `toolsUsed`, carrying the
comment "surfaced so the UI can show work". Nothing ever surfaced it.
## The turn streams, for real
Not a typewriter over a finished string. `agent/llm.ts` gained a genuine
`stream: true` path against the providers' OpenAI-compatible endpoint, with
`stream_options.include_usage` so a streamed turn is still BILLED — without
it the final chunk carries no usage and the day's ration would drain for
free on exactly the turns someone is watching.
Two rules keep the preview honest:
- **Prose is released a whole line at a time.** A weak model narrates its
tool calls as `TOOL:` / `ARGS:` lines, and the buffered path strips them
before anyone sees them. A chunk ending in `TOO` could still become
`TOOL:`, so nothing is shown until a newline proves the line finished.
Extracted as `createProseGate` and covered by `test:loki-prose-gate`,
including that it agrees with `stripToolCallLines` on the same text.
- **`delta` is a preview; `message` is the record.** The loop REPLACES its
answer every round (`text = turn.text`), and the grounding repair pass can
delete unsupported claims from a finished one. So round boundaries and
dead links emit `reset`, and the persisted turn replaces the preview when
it lands. Appending instead would leave a fabrication on screen that the
database does not contain.
The fallback path streams too. It is tempting to treat it as degraded and
therefore allowed to be silent — but it runs precisely when the free tiers
are drained and the tool loop cannot start, which is to say on the slowest
days. Leaving it unstreamed meant no visible streaming exactly when progress
most needed showing. One shared SSE frame reader, not two.
## What else changed
- **A stop button.** There was none: a running turn could not be cancelled.
It takes the same slot as send, and the abort reaches the provider call.
- **The work trail** — each tool as it runs, with the records it actually
returned. A failed tool reads as "unavailable", never as "nothing found".
- **One rail instead of four navigations.** The global sidebar, a
Chat/Control/Terminal strip, a pinned history rail AND a "Chats / New"
toolbar all led to the same two actions. The rail owns them now.
- **A model picker** that says what it does: a choice sets where the CHAIN
starts, and the fallback below it survives — a hard pin on a free tier is
a scheduled outage. Vendors without a key are listed, disabled, with the
reason; never hidden, never fake-enabled.
- Copy and try-again on an answer. Autoscroll that follows only while you
are at the bottom, plus a way back down.
## Bugs found on the way
- `bg-accent-primary` + `text-white` is invisible in dark mode, where
`--accent-primary` is near-WHITE. The send arrow did not exist on a dark
screen. Same bug in `.ui-assist-send`; both now `text-text-inverted`.
- The composer was keyed on `activeId`, so creating the thread REMOUNTED it
mid-send — silently resetting the model choice and dropping staged files.
- That same transition looked like a thread SWITCH, so the transcript
cleared, showed "Loading conversation" over the streaming turn, and
refetched a thread the server had not finished writing. The question
vanished and the answer arrived alone.
- `.ui-loki-thread` was missing `flex flex-col`, making its `mt-auto` inert:
a short conversation pinned to the top with dead space above the composer.
- The rail's project filter could hide the thread you were reading, because
scope follows the answer. A filter may narrow what else is offered; it may
not hide where you are.
## Refactor
Three components deleted. The composer finally uses `useAttachments` — the
hook that was extracted FROM it and adopted by the Control and Terminal
composers, leaving the one surface it came from as the only one with a
private copy. Dispatch/approval/project-picker footers moved out verbatim,
because rewriting honest-status logic to move it is how the regressions its
comments warn about get reintroduced.
`check-loki-classes.mjs` (wired into `check:design`) asserts every
`ui-loki-*` class is both defined and used. A renamed class is invisible to
tsc, eslint and the build — it still renders, as unstyled markup. It found
six orphaned rules on its first run, and fails under mutation.
Verified live: page renders at 1440/390/320 with no horizontal overflow, a
real turn streams against real models and the local DB, and the stop button
cancels one.
Claude-Session: https://claude.ai/code/session_01PMLf9PxnoryRqRxzVLu7WM
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
35a75292c6 |
fix(feedback): a cached ledger about the wrong PR is not a cache, it is a wrong answer (#663)
The parser fix in #660 could not reach a single row it had already poisoned. A wrong resolution had landed those rows in PR_CLOSED — a terminal state — and terminal meant never ask GitHub again. So the row kept saying "nothing shipped" while the real pull request sat open and mergeable, and the only way out was deleting payload.fix by hand on the box, which I did to prove the merge path works at all. The cache outlived its input. Re-parsing a handoff is pure and free; the GitHub call is what costs. So the parse now runs on every request and a cached answer about a DIFFERENT pull request is invalid whatever its state, while terminality and the refresh window still ration the network. fixNeedsRefresh takes an options object now. It already had a trailing `now`, and slipping expectedPrUrl in front of it would let every existing caller pass a timestamp where a URL is read — truthy, unequal to any URL, refresh forced every time. That is the same silent-wrong-argument shape as the bug being fixed, so the signature refuses it. Claude-Session: https://claude.ai/code/session_017FU2m6NxPYYFkEdyufcSrX Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
d5c83e66b5 |
fix(ci): a merge on main stopped having a path to the box (#662)
Four merges reached main on 2026-09-11 and never left the repository. Every check was green, no job was red, nothing anywhere was marked failed. Each one needed a Deploy dispatched by hand, and the only way to notice was to compare the box's build stamp against main's tip. Two paths ship a commit, and exactly one fires per commit by design: a push to main chains through workflow_run, and a dispatch runs ci.yml's own ship job. Under a concurrency group keyed only by branch, auto-merge's re-armed dispatch cancels the push run for the same commit — which is intended, and the comment on the ship job says so. What was never intended is the NEXT merge cancelling the surviving run of the previous one. That kills both paths at once. For the stranded commit, gh run list showed a cancelled push run AND a cancelled dispatch run, with a clean success five minutes later belonging to a different commit. So main is now keyed per commit. Same-commit cancellation is preserved, so a commit still ships exactly once; cross-commit cancellation is gone, so it ships at all. Branch behaviour is unchanged. The gate that comes with it states the property narrowly — on main, one commit's CI must never cancel another's — and also pins the five premises that make it matter, because if the chain is ever rewired the gate must fail loudly rather than guard a ghost. Both were proved by mutation on a copy, six mutations, each asserted to have actually applied. That assertion earned its keep immediately: the first draft of this gate checked for `workflow_dispatch` with a plain substring, which matched a comment and an `if:` elsewhere in the file, so removing the actual trigger left it green. A mutation that silently no-ops makes a gate look proven when nothing was tested. Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
6310c3d330 |
fix(feedback): two ledger-accuracy defects the live row exposed (#660)
* fix(feedback): unknown mergeability is not a conflict The live row said "GitHub cannot merge this pull request — it is a draft or has conflicts" in a case where GitHub had simply not finished computing mergeability. It answers null on a cold read, and the code folded null in with false. Unknown stays a hold — it is never permission — but it is now its OWN hold, with its own sentence: GitHub has not finished checking, and it retries on its own. Asserting a cause nobody verified is the same defect as the old "Check live", scaled down to one sentence, and the test now refuses any wording for this state that mentions drafts or conflicts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017FU2m6NxPYYFkEdyufcSrX * fix(feedback): resolve the pull request the agent OPENED, not the first one it mentions Caught on the live row. A retry's handoff reads: "...after prior PR #1 diverged and conflicted (closed #1, opened #3, test check green)". The parser took the first match, so the row reported PR #1 as closed and said nothing shipped — while PR #3 sat open and mergeable. With automatic shipping on it would have been evaluating the wrong pull request entirely. Now every reference in the handoff is collected, and the one the sentence marks as OPENED wins; with no such cue the highest number wins, because a later pull request supersedes an earlier one. A bare #number still resolves to nothing: in prose that is far more often an issue, and naming the wrong thing is worse than naming none. Pinned with the real handoff text, not a paraphrase. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017FU2m6NxPYYFkEdyufcSrX --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
f847ba8fb5 |
feat(retire): a site can be taken off the internet, password-protected, or removed (#657)
Creating a site makes about forty things. Deleting the project undid two of
them, plus the repository if you asked. Everything else survived — and the
part that survived is the part that is public.
After "Delete project" on a kicked-off project you still had: the live site at
<slug>.orangecat.ch, its Caddy vhost and TLS certificate, an enabled systemd
unit, /opt/<slug> with its secrets, the checkout, an apps.conf row holding a
port that could never be reclaimed, a monitoring target that keeps paging about
a site you deleted, the box's SSH deploy key sitting in the repository, and the
project's milestones orphaned onto /goals. The only way off the internet was a
human with SSH.
FOUR LEVELS, because "undo it" means four different things:
offline stops serving at once; code, files and port kept. Reversible.
private keeps working behind a password; repository made private.
restore undoes either of the above.
delete unit, vhost, /opt, checkout, apps.conf row (freeing the port),
monitoring target and the leftover deploy key. The repository is
ARCHIVED, never deleted, unless explicitly asked — that is the one
step nobody can undo, so it is never a default.
NOTHING HAPPENS WITHOUT A SECOND ASK. The default prints exactly what it would
touch and performs no action, and that preview is produced by the same script
that does the work — a plan written separately is a description that drifts.
The route runs the plan through the runner and returns it inline, so the
confirmation is the real thing rather than a promise about it.
Refusals are refusals: thirteen infrastructure slugs (fleetcrown, orangecat,
the bridge…) cannot be retired at all, and a LIVE client engagement needs an
explicit second hand — money terms are not a thing a button decides.
Shape follows new-site.sh, deliberately: a closed set of parameters validated
against a fixed grammar, handed to the script as an ARGUMENT VECTOR via
execFile, armed by the same FLEETCROWN_SITE_FACTORY switch that arms creation.
A runner allowed to bring public hosts into being is the one allowed to take
them away, and no other.
Also fixed, found by the same inventory:
- GitHub visibility could only be set at creation. setGithubRepoVisibility
makes a repository private (or public) afterwards — new-site.sh creates
public repos, so "make this not public" had no answer for the code.
- Deleting a project now deletes the milestones the kickoff wrote FOR it,
instead of leaving them unowned on /goals (ON DELETE SET NULL).
- "Danger zone" says what it does NOT do, and points at the site controls.
Verified: pnpm run verify green. 32 assertions on the script (a dry run never
edits the register; every artifact named in a delete plan; infrastructure
refused; no backticks), 41 on the validator (a plan never carries --go; no mode
defaults to deleting a repository).
DEPLOYMENT: set FLEETCROWN_RETIRE_SITE_SCRIPT in /opt/fleetcrown/runner/.env to
the retire-site.sh in the factory checkout, beside the FLEETCROWN_NEW_SITE_SCRIPT
already there, and update that checkout. Until then the command is rejected with
that exact reason rather than silently doing nothing.
Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|