mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 08:18:10 +01:00
5dc7e89d51651ace1715340b089dfd22c71bd089
857
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5dc7e89d51 |
test(gate): a number written in prose must match what it counts (#845)
Someone writes "all 11 sections" beside an array of 11 things. The array grows to 12. The sentence does not, because nothing is watching it — not tsc, not eslint, not any test. The prose is now wrong and stays wrong, and it reads as authoritative precisely because it sits next to the code. Every claim this gate covers was ALREADY stale when it was written, and it found all three before being told any answers: SettingsTabs.tsx says 11 settings sections, but there are 12 terminal-keys.ts says 23 terminal keycaps, but there are 24 telemetry-paths.ts says 3 hourly cron timers, but there are 5 Fixed, and now gated. WHY A GATE AND NOT THREE EDITS This is the fourth stale number corrected by hand in a single sweep — the Whisper model sizes, the /download artifact sizes, the 0.8.19 pin in desktop/README, and "the 1845-line globals.css" (6073). A number that has gone stale once will go stale again the moment the structure moves, and the person who moves it has no reason to grep prose for arithmetic. TWO THINGS THAT MAKE IT A GATE RATHER THAN DECORATION A pattern pinned to a sentence silently stops matching when someone rewords that sentence, and then reports success forever — which is the exact defect found in scripts/smoke.sh this week, where the auth middleware answered 401 before routing so every probe passed whether the route existed or not. So a non-matching pattern here is an assertion FAILURE that names the file and says to fix the pattern in the same commit. And it deliberately covers only what this repo can derive. The box being a CX33, an artifact's size in MB, a model's download size — no source here settles those, so they cannot be gated and should not be written down. The sweep deleted several rather than restate them; the file says so, because the next person will be tempted to add one. Proven by mutation: adding a 13th tab to SettingsTabs makes it exit 1 naming both numbers; restoring makes it exit 0. The mutation itself is asserted before the result is trusted — a mutation that silently fails to apply produces a "passing" gate that was never actually tested. verify: exit 0. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
bcf140a9e6 |
fix(projects): stage becomes a real vocabulary, and "active" stops lying (#843)
Two of the three things George identified as "hard-coded demo bullshit". Both are missing CONTRACTS, not missing features. STAGE WAS FREE TEXT WEARING AN ENUM'S CLOTHES. `status` is an arbitrary string. The badge coloured it from a 13-key map and `shortProjectStatus` returned null for anything else — so a project whose stage read "Early Stage" or "MVP" showed NO BADGE AT ALL, indistinguishable from one that had never set a stage. Nothing constrained the value, so two projects could mean different things by "Development" and no code would notice. And there was no list anywhere of what the stages ARE, so "what counts as pre-launch?" lived in nobody's head. Every other vocabulary in this product is declared in lib/constants/statuses.ts — goals, sessions, actions, events, feedback, human tasks. Stage never joined them. PROJECT_STAGE does now: seven stages in LIFE order (the order is the meaning), each with a written definition shown in the tooltip, plus an explicit legacy map for values already in the data. An unresolvable value is now SHOWN and marked — dashed border, a "?", and a tooltip naming the real stages — because "this project's stage is a word nobody defined" is a fact worth seeing. Swallowing it was the actual bug. "ACTIVE" MEANT SOMETHING ELSE. The row said "active 10h ago". That is the newest AGENT DISPATCH from prompt_history. George had not touched printcraft in months; a 06:00 autopilot run made it "active". Worse, #830 ORDERED the whole page by it under a subtitle promising "most recently active" — so the list ranked his projects by when a robot last ran, in a word that means he did. Now "last run 10h ago" / "never run", with the subtitle and both sort hints saying agent run. The Recent hint says outright: "not when you last worked on it". Guarded by scripts/test/stage-is-a-real-vocabulary.ts (8 checks), which pins the RULE and not just the values: an unknown stage must never be swallowed, the legacy map must stay explicit rather than fuzzy, and the row must not filter stages through a hardcoded list again. Still open, deliberately: the three flag attrs (security_vulnerability, broken_features, deployment_issue) have no writer and no way to set one from the UI. That is the third of George's three and it needs its own change. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
814632e739 |
fix(orangecat): "Connected" meant a row existed, not that the link worked (#842)
Two halves of the same mistake — a stored value read as a state of the world. SETTINGS ASKED THE COLUMN, NOT ORANGECAT. #841 reported a link as broken when its refresh-token column was empty, which sounds like a health check and is not one: the column is only emptied once a refresh has actually been attempted and refused. Measured on prod the day it shipped — the link had been dead five days, the revoked token was still in the column, and the page said "Connected" in green. It now resolves the link the way every publish does; when OrangeCat refuses, that same call retires the credential and raises the alert on its way out. (Being signed INTO Loki with OrangeCat never repaired this: the session cookie and the stored OAuth token set are different things, which is how a person can be looking at a Loki they logged into through OrangeCat while Loki cannot speak to OrangeCat at all.) ORANGECAT OFFERED TO BUILD WHAT IT ALREADY HAD. Its project page shows "Build it with Loki — one click: creates the project and puts an AI agent on it" to owners of projects that have been building here for months, because nothing on that page could tell the difference. The click was always safe — the handoff screen flags an already-linked project rather than creating a second one — but the card was addressing a stranger. `GET /api/orangecat/project-link` answers it, and answers the more valuable question too: a funder on a public project page had no way to reach the build record. Public without a signature, by construction rather than by intention: `linked: true` requires the Loki project to carry listed_publicly, so every field returned is already served at /fleet and /fleet/<slug>, and a project without that consent answers byte-identically to an id nobody has heard of. The consequence is stated rather than hidden: for an unlisted project OrangeCat keeps saying "Build it with Loki" — a worse label, not a broken path. verify: tsc, lint (0 errors), test:unit 246/246 — including api-route-auth, which refused the new route until its public stance was written down. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a94458870d |
fix(settings): a broken OrangeCat link read "Connected" and offered no way back (#841)
The link this account publishes through has been refused by OrangeCat since 2026-09-17 — every project publish, dev-log entry and closed run silently skipped. Settings listed OrangeCat as Connected, in green, with Disconnect as the only button: the page could not tell a LINKED account from a WORKING one, and the single action that repairs it was the one action it did not offer. The alert raised when the token is refused points here, so this is the screen that has to show the way forward — CLAUDE.md's rule that a gate records but never blocks, applied to the place a person actually lands. `needsReconnect` is scoped to OrangeCat on purpose: getOrangeCatLink clears the refresh token exactly when OrangeCat has refused it, so an empty column there MEANS broken. A GitHub OAuth app never issues one, and the same test would call a healthy link broken. verify: tsc, lint (0 errors), test:unit 245/245. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d8ce9e03af |
feat(projects): the order is a control, not just a claim (#840)
#830 made the sort legible by stating it in the subtitle. Stating an order makes it understandable; only a control makes it arguable — and there are two real questions this page's default cannot answer at once: "what moved?" — a project flagged in March should not sit on top "where is X?" — neither recency nor attention helps you find it Priority / Recent / A-Z. The same three Control's project rail has carried for a while, on a second, smaller copy of this same list — this is the half of that duplication worth keeping, and the type and labels now live in one place rather than being retyped per page. THE EXPLICIT ORDERS ARE FLAT. No tiers at all: someone who picks "Recent" is asking one question, and hoisting a flagged project above this morning's work is the page overruling them. Tiering is what "Priority" MEANS, not a property of the list every mode inherits. Persisted in the URL beside q and filter, and only when it differs from the default — so the common URL stays clean and a shared link carries the order the sender was actually looking at. An unrecognised value falls back to Priority rather than silently reordering the page; there is a test for that, because a sort read from a query string is user input. A radiogroup rather than three buttons: one choice, one answer, arrow keys. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0464358605 |
fix(orangecat): the wall went silent, and every link on it pointed at a login (#839)
* fix(orangecat): the wall went silent, and every link on it pointed at a login
Three failures on one seam, each invisible from inside Loki because the
symptom is on somebody else's page.
THE WALL STOPPED. OrangeCat rotated this account's refresh token at
2026-09-17 07:42:44 and issued a replacement that is still valid and was
never used; Loki kept presenting the one that rotation REVOKED at that
instant. Every refresh since answered 400, getOrangeCatLink returned null,
and every promote was skipped as "feature unavailable" — across every
project, for four days. The last entry to reach any OrangeCat wall was
posted eight minutes before that access token expired. The only trace was
66 console.warn lines on the box.
Verified by hashing the stored token and finding its row in OrangeCat's
oauth_refresh_tokens: revoked_at = 2026-09-17 07:42:44.
Three rules follow, none of them a repair: one refresh at a time per
account (the backfill cron fires up to 50 promotes at once, so a burst was
guaranteed to look like a broken link); a spent refresh token is never
written back (`?? account.refresh_token` reads as defensive and stores a
credential that can only ever fail); and a dead link raises an alert,
because re-linking needs a human click and nobody clicks what nobody sees.
EVERY LINK POINTED AT A LOGIN. Wall entries carried a hardcoded
`${LOKI_PUBLIC_ORIGIN}/projects` — the private dashboard. A stranger
following "via Loki" from Heidi's OrangeCat page got a sign-in form; the
owner got all 36 projects instead of the one the entry was about. Twelve
such links on that page alone. The right page has existed the whole time:
/fleet/<slug>, now derived exactly as the register derives it.
THAT PAGE WAS UNREADABLE ON A PHONE. Measured at 390px: 737px of roadmap
content in a 390px column, clipped by .ui-public-surface's own
overflow-x:hidden — 47% of every milestone line unreachable, no scrollbar,
no ellipsis. Cause: unbreakable GitHub URLs in prose. Fixed on the
ui-public-* prose tokens in globals.css, so it holds for every public page.
Also on that page: three of six "changelog" entries were internal dispatch
bookkeeping (two announcing a FAILED dispatch, stored truncated mid-word),
a `Source: <url>` provenance pointer rendered as an untickable milestone,
"0% recorded progress" under every item, and a raw ISO timestamp.
NO GATE COULD HAVE CAUGHT IT. audit-covers-every-page skipped every route
containing "[", so /fleet/[slug] — the template behind all 36 public
profiles — had never been measured at any width. Dynamic routes now take
the same decision as static ones: a concrete sample (/fleet/heidi,
/u/cato, one essay) or a line in NOT_MEASURED saying what it would take.
The overflow detector could not have seen it either — it reads
documentElement.scrollWidth, which the clip holds at the viewport width —
so there is a new one asking the reader's question: can I get to the rest
of this sentence? A listed route that 404s now fails, because a rotted
sample looks exactly like a covered route.
Two gates lied and are fixed with it: the audit's list parser ended an
array at the first "]" in a comment, and alert-registry read
`grant_type: "refresh_token"` as an unregistered alert type.
AND THE FEED IS NOW A CHOICE. Publishing did two things under one press:
it created the public page and enrolled the project in a live feed of
everything its agents did, with no switch — "stop telling everyone what my
agents are doing" cost you the funding page. user_projects.orangecat_autopost
separates them, three-state like auto_ship (null = nobody has chosen, and
an unanswered question is not consent). Reversible either way, without
touching the page. Already-published projects are backfilled to true:
introducing consent must not silently stop a feed someone relies on.
Left on, it is the strongest thing a public project page can carry —
dated evidence of work, which is the half of a transparency claim that
better copy cannot manufacture.
/fleet/[slug] also now reads CONSENT rather than ownership (it resolved any
slug in the owner's map, which the catalogue beside it has never done), and
a slug with no public profile gets an invitation instead of a dead end.
verify: tsc, lint (0 errors, 2 pre-existing warnings), test:unit 231/231.
The page itself is measured against prod after deploy — it cannot be
measured before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(smoke): the pre-push gate blocked a push over another app's dev server
`/api/health` answering with a `"commit"` field was the whole identity test,
and every app in the fleet serves that route from the same template. On
2026-09-22 a Heidi dev server held :3000 first; Loki's 48-route auth smoke ran
against it, reported 23 routes returning 404, and failed the push — a verdict
about somebody else's app, delivered as a verdict about this one.
A name cannot be mistaken for another name: health now says which app answered,
and the hook asks for "loki" instead of for a shape. Additive to the payload,
so the deploy assertion, the uptime sweep and check-deploy-ref are unaffected.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
8afc84bf08 |
fix(pre-push): skip the smoke against a server that has no database (#838)
"Is this Loki?" was answered by the presence of a `commit` field in /api/health. A Loki process started without DATABASE_URL satisfies that perfectly: it answers health and 404s every database-backed route. So the hook smoked it and failed 23 of 48 routes — on changes that could not possibly have caused it (CSS, one copy string, a sort comparator). Seen twice on 2026-09-22 against a dev server left running without a database. Both pushes went out --no-verify and CI passed the identical bundle each time. That is the worst shape a gate can take: it blocks correct work, names the wrong cause, and teaches you to bypass it — after which it protects nothing. The payload already reports `schema.state`, so the hook had the fact it needed and never looked. It now skips, rather than fails: the state of a server on someone's laptop is not the pusher's problem, and failing here is exactly what makes --no-verify reflexive. The message names the cause and the cure (pnpm run db:push). Deliberately narrow — a healthy server is still smoked, and the "not running" and "not Loki" branches are untouched. The test pins all of that, so this cannot quietly widen into "never smoke anything". Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
6beb7be241 |
fix(projects): the panel shows the problem it was opened to show (#837)
Two faults, both found by opening the disclosure on production and READING it.
1. THE EVIDENCE WAS CUT AT 80 CHARACTERS. Every check's detail went through the
same truncate(), which is right for a field preview (a repo URL, a stage)
and wrong for the three signal checks, whose detail is a report a person or
an agent wrote. evig's security note rendered as
"Email verification bypass: anyone can register @revamp-it.ch domain
and get Sta…"
cut mid-word, in the one place you go to read it. EVIDENCE_MAX (400) applies
to those three only; field previews stay at 80. Still bounded, so a
pathological note cannot push the actions off the bottom of the panel — the
panel already scrolls.
2. THE HEADING CONTRADICTED ITS OWN BODY. A failing row was titled with the
check's GOAL state:
No security risks open
Email verification bypass: anyone can register…
`label` is correct in the tooltip's "missing: …" list — the missing thing
really IS that state — and wrong as a headline printed above the risk
itself. Failing rows now use `failLabel` (the problem's name); passing rows
still name the goal, and the tooltip is untouched.
Detail text also moves from text-muted to text-secondary: it is the content of
the panel, not a caption on it.
Guarded by scripts/test/health-panel-shows-the-evidence.ts (7 checks), using
evig's actual note as the fixture — including that field previews did NOT grow
and that the bound still holds at 5000 characters.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
6588207273 |
fix(projects): the health panel was unreadable, and I shipped it that way (#836)
Opened the disclosure on production and looked at it. It is unusable: other rows' text bleeds straight through the open panel, and its sentences are cut off at the right edge of the screen. Three faults, two of them mine from #832. 1. THE PANEL WAS TRAPPED IN ITS OWN ROW. `.ui-projects-row-actions` carried `z-[1]`, which makes every row a STACKING CONTEXT. The panel asks for z-40, but z-40 then only ranks it against its own row's children — so every row further down the list paints over the open panel. `relative` alone is both sufficient and correct: it and the stretched link's ::after are positioned with z-index auto, so they paint in DOM order and the actions come second. The test from #832 asserted `z-[1]` as a REQUIREMENT. It pinned a broken implementation instead of the intent, so it went green on the bug and then failed on the fix. Rewritten to demand "positioned, and no stacking context", with the reversal explained. 2. THE PANEL OPENED OFF-SCREEN. It hung `left-0` from a chip that sits at the RIGHT edge of the row, so a 24rem panel ran past the viewport and truncated its own content mid-word ("anyone can register @revamp-it.ch domain and get Sta…"). Anchored right, so it opens back across the row it belongs to. 3. "Passes while no broken is recorded on this project." The noun is missing. The comment three lines above that string says this exact bug was fixed by writing the wording per signal rather than deriving it — and `clearLabel` was fixed while `rule` was left deriving from `label`, which is the bare word "Broken". The repair stopped one line short of the defect. Rules are now written per signal too. Also in here, and the reason I opened the panel at all: the health track rendered its segments in CHECK ORDER, so a 7/10 came out as ●●●●●○○●● — filled, filled, gap, filled. A progress-bar shape carrying checklist content. Sorted earned-first; position carries no information to anyone, since the track is aria-hidden and no segment is labelled or addressable, and the test pins that trade so it fails loudly if a segment ever becomes identifiable. Every one of these passed a DOM probe. The elements were present, the classes were right, the gates were green. Looking at the page is what found them. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
1fa8b4a230 |
fix(projects): a flag's age is terse on the badge, spelled out in the tooltip (#834)
Shipped "Security risk · 6mo ago" in #833, then looked at it on production: evig carries three flags, each gained ~10 characters, and the third wrapped onto a second line — pushing the next-step text down with it. The densest row on the page got taller to say something it could say in four characters. "ago" does no work beside a label that is plainly a timestamp. The badge is scanned, so it reads "· 6mo"; the tooltip is read, so it keeps the full "Noted 6mo ago by loki-ui · 30/03/2026" alongside the note itself. Found by taking a screenshot rather than probing the DOM — the elements were all present and correct, and the layout was still worse. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
cd67d92439 |
feat(projects): flags say how old they are, and an expiry finally means something (#833)
"Security risk", "4 broken features" and "Deploy issue" are the TEXT of project attributes someone — a person or an agent — typed. They reached the list undated and unattributed, so a note written this morning and one typed in June looked identical, and both hoisted their project above everything else equally. THE DATA WAS NEVER MISSING. fetchAttributesByEntityIds does `select()` — it pulls updatedAt, source and valid_until on every row — and then dropped all three in its grouping loop, keeping only key → value. Showing them costs no extra query; the meta variant returns the value too, so getProjects makes the same single call it always did. Badges now read "Security risk · 23d", with the exact date and what wrote it in the tooltip alongside the note itself. Terse where it is scanned, spelled out where it is read. VALID_UNTIL IS THE SHARPER ONE. That column has existed on the attributes table the whole time and NOTHING read it — an author writing "this expires on the 14th" was writing into a field with no consumer. It is honoured now. That is deliberately NOT auto-decay, which stays George's call: a flag with no valid_until still stands forever, however old. Inventing a deadline for someone else's security note would be worse than showing a stale one. And a malformed valid_until never clears a flag — a typo must not silently resolve a security issue. One predicate, three surfaces: the badge, the attention sort and the "Site issues" chip all call signalHasExpired. It lives in lib/, not beside the badge, because two of those callers are not React — and because a flag hidden on the row while still counted by the sort would hoist a project to the top of the page with nothing on it explaining why. Guarded by scripts/test/flags-carry-their-age.ts (8 checks), which pins the policy line as hard as the behaviour: "no expiry means it stands forever" is a test, so a future change cannot quietly introduce decay. Mutation-tested: ignoring valid_until fails 2. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0dfdbd059f |
feat(projects): the row can hold controls, so health becomes a real one (#832)
The row WAS a single <Link> wrapping everything, with aria-label="Open {name}".
HTML forbids interactive content inside an anchor, so the row had ZERO
interactive children BY CONSTRUCTION — which is the actual reason every number
on it led to the same generic destination, and the reason the health chip could
only ever be a dead <span> explained by a hover `title`: invisible on touch, a
bare "7/10" to a screen reader.
THE CAPABILITY WAS NEVER MISSING. HealthScoreBar has always had an
`interactive` mode — a real button, aria-expanded, a panel naming each missing
point with an inline edit that writes it, and a draft-from-the-brief action.
The list could not use one line of it. Ten named checks, each with its rule and
the exact field that earns it, sat behind a structural prohibition.
Stretched link instead: the project NAME is the anchor and its ::after covers
the row, so the whole row remains one click target while the row itself is no
longer an <a>. Two things improve at once — a screen reader now announces a
link whose text is the project's name rather than an aria-label bolted to a
wrapper, and anything needing its own click sits above the overlay via
.ui-projects-row-actions.
Both classes live in globals.css, per the rule that styling has one home; the
test asserts they are DEFINED there, because a class the CSS does not define
would leave the row unclickable everywhere except the name — a silent, large
usability regression that nothing else would catch.
Caught by the repo's own lint while writing this: `brief` must be the CLEANED
description, never the raw column, or the gap-fill would draft a mission from
the bulk-import placeholder ("Local repository imported from loki-ui"). Good
rule; it fired exactly where it should.
Guarded by scripts/test/project-row-can-hold-controls.ts (6 checks). This is a
STRUCTURAL invariant, not a style preference: collapsing the row back to a
wrapping anchor would silently re-delete every control inside it — the page
would still render, nothing would fail to compile, and the disclosure would
just quietly stop existing again. Mutation-tested: dropping `interactive` fails
the payoff check.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
c934ea5b95 |
fix(projects): a phone can now see what the list is sorted by (#831)
#830 made /projects order by recency and put that promise in the subtitle: "flagged first, then most recently active". The row keeps health, "active … ago" and the open-feedback count in a right-hand column marked `sm:flex` — so on a phone none of them render. The page asked you to trust a sequence whose evidence it had hidden on the viewport where it matters most. Adds a stacked `sm:hidden` meta line rather than reusing the desktop column: at 390px a right rail steals the width the project name needs, and the name is what you came to read. The health score is spelled out (`health 7/10`) because a bare "7/10" sitting next to a date is exactly the magic number that module exists to stop it being. ALSO: `Needs path` was `hidden sm:inline-flex`. It means Loki cannot dispatch an agent for that project AT ALL — the most actionable badge on the row — and it was hidden on the narrowest viewport. Now always shown. The desktop column is untouched; this complements it rather than replacing it, and the test pins that too so a later "simplification" cannot quietly collapse the two into one cramped layout. Guarded by scripts/test/mobile-shows-what-the-list-sorts-by.ts. It reads the source, so it proves the classes are right, not the pixels — real rendering at 320/390/768/1440 is `audit:responsive`, which needs a running server and cannot live in the env-independent unit suite. The gate earns its place because the regression is a ONE-WORD edit (`sm:hidden` → `hidden`) that no type or lint error would ever surface. Mutation-tested both ways: restoring the badge's `hidden` fails 1 check, removing the mobile line fails 4. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
440b016c6a |
fix(projects): the list now orders by the number it prints (#830)
Every row renders "active 23d ago" and the list ignored it. After the flagged
and freshly-created tiers, the real tiebreaker was `name.localeCompare` — and
with 22 of 36 projects holding a next step, the ALPHABET decided most of the
page.
Measured on production before this change:
- 9 inversions across 21 adjacent pairs
- loki, active seven minutes earlier, sat ELEVENTH, below BiasLens and
HamsterCheek, both untouched for a month
- the three projects whose runs had failed at 06:00 that morning
(surf-your-life, printcraft, sbb-lost-found) sat at positions 15, 18 and 20
- the page rendered as two alphabetical blocks, a–v then A–c
Recency now decides, read from the SAME map the row labels itself from, so the
order and the label cannot disagree.
TWO TIERS REMOVED, both undocumented in the original:
- has-a-next-step-first. Backwards on its face — a project that knows its
next step is the one that needs you least — and it was the tier drawing
that line through the middle of the list.
- own-before-team. A team project touched yesterday outranks a personal one
untouched for a month; recency says that better.
Kept: flagged-first, and the freshly-created tier, which carries a dated
comment explaining why it exists (2026-09-11, a new project lost in an
alphabetical fold of 25).
THE SUBTITLE WAS ALSO UNTRUE. "Decide what needs your attention now" promised
triage this page never did. It now says what the order IS — "Every project you
run — flagged first, then most recently active" — because the order is this
page's only real product: everything about ONE project is better on that
project's page, and ranking across projects is the thing only a list can do. A
page that names its sort can be trusted or argued with; one that hides it just
feels arbitrary.
Guarded by scripts/test/projects-list-is-ordered-by-recency.ts (9 checks),
which pins the two kept tiers as well as the new ordering, so a future change
cannot quietly restore either removed tier. Mutation-tested: disabling the
recency comparison fails 6 of the 9.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
689358197a |
feat(projects): fields the operator adds now reach the agent (#826)
AddAttrInline has always let anyone type any key/value onto a project, and humanizeAttrKey renders it back under "Additional context" — inside an editor headed **Agent context**. It reached no agent. renderProjectDossierForAgent built its profile from hardcoded property reads, so a key nobody had anticipated was stored, shown back to the human, and dropped silently on the way to the model. That is the worst shape of defect: the feature looks like it works. Someone fills in "Suppliers" or "SWOT", sees it on the page, and reasonably concludes their agents know about it. Only UNREGISTERED keys qualify. A registered field already declares whether it reaches agents, and two of those answers are deliberately "no" — the market lens is for the human operator (it costs tokens on every dispatch), and UI-owned attrs like `business_plan` have their own surface. Consulting the registry is what stops this path from quietly undoing those decisions; the tests exist mostly to keep it that way. DEVIATION, stated plainly: the plan said custom fields would default to human-only with a per-field "send to agents" toggle. They default to ON here, with no toggle. A toggle needs new per-field storage and a migration, and adds a step to reach a result the user already asked for by typing into a box labelled Agent context. The boundary that actually carries risk — publishing — is untouched and remains an explicit four-key allowlist. If the default turns out wrong it is one predicate to change. Capped at 12 fields per project so one profile cannot crowd out goals, runtime and the last handoff. Values are never clipped: anything past the cap is listed BY NAME, which is honest about what was withheld and lets the agent ask for it. Lives in lib/project-custom-context.ts rather than beside the dossier renderer, which opens a database connection at import time — that is what had put the text of every dispatch beyond the env-independent unit suite. Mutation-tested: dropping the registry check trips three gates, including the one that would have sent a 5,000-character business plan into every prompt. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
7d892ec91f |
refactor(projects): one registry describes a project field, not five lists (#825)
Five separate lists decided what a project field is and does: the context
editor's groups, the agent dossier's Profile block, the fallback
DRIVING_FIELDS, the AI profile-apply keys, and the public allowlist. Adding
one field meant editing five places, and nothing checked they agreed — so
they had already drifted:
- the dossier carried `status`; DRIVING_FIELDS did not
- the dossier said "Next owner step"; DRIVING_FIELDS said
"Next step (owner's highest-priority action right now)"
- the editor said "People served"; both agent paths said "Customers"
PROJECT_FIELDS in config/project-attrs.ts now describes each field once, and
the lists derive from it. The divergences above are carried as explicit
`inAgentDossier` / `inDrivingFields` flags rather than quietly reconciled:
changing what agents read is a product decision, not a refactor.
renderProjectDossierForAgent built its profile from hardcoded property reads
(`attrs.mission`, …), which is why a field added through the UI — AddAttrInline
has always allowed any key — reached no agent at all. It now iterates the
registry. Only the two rows the registry does not own stay bespoke: Health is
computed, and Operator notes live on user_projects.
One deliberate behaviour change: "Next step" moves later in the FALLBACK
dispatch prompt, because one registry cannot hold two orders and the dossier —
the path nearly every dispatch takes — is the one preserved exactly. The two
paths agreeing is the point of the change.
DRIVING_FIELDS moves to config and is re-exported under its old name: it is
pure config, and living in a queries module put it behind a database
connection, so the text every fallback prompt carries had no test.
The public allowlist stays an explicit four rather than becoming a per-field
boolean. Publishing is a security boundary, and four lines a reviewer can read
beat a flag scattered across 33 entries.
scripts/test/one-registry-describes-a-field.ts pins every derived value,
because they are prompt text — and fails if a PROJECT_ATTR key is added
without being registered.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
6c999cb13e |
fix(ui): the primary button's label was grey on orange — 1.38:1 (#824)
Found by measuring which page most needed work. /system carries 128 numbers and, before this, not one you could click; the biggest thing on it is a queue of pending proposals whose primary action is "Accept → goal". In light mode that button rendered muted grey on the orange accent: colour lab(67.52) rgb(164,165,165) = --text-muted field rgb(245,85,0) = --accent-warm ratio 1.38 : 1 against a 4.5 floor Twenty-four of them on one screen. The primary action of the only surface that asks the operator to DECIDE something was effectively invisible. CAUSE — a size modifier repainting a variant: .ui-btn-primary line 3548 bg-accent-warm + text-on-accent .ui-btn-xs line 3607 text-text-muted Same specificity, both in @layer components, so CSS source order decides and the size class wins. Writing `ui-btn-primary ui-btn-xs` in the other order at the call site does nothing — which is what makes this a class of bug rather than one mistake: it is invisible at the place a person would look for it, and six files compose these two. Two classes beat one, so one composed rule restores the variant's own label colour everywhere. Verified on the live page: 1.38 → 5.51, passes AA. The 19 standalone `ui-btn-xs` uses are untouched. WHAT THE RATCHET DOES NOT BAN, and why. `ui-btn-xs` is also composed with ghost (14 files) and secondary (3). Neither paints a base background, so their labels sit on the ordinary page surface — the ground `text-text-muted` is designed for. Losing tertiary to muted there is a shade preference, not a readability failure. The rule is therefore "a variant that paints its own FIELD must keep the label it chose for that field", which is the line between a bug and a taste call — and if ghost ever gains a background it moves into the rule automatically. The test also asserts its own premise: it fails if `ui-btn-xs` stops being the later rule, or stops setting a colour, because either would make the composed rules dead weight and every other check pass vacuously. Mutation: removing the composed rule fails it, naming all six files. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home. test:unit 232/234 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
8b04216b8d |
fix(control): a CTA that skipped the filter, and a card that said it twice (#823)
Two from reading the rail.
"REVIEW FAILURES" DID NOT REVIEW THE FAILURES
The hero counts them — "the latest run on 4 projects failed" — and the
button under it went to /activity?window=week: a full week of every
dispatch, success and failure alike, leaving the operator to find the four
the sentence had just counted.
It was the one activity link in the app written by hand instead of through
`activityHref`, which is why it was also the one carrying no filter. It now
passes `filter: "attention"` — precisely error, timeout, hang, partial and
unconfirmed — so the button lands on what it names.
THE CARD SAID THE SAME THING TWICE
Status badge: "Tab open". Subtitle directly beneath: "Workspace tab open".
The subtitle exists to name what was OBSERVED — "Live agent process
detected", "Agent signaled ready on connected computer", "Last run
completed". For this state it restated the badge in different words, on
every card in that state.
A guard for exactly this already existed:
{evidenceLabel && (evidenceLabel !== stateLabel || …) && …}
Exact equality catches only the one phrasing nobody was going to write
twice. `restatesLabel` compares the WORDS — case, order and punctuation
ignored — so "Workspace tab open" no longer slips past "Tab open", while
"Last run completed" is untouched. The tab-open branch now adds nothing when
it has nothing to add, and keeps the dispatch suffix when it does.
A NOTE ON THE TEST: its last case originally asserted that no two states share
a label, and reported `ready` / `orchestration_ready` — both "Ready for next
step" — as a defect. They share it on purpose; the distinction is internal and
the operator's next move is identical. The check now pins that known pair and
fails only on a NEW clash. A test does not get to overrule a decision.
Mutation: reverting the guard to exact equality fails 2 of the 6 cases.
verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home 130/130. test:unit 228/230 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
e6b499468e |
fix(control): the sort called "Priority" ranked nothing at all (#822)
George, looking at the rail: "priority ordering has no logic and idk why it is like that." There was none. The comparator for that mode, in full: return sourceSnapshots.indexOf(a) - sourceSnapshots.indexOf(b); — the order the API happened to return. It is the DEFAULT sort, it is labelled Priority, and it sorted by nothing. That is why the rail opened with idle projects while the three holding an open workspace tab sat two thirds of the way down, and why the order looked arbitrary: it was. A control labelled Priority that applies none is worse than an unsorted list. An unsorted list makes no claim; this one tells the operator that the top of the list means something. Nothing new is invented in the fix. control-states.ts is already the SSOT for what each state MEANS — `problem` is non-null exactly when "this needs your attention", `counterCategory` is the bucket the summary chips count — so the rail now reads the same two fields the chips read, and the row order can no longer tell a different story from "0 working · 0 awaiting input · 23 idle" printed directly above it. The order is Control's one question answered top to bottom: 0 something is wrong and it is yours to fix (any state with a `problem`) 1 awaiting input — your move is to type (waiting) 2 working — running, watchable (working) 3 offline — we cannot see it (offline) 4 idle (idle) then most-recent-activity first inside each bucket, so two idle projects still land newest-first rather than in API order. The test pins the ordering against the SSOT rather than against a list of state names, so a new state inherits the rule instead of quietly landing at the bottom. Its last case is the one that matters: if every state got a DISTINCT rank the ranking would be list order again, so it fails when the ranks stop bucketing. Mutation: flattening every rank to 0 fails 2 of the 5 cases. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home. test:unit 228/230 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
c32ceb1342 |
fix(public): the pages still sold the product Loki stopped being (#821)
Four things the public surface said that the codebase no longer does. THE IDENTITY, RETIRED YESTERDAY AND STILL ON SALE /philosophy: "Loki is infrastructure for builders running many agents at once across multiple projects — not a friendly chat assistant." That is the framing #801 removed on 2026-09-20. Its own gate records why: the narrow label "named Loki's deepest capability and not the product — Today, People, Crew, Money, Goals and Habits ship here too", and under it those surfaces read as scope creep, twice prompting "move the life-ops half to the Cat". There is nowhere to move it to. That rename pinned "the three places it actually lives" — the fleet map, the agent's role sentence, the two assistant prompts. All three are things a MACHINE reads. The page a stranger reads was not among them, and the public copy mentions Crew, Money, Habits and commitments exactly zero times. The correction reached the agents and not the humans, which is the wrong way round. execution-plane.ts now covers the public copy too. A CAPABILITY THAT DOES NOT EXIST /philosophy: "Open and local models compete equally for your attention and your work." The chat chain is freeChain("LOKI") — Groq, OpenRouter, Gemini, all hosted — and every agent adapter is a hosted-model CLI. There is no Ollama, llama.cpp or LM Studio path anywhere in src. The open-WEIGHT half is real (llama, qwen and gpt-oss drive the loop today), so the claim keeps the half it earns and states the other as the direction it is. A WHITEPAPER THAT DISAGREED WITH plans.ts v0.3, published 2026-08-12, never recomputed: "Pro — for power builders running 10+ active projects" PLAN_LIMITS.projects.pro is Infinity; /pricing says "Unlimited". "Team — for small groups (up to 10 people)" no seat limit exists anywhere in the codebase. A reader comparing the two pages got different answers about the same tier, and an unenforced limit is a promise to somebody. It also said Loki "is offered" as four subscription levels while three of them have no price and cannot be bought — it now says which one is purchasable today. whitepaper-matches-plans.ts pins the checkable half against PLAN_LIMITS: a finite ceiling must be quoted exactly, an unlimited tier must not quote a number at all, and no tier may claim a seat limit. Prose about who a tier is FOR stays prose. A LINK THAT ASKED FOR THE WRONG THING The footer's "Support Loki", under a heading already reading SUPPORT, asks a reader to fund the project. It opens the help desk, whose own H1 is "Get help" — so it misled in both directions. It is "Get help" now. CHECKED AND LEFT ALONE: the ecosystem references. Loki's public copy names Solon once ("Solon — Governance") and OrangeCat as "Economy"; both match the PILLARS roles, both sites answer 200, and their own titles are "Solon — Bitcoin-Native Governance" and "OrangeCat — Your AI economic agent". Nothing overclaims Solon's maturity. Mutation: restoring the retired framing fails execution-plane.ts; restoring either the "10+" ceiling or the seat limit fails whitepaper-matches-plans.ts. Both ratchets strip comments first, or the note recording what was retired would fail on itself. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home 130/130. test:unit 228/230 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
d71ddd446e |
fix(runs): the fleet stopped executing and nothing said so (#820)
`closeRunUndelivered` stamped `error`, emitted a run event and called
`notifyRunClosed` — but never `advanceEscalation`. It was the ONLY
failing-close path feeding the ladder nothing: the funnel
(updateOrchestrationRun) advances, the reaper advances, this did not. A
dispatch that died before an agent ever saw it therefore could not build
a streak no matter how often it repeated, so the `human` rung — the one
that raises the alert — was unreachable from this path.
Notification did not cover the gap and could not: formatRunCloseMessage
self-gates on payload.notifyOnClose, which only human-initiated
dispatches carry ("autopilot churn stays quiet"). For an autopilot or
cron dispatch the notify call returns null, so the close said nothing to
anyone at all.
Measured on prod today: six dispatches failed across FOUR projects
(loki, kivvi, solon, reparaturbonus-zh) within twelve hours on an
exhausted Claude quota — every one through this path — while the newest
row in `alerts` was six days old.
Derived, not assumed, via the same ladderEffectForClose predicate the
other two call sites use, so there is one rule for what a close does to a
ladder. The ladder's own `lastOutcome` keeps it honest downstream: it
already distinguishes a streak built from undelivered dispatches from one
built from an agent's failing work.
Attaches the missing signal only — it does not change the outcome, the
notification policy, or what a streak means.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
5386267149 |
fix(public): "46 agents running" was two agents and forty-four stale flags (#819)
/investors and the homepage hero read a raw boolean that nothing expires. Measured against prod on 2026-09-20: rows flagged agent_running = true ....... 46 updated in the last 30 minutes .......... 2 oldest flagged row last touched ......... 2026-08-13 — 910 hours earlier So the page showed "46 agents running" while Control, on the same database, showed "0 working". Both numbers came from the same fleet; only one of them was bounded. It sits directly under this sentence, which is why it matters more than an off-by-something: "the homepage hero and this page render the same live snapshot of that fleet — real data, never fabricated numbers." The numbers were not fabricated. They were stale, offered to an investor as proof of activity. And this file's own header promises "honest by construction — isLive is true only when an agent is really running, so the hero never claims LIVE falsely". isLive is `totals.running > 0`, so it had been true for weeks on the strength of flags nobody cleared. The app already had the answer. Control bounds the same question by OPEN_TURN_TTL_MS — thirty minutes, a constant whose comment records that without it "a dead Codex tab showed working 61h", and which is deliberately matched to STALE_PROMPT_S so two definitions cannot disagree on screen. The public query simply never applied it. It does now, through one predicate used by BOTH the headline count and the per-project dots: bounding only the count would have left a project's dot lit for an agent that died in August. Reused rather than re-picked on purpose. A second freshness number would eventually disagree with Control's, and then a reader is right to trust neither. The other two figures were already honest and are untouched: "projects" counts active rows, and "runs this week" was time-bounded from the start. Proved by mutation: restoring the unbounded check fails 2 of the 6 cases. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home 130/130. test:unit 227/229 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
cdff69e3c2 |
test(audit): make the page list earn it, instead of asking it to (#818)
responsive-audit.mjs opens with the argument this enforces — "a rule enforced
on the pages that happened to be reachable is a rule with holes exactly where
nobody looked, so the list has to earn it". It could not earn it alone,
because nothing ever compared the list to the app. Twenty-four static page
routes were in neither list.
Comparing them found four that matter:
/my-feedback the REPORTER's view — the one feedback surface whose reader
may be a stranger on someone else's site, and one AGENTS.md
already records as having been forgotten ("the three-line
clamp shipped to the operator inbox never reached it").
/license public, 200, and already missed once: the MIT relicense fixed
LICENSE, README and Terms and left this page telling readers
they "may not" host or repackage (loki#802).
/privacy the other two pages a stranger is entitled to read, neither
/terms of them ever measured.
Plus /unlock, /releases, /setup and the two /docs guides. All twenty new
checks pass, so the gap was not hiding broken layouts here — but it was
hiding /feedback's, which clipped its own stats mid-word on a phone until
#813, and it would hide the next one.
The rest are excluded BY NAME WITH A REASON in NOT_MEASURED: retired redirect
stubs that render nothing (/agents, /atlas, /duet, /digests, /decisions,
/history, /blog), an action rather than a page (/sign-out), and flows that
need state a headless run cannot mint — a claim token, a verification token,
a connected Fleet Runner.
scripts/test/audit-covers-every-page.ts then fails when a page.tsx is in
neither, so adding a page becomes a decision about whether it is measured
rather than a silent omission. It also fails on an exclusion whose page no
longer exists — a stale reason is one nobody re-examines — and refuses a route
listed in both.
It asserts its own parse first. If the regex that reads those lists ever stops
matching, every other check would pass vacuously, which is precisely the
failure this file exists to prevent.
Mutation, both ways: removing /my-feedback from the audit fails it, and
excluding a route with no page fails it.
verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home 130/130. test:unit 226/228 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
1f7966ef4a |
fix(runs): a reaped "partial" recorded a verdict with nothing behind it (#816)
The reaper stamps `partial` on exactly one basis — `wroteAfterStart`, an
EXISTS over project_states proving the agent DID save a handoff inside the
run window. It then writes payload.note ("the agent had already saved a
handoff…") and stops. The handoff it just proved exists is never copied
onto the run, so `summary` stays NULL.
reapStaleRuns already names that state as the one to avoid — "reaped with
a partial verdict and a NULL summary, recording a failure whose reason
nobody could read". Aligning the freshness floor removed one CAUSE of it;
nothing ever filled the summary, so the ordinary path still reached it.
Measured on prod today: 8 of the last 12 closed runs on `loki` were reaped
partials with an entirely empty summary, every ~6 hours for three days.
That silence compounds, because the run summary is what briefs the NEXT
run — `done`/`next` are what the dossier re-serves under "Recent run
outcomes", so each dispatch was briefed with less than the previous run
actually knew.
A post-reap pass gives the handoff back, alongside the evidence corrector
it mirrors. Deliberately narrow: it attaches evidence, it does not
re-judge. Only rows whose summary is still NULL (never clobbers another
close path, re-running is a no-op); the run keeps its `partial` outcome,
because re-deriving the verdict would move the escalation ladders and the
failure brake that read it; and the same freshness floor the reaper used
is re-applied, so a handoff belonging to a different run can never be
pinned onto this one in the gap between the sweep and the pass.
The mapper is pure and lives beside the other two "summary from X"
builders, so it is testable with no database.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
013646e678 |
fix(pricing): "Most popular" was a claim about customers who do not exist (#815)
The pricing page badged Pro "Most popular". Checked against the database today: Loki has 7 users and 0 on any paid plan. Every paid tier reads "Price to be announced". So nothing has ever been bought, and no tier can be the popular one. It is the seller's emphasis, and it now says so: "Recommended". An opinion someone owns is honest; a fact about other people's choices, invented, is not. The card keeps its border and its filled CTA, so the hierarchy is unchanged. That page already held this standard in its own header — "a paid CTA only appears when a rail can actually take the money, never a dead Buy button" — and a permanently-unreachable Stripe branch was deleted for breaking it. The badge sat two screens below and slipped past. This is the second time the class has shipped in the fleet. George, on Substrata: "dont ever lie. ever." The remedy there was a banned-phrase ratchet, so this adds that ratchet for the public surface: scripts/test/no-invented-social-proof.ts fails on copy under src/app, src/config and src/components/public that asserts what other customers did — "most popular", "trusted by N", "join N users" and friends. Two things the ratchet gets right on purpose: - It bans claims about OTHER PEOPLE'S behaviour, not enthusiasm. "Recommended" and "Our pick" pass, because someone is accountable for them. - It strips comments before scanning. Otherwise this file, and the one it fixes, would both fail on their own explanations of the phrase they ban. Each pattern is only a lie while the number behind it is zero — which is why deleting an entry has to be a deliberate edit by a human who checked, not a check that quietly passes once the copy is reworded. Proved by mutation: restoring "Most popular" fails the suite. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home. test:unit 224/226 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
1f40a7c0d5 |
fix(ui): five scroll strips that hid their own scrollbar and never said so (#813)
Started from a real report: the buttons on /feedback look thrown together on a
phone. They do, and the page had never been measured — /feedback and /robots
were reachable from the sidebar and audited by NEITHER list in
responsive-audit.mjs. The paragraph above that list argues exactly this: "a
rule enforced on the pages that happened to be reachable is a rule with holes
exactly where nobody looked — so the list has to earn it." Both are in it now.
WHAT THE PHONE ACTUALLY SHOWED
/feedback at 390px ended mid-word — "32 Shipped 18 in…" — with the third
stat entirely off-screen. `.ui-stat-row` below sm is a flex strip with
`overflow-x-auto` AND `[scrollbar-width:none]`: no scrollbar, no fade, and
nothing whatever to say the row continues. A clipped word does not read as
"swipe me", it reads as a broken layout.
The repo already had the answer — `ui-scroll-fade-right`, which masks the
right edge below sm and nulls itself at sm. Four more strips were missing it:
ui-stat-row Feedback, Goals, Memory, Money, Habits
ui-filter-chip-row EventsGrid — the other FOUR call sites already had it
ui-inbox-projects Control's inbox
ui-activity-tabs the Activity tab row
ui-term-key-lane the phone key deck
ui-filter-chip-row settles the question of whether this was a decision: the
same class carries the fade at four of its five call sites.
A COMMENT THAT DESCRIBED A LAYOUT THAT DOES NOT EXIST
StatRow's doc said the row is "two columns below sm" and that the odd card
spans via `:last-child:nth-child(odd)`. No such rule has ever existed in
globals.css — the layout was replaced by the scroll strip and the
description was left behind. That is worse than no comment: it sends the
next reader hunting for a rule to adjust that is not there. Rewritten to
describe what the CSS does.
THE RATCHET
scripts/test/scroll-strips-have-an-affordance.ts fails on any strip that
scrolls horizontally AND hides its scrollbar AND offers no fade — reading
both the JSX and the ui-* class bodies, since .ui-stat-row hides its
scrollbar inside globals.css and its className reads innocent.
Its first cut reported the file it had just fixed, because it matched the
class name in the explanatory PROSE above the component. It reads className
attributes only now. A detector that cannot tell code from commentary
invents work.
Mutation: removing any one fade fails the suite.
verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home 130/130. test:unit 223/225 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
2e7c9bab61 |
fix(activity): the biggest number on the page was the one you could not open (#812)
Prod, 2026-09-20. The KPI row read: 9 Needs you · 1 Shipped · 0 Running · 49 Queued Four of those are links that filter the list below. "Queued" was a <span>. So the largest figure on the page — and the one that most obviously wants investigating, 49 waiting while nothing at all was running — was the one thing you could not click. Its only explanation was a `title` tooltip, which a touch device never shows at all. CLAUDE.md states the rule this breaks: "A gate records; it never blocks. Anything that pauses a person shows the way forward on the same screen." Queued is now a filter like the rest: a tab, a tally, and a list. The part worth care is that the rule lives in ONE place. `eventIsQueued` is exported and used by the hero's count, the tab's tally and the filtered list alike. Two copies would be worse than none — a count and a list that disagree teach people to trust neither, which is the failure this repo keeps finding in other forms. The predicate also carries the precedence the summary already used: attention outranks queued, so a dispatch that never reached an agent is reported as needing you rather than as patiently waiting. Proved by mutation: letting the filter drift from the count by one clause (including local chats) fails 2 of the 6 cases, one of them the explicit count == tally == list invariant. Typed into place, not guessed: `FILTER_LABEL` is a `Record<ActivityFilter, string>`, so adding the filter made the compiler demand the label. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home 130/130. test:unit 222/224 — activity-time-zone-stable and telegram-allowlist need a live local server; both fail identically on a detached worktree of pristine origin/main, checked again here because this diff touches activity files. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
af98b036a5 |
fix(ui): numbers that did not add up, and a gate with no way out (#811)
Two things found by reading the screens as a user rather than as their author. SEVEN REPORTS WITH NO NAME The Feedback header read "68 reports · 29 still open" beside "32 shipped". 29 + 32 is 61. A reader who checks the arithmetic concludes one of the three numbers is wrong; every one of them was right. The remainder is `archived` — filed away rather than fixed — a state no card admitted existed. Confirmed against the database: resolved 32, dispatched 25, archived 7, new 4 = 68, where "open" is new + dispatched. The metrics query never counted archived rows, so the page could not have named them. It does now, and `reportsSubLine` is pure and exported so the arithmetic is pinned without rendering — three numbers that fail to reconcile look exactly like three numbers that do. Mutation: dropping the archived clause fails 3 of the 5 cases. A PIN SCREEN THAT BLOCKED ABSOLUTELY AGENTS.md and CLAUDE.md now state the rule: "A gate records; it never blocks. Anything that pauses a person shows the way forward on the same screen." The private-zone gate did the opposite. Forget the PIN and there is no route anywhere: changing it requires the current PIN, removing it requires the current PIN — both deliberately, so a hijacked session cannot swap it — and no reset flow exists. The screen offered an input, "Incorrect PIN", and nothing else, while the zone behind it holds 2,750 contacts and a 2,797-entity knowledge graph. The fix is NOT to weaken the gate. It is to stop implying a door that is not there: both surfaces — the /unlock page and the inline PrivatePinGate — now state the consequence and link to /support, whose address is on the apex domain and has a live MX (checked). Not changed: the PIN recovery policy itself. Adding a reset path is a security decision with a real trade-off, and it is George's. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (11), check:desktop, test:home 130/130. test:unit 221/223 — activity-time-zone-stable and telegram-allowlist need a live local server and fail identically on pristine origin/main; this diff touches neither. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
276b412a14 |
fix(audit): the contrast gate only ever looked at the dark theme (#810)
A fresh browser context has no `loki-theme` in localStorage, so ThemeProvider
falls back to defaultTheme="dark". This audit never set one — so every contrast
number it has ever reported was a dark-theme number, and light mode has never
been measured by anything. CLAUDE.md is explicit that light "is a real state
your styling must survive".
It was hiding real work. Measured on prod against /today and /control, 132
interactive labels across both themes: DARK has zero below the AA floor, LIGHT
has TWENTY, including the ones you press —
2.09:1 "Send" the dispatch button on Control
2.09:1 "More"
2.23:1 "Recent" / "A-Z" the project sort controls
2.29:1 "Unlock private"
3.83:1 "Open terminal"
4.13:1 the command palette ("Search prompts, pages, dispatch…")
4.29:1 the Profile / Chat / Terminal workspace tabs
Two changes, both about the gate rather than the palette:
- Each theme gets its own context, seeded with the key ThemeProvider persists,
and the run ASSERTS `data-theme` actually applied. Without that assertion a
light pass that silently rendered dark would report clean — which is the
exact shape of failure this file was written to catch.
- The settle loop now wants three identical counts and at least four reads.
Two was enough when one warm context served every route; each theme now gets
a COLD one, and cold /control served 2 labels twice running while it
hydrated, then latched and reported 2 of the 54 it has. That is a clean tick
for a page the audit never looked at.
Deliberately NOT done: raising the light `--text-muted` / `--text-tertiary`
tokens. The file already states the position — the tertiary token is below AA
on dark too, has ~429 usages, and widening scope waits on that token being
raised. That is a palette decision with a visible blast radius, and it is
George's, not a side effect of fixing the instrument. This change only makes
the cost visible.
Not wired into `verify` or CI (it needs a session, network and a browser), so
reporting more cannot redden the build.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
3ba22707cc |
fix(activity): the feed spent its whole preview on a note to the agent (#808)
Three consecutive "Needs you" rows on prod, 2026-09-20 — three different runs
— each showing the same sentence, cut at the same word:
Partial with no recorded reason — asked: Work on the project at
/home/g/dev/loki. [autopilot · loop=next_best — this prompt was auto-injected
by the local dispatch loop, NOT typed by a human. Treat it as a
regularly-scheduled review task; if the conversation seems off, suspect th…
That header is written in config/prompt-library.ts and addressed to the AGENT.
It is ~230 characters; PREVIEW_MAX is 240. So the preview was the header and
nothing else, the three rows were indistinguishable, and the reader never
reached a word of what was actually asked.
Two things wrong, both fixed:
- The header is stripped from the PREVIEW, so the row shows the ask.
- "asked:" is a claim about who asked, and for these rows nobody did — the
prompt's own first sentence says it was not typed by a human. An autopilot
row now names its loop instead of implying the operator wrote it.
This is what `activity-status.ts` already exists to do: stripHarnessScaffolding
and extractOperatorTask are there so a feed shows "exactly the human ask". The
autopilot header was simply a gap in that set.
THE DISTINCTION THAT MATTERS: stripped from `preview` only. `task` is what a
re-dispatch sends and `full` is what the agent received — removing the header
there would re-run the loop's work without the instruction telling the agent a
loop sent it ("suspect the loop, not the human"). The test pins that both ways,
and mutation proves it: stripping `task` too fails the suite, and not stripping
the preview fails it.
verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11), check:desktop, test:home. test:unit 216/218 —
activity-time-zone-stable and telegram-allowlist need a live local server and
fail identically on pristine origin/main; this diff touches neither.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
6eff359fd3 |
fix(ui): two pages that knew more than they showed (#807)
Found by walking the pages on prod, 2026-09-18.
TODAY — four half-empty rows
`CardRow` is authored as a pair ("a single column on a phone, two from md
up"), but the cards inside it render nothing when they have nothing to say:
an empty calendar, a quiet alerts card, anything behind the locked private
zone. React drops a null child from the DOM, so a fixed two-track grid kept
both tracks and drew the survivor at half width beside an equally wide void.
Measured with the private zone locked: FOUR rows, each a 408px card next to
408px of nothing — most of what the page looked like. Now a lone survivor
spans the row. Nothing changes when both cards render, so the deliberate
pairings the page comments defend ("the two cards that are only true right
now") are untouched, and at grid-cols-1 the rule is a no-op.
PROMPTS — two cards nobody could tell apart
Two cards titled "Next Best Step" sat side by side: same title, same clamped
summary, same four tags, under a header reading "2 saved · most-recent
first". Nothing said which was which — and `updatedAt`, the field that
ordering rests on, was carried into the component and never rendered. So was
`runCount`.
Underneath, the API returned EIGHT rows, all named "Next Best Step", in two
groups of four byte-identical bodies. The render-time dedupe is RIGHT to fold
them (it was added after a smoke session forked a default seven times) and
right to keep both survivors — they genuinely differ, past the two-line
clamp. But folding silently made delete look broken: a card stands for a
whole group, so deleting it draws the next identical row in its place and the
prompt appears to come back.
The card now says when it was saved, whether it has ever run, and how many
identical rows it stands for.
`collapseDuplicates` is pure and exported so the rule is pinned without React.
Proved by mutation: dropping the count fails 3 of 7 cases, keying identity on
name alone fails 3.
NOT done here, because it is a decision rather than a defect: making delete
remove the whole group it represents, and clearing the 8 duplicate rows. Both
touch stored data.
verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings),
check:design (11 checks), check:desktop, test:home, and every check:*/gate
member green. test:unit 216/218 — activity-time-zone-stable and
telegram-allowlist need a live local server and fail identically on pristine
origin/main with no changes at all; this diff touches neither.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
4735397aa0 |
fix(feedback): the reporter page was the counter-example to its own top report (#806)
* fix(feedback): the reporter page was the counter-example to its own top report /my-feedback rendered a report asking for a three-line clamp at full eight lines, under a chip reading "Being implemented". The clamp WAS implemented — FeedbackReportText, #783, written in answer to that very report — but only in FeedbackItemRow, the operator's inbox. The reporter page kept its own row markup, so the fix never reached the person who asked for it. The missing import is the symptom. The defect is that a third feedback surface existed with its own renderer and nobody knew, so this fixes the page and closes the gap that let it drift. The page now: - renders bodies through the shared FeedbackReportText, so one dictated report stops owning the list; - derives status instead of dictionary-mapping the DB word. `dispatched` meant queued, running, crashed days ago, or shipped-but-unconfirmed, and all four read "Being implemented"; work-phase.ts opens by saying DB status cannot answer that question, and this page was the last one still asking it; - gives the reporter a next action — "Check the live page" once a fix is actually deployed, never while its pull request is open; - colours the chip. Every state used .ui-badge, the same neutral pill as a duplicate count, so the one thing a reporter comes here to learn carried the weight of a footnote; - formats dates in the READER's locale and time zone. toLocaleString() ran in a server component, so a Swiss reporter was shown a US date on the box's clock. The operator row never had this; it is already a client component; - labels the project name, which sat unlabelled exactly where a person's name would and read as one. What a reporter may see is decided in one place. reporter-view.ts writes every reporter-facing sentence rather than forwarding FeedbackWorkView's, because that view is written for whoever owns the machine: `detail` carries builder asks, `diagnostic` the agent's raw error, `stepSummary` run-hop narration, plus run and command ids. A pass-through would have been shorter and would have put an engineer's note on a stranger's screen. attachReporterView is likewise a narrow read, never attachFeedbackWork — that one refreshes GitHub ledgers, sends the owner's notifications and scopes to the owner, none of which belongs on a reporter's page load. Reporter run lookup is deliberately not owner-scoped, and authorization comes from the report instead: the caller has proved reporter_user_id, and passes only the dispatched_run_id values off those rows. Guards, so the next clamp-class fix cannot land on one surface only: - feedback-reporter-view.ts pins that the page renders through the shared clamp, formats no date server-side, maps every phase, and leaks no operator-only string for any phase; - CLAUDE.md names /my-feedback in Views — it listed /feedback and ControlInbox and not this one; - /feedback and /my-feedback join audit:responsive, which would have caught an eight-line row at 390px. Dropped the subtitle's "Tracking a report never grants permission to edit its project." It answered a question no reporter asked and spent the line that now says what the page is for; the boundary it described is enforced in code and pinned by tests, not by that sentence. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FuaeWPc8gT5sbS7G8BjnrK * fix(feedback): read the reader's clock without setState in an effect `react-hooks/set-state-in-effect` rejected the first cut, and correctly: a useEffect that immediately setStates is a cascading render, and the rule does not care that the second render is the point. The constraint that produced it is real, though. Only the browser knows the reader's time zone, so the localized string cannot exist during SSR — and server and client must still emit identical markup or React throws the tree away. useSyncExternalStore with a server snapshot answers both, and is the shape this repo already reaches for: BrandVersion says "client-only, with a null server snapshot so SSR/hydration match (no setState-in-effect)" in as many words, and NotificationsPill uses the same mounted gate after a React #418 on every authenticated page. Also drops the now-redundant `title`: after hydration the visible text IS the full localized string, and `dateTime` carries the exact instant for machines at every stage. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FuaeWPc8gT5sbS7G8BjnrK --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
fa5e277329 |
fix(dossier): a run's stderr is not the project's next step (#805)
The dossier every dispatch carries opens with "## Latest handoff → Done /
Next / Health", read from the newest `user_projects.dev_log` entry. For a
hosted (Hermes) run that entry was built like this:
done: label.slice(0, 100) // label = `Hosted dispatch (Hermes) — ${task.slice(0, 70)}`
next: text.slice(0, 2_000) // text = the run's OUTPUT, or its ERROR
health: "good" // on every entry, FAILED ones included
Three separate lies, all reported in #584 on 2026-09-10 and all still
reproducing on 2026-09-20 — the first of them in the dispatch that opened
this session:
- Done: Hosted dispatch (Hermes) — # Loki operator dispatch
Everything in this message is assembled by Lo
`task` for an autopilot run IS the assembled envelope, so slicing its
first 70 characters yields preamble. "What did the last run do?" came
back as a truncated system prompt, and then every subsequent dispatch for
that project re-served it for hours.
`extractOperatorTask` already exists for exactly this — the Activity feed
uses it so a row shows what was ASKED rather than the scaffolding. The
hosted runner had its own slice() sitting beside it. It now uses the
helper, so the line names the actual instruction.
`next` held the run's output. On failure that is the raw error, stack
frames and all, filed under the heading that tells the next agent what to
do. It is now empty — and the dossier omits a blank line entirely, which
is the honest rendering, because a hosted run genuinely does not know the
project's next step. Nothing is lost: the full output and the full error
already live on the orchestration run's payload via closeHostedRun and in
the task_completed/task_failed event beside it. The dev log is the
summary, not the archive.
`done` now states the outcome — the PR url, the pushed branch, "no file
changes", or FAILED plus the error's first line. First line, not the
error flattened: "Error: spawn pnpm ENOENT" plus three stack frames comes
to 158 characters, under any sane clamp, so flattening would have carried
`node:internal/child_process:285:19` into a line agents read. The test
pins that case; it caught it.
And a failed run no longer reports health "good", which it did
unconditionally — so the Health line agreed with itself no matter what
had happened.
The decision moves to src/lib/hosted-run-log.ts where it can be tested,
rather than living as four slice() calls at four call sites. What the
dossier shows to every future agent is a product decision, not a
formatting detail.
verify: 216/216 unit tests, tsc clean, lint 0 errors (2 pre-existing
warnings).
Refs #584
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
93a6e3e1f2 |
refactor(beacon): delete the popup, and gate the class of bug that hid it (#804)
The beacon popup was retired on 2026-06-11 ( |
||
|
|
d42dbfed4d |
fix(ci): a test that never exits is a failure, not a 56-minute wait (#809)
groq-chain-fallback finished its assertions in two seconds, printed its check
mark, and then held every CI run open for FIFTY-SIX MINUTES. It read as "CI is
slow" rather than "a test is broken", so nobody looked.
Its refusal cases drive the vendor-error path, which fire-and-forgets a quota
write: recordRefusal -> persist -> lazy import of @/db -> postgres(url,{max:5}).
Nothing closes that pool, so its sockets hold the event loop open. The file now
ends with process.exit(0), as the other database-touching tests already do
(rag-retrieval, telegram-allowlist). Exiting is safe precisely because the
pending write is worthless: the readings come from a stubbed vendor answering a
fake key, so persisting them would put fiction in the quota table.
Reproduced both directions against a real database: without the exit the
process is still alive when killed at 45s; with it, 1s.
This was invisible locally, which is why it survived -- with no DATABASE_URL the
lazy import rejects and the process exits in two seconds. The hang exists only
where a database does, so test-unit.ts's own header claim that these tests
"behave identically on a laptop and in CI" was quietly false, in timing rather
than in pass/fail.
The runner is the real fix: it spawned every file with no timeout, so one wedged
test set the runtime of the whole suite. It now enforces a per-file deadline
(UNIT_TEST_TIMEOUT_MS, default 120s) and reports a timeout as a named failure
pointing at the likely cause. Proven by mutation: a planted file that wedges the
event loop goes red in 20s instead of running forever.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
33395d2c91 |
refactor(ecosystem): Loki is the execution layer, not the engineering one (#801)
"Engineering" named Loki's deepest capability, not the product. Today, People, Crew, Money, Goals and Habits ship here too, and OrangeCat — whose dashboard is economic entities — has no surface to receive them. Under the narrow label those two thirds read as scope creep, and the conclusion drawn from it, twice in one session, was "move the life-ops half to the Cat". There is nowhere to move it to. What actually separates the three products is AUDIENCE, not subject matter: OrangeCat is public by design, Loki private by default, Solon shared with its members. Work crosses a boundary when it needs to be seen, paid or decided — which is the seam Crew already implements, keeping an assignment private here and mirroring it to OrangeCat as a service only once it is paid. - fleet map: the `capability` layer becomes `execution`, and Loki's role sentence names the people, commitments and spending alongside the agents - both assistant prompts (chat + tool loop) introduce Loki as the operator's execution layer rather than a captain over projects alone - AGENTS.md / CLAUDE.md state the plane, and why the old word was wrong - new gate scripts/test/execution-plane.ts pins all three, so the rename cannot roll back quietly; picked up automatically by test:unit Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
a02d31d996 |
Every public claim matches the code, and two gates can now fail (#802)
* fix(truth): every public claim now matches what the code and the licence say The /license page forbade what LICENSE grants. #791 relicensed the repo to MIT and fixed LICENSE, the README and the Terms — but missed the page, which still said "source-available", listed hosting and repackaging under "you may not", and promised a replacement licence that had already shipped. On a public repo, that revoked rights we had granted. Same shape, five more places: - Three live /thoughts pages and four front-matters carried "Mao Nakamoto", the retired identity, into the rendered byline and the OG social card. - legal/ named that identity as operator, data controller and IP assignor, and assigned the work to bitbaum AG / orangecat GmbH / loki GmbH — none of which were ever incorporated. Rewritten as a record of authorship and the MIT grant, which is what is actually true. - The desktop About dialog and the installer copyright metadata shipped "© 2026 Mao Nakamoto" in every build. No audit pass had looked there. - /pricing and the feedback-widget docs said the report loop "closes itself" months after close-loop.ts deliberately removed auto-resolve for being untrue; resolve is an operator act and has zero call sites. - /roadmap claimed signed installers under "Shipping now"; no signing secret exists and /download says the opposite two pages away. - /releases claimed "every shipped version" while missing nine, and listed a 0.8.25 that was never tagged — its "Binaries →" link 404'd. Removed per the file's own rule: one entry per tag pushed to loki-releases. - desktop/README pointed all five install commands at bitbaum/loki, which 404s; releases publish to loki-releases. Version pin replaced with a glob so it cannot rot again. - DEFAULT_USER_NAME greeted nameless OAuth users as "Mao". And the two that lied to agents rather than users: CLAUDE.md claimed pre-push runs the full verify bundle so "green locally means green in CI", and AGENTS.md claimed pre-commit runs tsc. The hook's own header documents why it stopped doing both — a docs-only push runs nothing. An agent trusting either line would skip the verification it needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(gates): close the two gaps that let deleted things keep passing Two gates could not fail, and one migration ledger had silently drifted. MIGRATION JOURNAL — 13 files missing, next db:generate breaks the deploy. drizzle/ held 78 .sql files; meta/_journal.json had 65 entries. Production was fine and always had been: apply-schema.sh globs the directory and keeps its own _deploy_schema_history, so it never reads the journal. But drizzle-kit does, and its newest snapshot was 0072 — so the next generate would re-emit 0073-0077, including CREATE TABLE "calendar_busy" with no IF NOT EXISTS. apply-schema.sh rewrites ADD COLUMN only, and the batch is one transaction, so the deploy would abort on a change unrelated to it. Reconciled to 78 via bootstrap-migration-ledger.ts --write-journal, and added scripts/test/migration-journal-coverage.ts so it cannot drift again: files vs journal in both directions, plus idx contiguity. Proven by mutation — drop one entry and it exits 1; restore it and it exits 0. SMOKE — every authenticated probe passed whether or not the route existed. The auth middleware answers 401 before routing, and check_route accepted 401 for everything in AUTH_API_ROUTES. Measured: /api/definitely-not-a-real-route returns 401 exactly like /api/orgs. So the list proved nothing, and /api/checkout/personal sat in it for 15 days after the Stripe rail was removed. A 401 now only passes if a route file actually resolves on disk (dynamic and catch-all segments included); the dead entry is gone, and all remaining probes resolve. Also: bumping desktop/package.json to 0.8.29, because the retired-identity fix in the previous commit touched desktop/src/main/index.ts and desktop-release- drift.ts correctly refused to let a shipped file change without a release to carry it. That gate was right and is the model for the two above. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
451ac5ded7 |
fix(dispatch): a deadline four months gone is not a near-term commitment (#800)
Every dispatch this fleet sends opens with the operator's goals and
deadlines, under the instruction "align your priorities" — and on
2026-09-20 the two it listed were:
The operator's near-term commitments/deadlines (be mindful of these):
- Get a $50 signup bonus when you spend $100 within 30 days of getting
a new Coinbase One Card — due 2026-05-03
- You can unpause your project from the dashboard within 90 days. After
this period, the project cannot be restore — due 2026-07-03
Four and a half months and eleven weeks gone, handed to every agent on
every project as something to aim at. Filed as #584 on 2026-09-10 after
the same block reached Heidi; it has shipped in every dispatch since,
including the one that produced this commit.
Two separate defects, and the interesting one is not the label.
listUpcomingCommitments takes everything active due before now+14d with
no floor, which is deliberate and documented — "overdue included, those
are the most urgent" — but it then ordered by due_date ASC and capped at
8. Ascending order over a set that reaches backwards means the OLDEST
rows sort first and take the whole cap, so the least recoverable items
crowd out the ones still worth doing. "Soonest first" and "most urgent
first" read as the same sentence and are opposites here. Distance from
today is what urgent actually means, so that is what the ORDER BY says
now; verified against the live table, where it flips the two rows into
the right order.
The label is the half that changes today's prompt. Overdue rows still
belong in this block — a commitment someone missed is exactly what an
agent should know — they just have to arrive marked as missed:
- ... — was due 2026-07-03 (OVERDUE)
- Reduce Monthly Burn (40%) — target 2026-06-30 (PAST, not met)
and the heading no longer calls the list "near-term" while carrying rows
that are not.
isOverdue lands in lib/dates.ts as the one definition, deliberately not
`isPast`: that is instant-granular and would call a 09:00 deadline missed
by lunchtime. It compares PRINTED dates — the same toLocalDateStr the
block renders with — so the word and the date beside it cannot disagree,
which an instant boundary computed in a different timezone from the
formatter can and does.
The same predicate goes into the daily brief, whose entire premise is
handing the model settled answers instead of rows to filter. It asked
"commitments due inside 3 days" and described its own SQL as
`due_date <= now()+3d`, both true of the code and neither true of the
rows: overdue ones were in the answer, unlabelled. Its dateLabel also
printed a UTC day next to a word now decided on the local one, so both
now go through toLocalDateStr.
The format test moves out of the source file into scripts/test/, where
test-unit.ts actually globs it — as an inline `--self-test` nothing ever
ran it. Extended to pin the boundaries, built from local calendar parts
rather than UTC instants (green under UTC, Zurich, Kolkata, New York,
Kiritimati and Midway).
Not touched: getGoalsDueSoon and getEventsDueSoon share the missing
floor, but /today's GoalsDueCard and EventsDueCard render them and are
meant to show overdue items to the human. Their `method` strings now
state that honestly instead of being made to lie less.
verify: 214/214 unit tests, tsc clean, lint 0 errors (2 pre-existing
warnings).
Refs #584
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
49e668d418 |
feat(projects): interview the owner before building from one sentence (#799)
* feat(projects): interview the owner before building from one sentence "Build it with Loki" created a project and immediately ran the kickoff — profile extraction, milestones, repository, agent — on whatever the OrangeCat page happened to say. For a service listing that is a title, a price and one line of public description. Everything the kickoff produces is a function of that text, so a thin brief produced a thin everything: `isThinBrief` already named the failure and had nothing to do about it, and the extractor wrote "Unknown" into the fields it could not infer. The one person who knows the answers is right there, so ask them. A new project from a handoff now lands on five short questions — who it is for, what they do today, what this does for them, what the build must use, what makes the first version worth shipping — and reaches the kickoff a few sentences later with a profile worth building from. - lib/project-interview.ts is the SSOT for which gaps are worth asking about. Pure: the same plan drives the route, the card and the tests, so a question can never be asked about a field already answered. Only the three essential gaps decide whether to interrupt; a missing stack preference rides along but never starts an interview. - Answers are stored verbatim — as the attribute each one answers, and appended to the description, which is what the profile extractor, the roadmap step, the dispatch prompt and RAG actually read. No model sits between the owner's words and what gets stored; extraction happens after, from a brief that now says something. - lib/project-interview-ai.ts only REWORDS the questions for this project. It cannot change which are asked, and every failure path returns the bank unchanged: generic wording beats no interview. - `hasAnswer` guards both ends. "Unknown" is a gap worth asking about, and a typed "n/a" is a skip — a stored one is truthy, satisfies every "is this filled?" check downstream, and briefs an agent with nothing. - Skipping is always available and never punished. Skip everything and you land exactly where this flow landed before. A project that was merely LINKED to an existing Loki project still gets neither flag — linking is not consent to start work on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RU7EqR1TPicrJGv46cLDaH * fix(interview): an error is never a wall, and a slow model costs wording, not waiting Two places the interview could leave someone standing still: - If the questions failed to load, the card showed the error and nothing else. The questions are an improvement to the build, not a condition of it, so the build is now one tap away from the error: "Skip to the build" lands exactly where the old one-click path landed. - Tailoring the questions to the project could take 20s, all of it spent on "Reading your page…". The plain questions are already good. 8s now: a slow model degrades the wording, never the wait. And the rule both follow, written into CLAUDE.md where the next agent reads it: a gate records; it never blocks. Anything that pauses a person shows the way forward on the same screen. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RU7EqR1TPicrJGv46cLDaH --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
04cedba195 |
Loki's public face belongs to the tenants who agreed to be on it (#798)
* fix(setup): the documented local setup produced a broken app Followed README.md and .env.example exactly on a clean checkout and got an app that renders but cannot read a session. Three separate gaps, each on the documented path: - AUTH_TRUST_HOST was undocumented. src/auth.ts gates trustHost on it, and scripts/hetzner/gen-env.sh writes it on the box — but .env.example, the README's "minimum local .env.local", docker-compose.yml and loki-app.sh all omitted it. Unset, Auth.js answers EVERY /api/auth/session with 500 UntrustedHost. Verified: 500 before, 200 after, nothing else changed. The auth.ts comment claimed the local production server set it; it did not. - The compose db image has no pgvector. knowledge-embeddings.ts declares vector(384), so `drizzle-kit push` dies on the first table with `type "vector" does not exist` and leaves an EMPTY database — which reads like a broken checkout rather than a missing extension. Switched to pgvector/pgvector:pg17 and added an initdb script that creates it before the migrate service runs. - drizzle.config.ts never loaded .env.local, though a dozen scripts under scripts/db and scripts/test do. `pnpm run db:push` therefore threw "DATABASE_URL is required" at someone who had just set DATABASE_URL where the README told them to. An exported variable still wins, so CI and the box are unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(projects): the empty state named a button that does not exist A new account with no projects is told to "Register your first project with 'New project' above". There is no "New project" control on the page — the button reads "Add", and the dialog it opens is titled "Add Project". The component file is called NewProjectButton.tsx, which is most likely where the copy came from. Found by signing up as a new user and following the onboarding instruction literally: the first thing the product asks you to do names a control you cannot find. Now says "Add", matching what is rendered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(fleet): a project reaches Loki's public catalogue only by consent /fleet is unauthenticated and speaks for the PRODUCT, not for a user. It resolved a single account — getSelfImprovementTarget(), "whoever owns the oldest entity named loki" — and published every project that account had. Two things were wrong with that in a multi-tenant product: 1. No decision was ever recorded. A project was on a public page because it existed. Every other public surface here already goes through getPublicProjects (the landing hero, /u/[username]); /fleet was the only one reading the unfiltered query. 2. WHICH account got published was a side effect of the self-improvement loop's notion of "which product am I improving". Reseed that entity and the next-oldest match's whole project list becomes Loki's front page. So consent is now a stored property of the project: - user_projects.listed_publicly, DEFAULT FALSE. The default is the point — signing up must never enrol a tenant in the product's shop window. - getPubliclyListedProjects() reads consent instead of ownership, across all accounts, which is also what makes the page meaningful with more than one user. /fleet no longer selects by owner at all. - A per-project toggle on the project workspace, beside the existing "Publish to OrangeCat" opt-in and reversible from the same control. - 0075 backfills the account publishing the catalogue today, so the live page is unchanged for it while everyone else starts at false. Also: FleetRegisterNote told EVERY account "19 sites are hosted on the box with no project here" — apps.conf describes one box and is a file in this repo, so a brand-new user was being told about sites they do not own. It now renders only for the account that operates that box. A user's own profile (/u/[username]) is deliberately untouched: that page is the user speaking about themselves, and it was already scoped. scripts/test/public-catalogue-consent.ts pins all of it — swapping the query back is a one-word change, and a comment cannot hold that line. Verified against a real database: consent false -> absent from /fleet, true -> present, toggled both ways through the UI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(public): what a signed-out visitor sees is a decision, not an accident Answers "whose projects does a stranger see on Loki?" — with three tiers instead of three different hardcoded owner lookups. THE PROBLEM. Loki is multi-tenant and the founder is tenant #1, but every public surface resolved an owner and published whatever that account held: - the landing hero → getHeroFleetSnapshot(getDefaultUser()) - /fleet → getSelfImprovementTarget() (fixed in the last commit) - the /projects note→ nothing at all Three answers to one question is three chances to be wrong, and the landing was the worst of them: it never consulted consent at all. Verified locally — a project with listed_publicly = false was rendering in the hero console. It also ordered by a hardcoded FLAGSHIPS = ["loki", "orangecat"], the ad-hoc version of "featured", which could only ever name the founder's own projects. The same list sat in /u/[username], where it reordered EVERY tenant's profile by two names they will never have. THE MODEL. src/db/queries/public-visibility.ts is now the one place that says what a signed-out visitor may see: 1. AGGREGATE — fleet-wide counts. Identify nobody, need no consent, and grow honestly as Loki gains users. 2. CATALOGUE — /fleet: projects whose OWNER opted in (listed_publicly). 3. SHOWCASE — landing hero: the catalogue narrowed to what the OPERATOR featured (featured_at). Curated space cannot be first-come. Two gates because they answer to different people: consent is the tenant's and may be withdrawn; featuring is the operator's editorial act. The showcase predicate is BUILT ON the catalogue predicate, so revoking consent drops a project off the homepage immediately even while it is still featured — verified all three ways against a real database. This is the doctrine site_feedback.featured_at already had ("raw visitor text NEVER auto-publishes"). Projects now work the way feedback already did. Featuring is authorized by isSiteOperator (users.is_default — the account made at /setup, so it means "runs this instance" for self-hosters too) and lives on its own query rather than riding patchProject, because it is the one project field a tenant must not set for themselves. It also refuses to feature a project whose owner has not consented. UI: two separate controls on the project workspace, deliberately not merged — "List publicly" (owner) and "Feature" (operator, shown only to them, and explaining itself when consent is missing). ALSO, from auditing the public pages at 320/390/768/1440: - /fleet had 19 sub-44px tap targets — every one the site address that is the whole point of the row, and the only sub-44px targets left on any public route. .ui-public-fleet-site was missing from the touch floor AND was an inline box, where min-height does nothing. Both fixed; now zero. - The responsive auditor EXCLUDED public routes, deferring to `smoke` "which already covers them" — smoke asserts HTTP status, which says nothing about a layout. So the pages a stranger sees first were the only ones with no responsive coverage. They are in the auditor now and need no session, so a session is required only when authenticated pages are requested. No horizontal overflow at any width, before or after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(fleet): a phone spent a screenful on filters before the catalogue Measured at 390x844: the first project row sat at y=1020px. Four facet rows (Where / Kind / For / Missing) took 366px of that, so you scrolled past more than a screen of controls before seeing any of the thing they control — on a page whose entire job is to show a catalogue. The rows now live in a <details> that is collapsed below md and forced open from md up, so desktop is unchanged and the phone leads with content: first row y=1020 -> 699. The summary carries a count of active facets, because a filter you cannot see is one you forget you set — and then an empty result reads as a broken page rather than a narrowed one. <details> rather than state, because this page deliberately ships no JavaScript ("the address bar is the state") and a filter panel that needed a bundle to open would be the one thing on it that did. One trap worth recording: hiding the closed panel has to be EXPLICIT. The UA sheet hides a closed <details>'s children with display:none, but author styles outrank the UA sheet and .ui-fleet-facet-row is `@apply flex` — so the first version rendered a toggle that changed nothing, with the element correctly reporting open=false while all four rows stayed visible. Verified both states at both widths after the fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(public): credit the builder, ask before publishing, stop renting the box Four things, all following from the same rule: Loki is multi-tenant, so its public face belongs to the tenants who agreed to be on it. 1. ATTRIBUTION. A showcased project now carries a byline — @handle linked to /u/[handle], display name when there is no handle, and NOTHING when there is neither, because a stand-in label is a name we would be inventing for somebody. Showing a tenant's work unattributed reads as "our projects", which is untrue and is the opposite of why a showcase exists; being credited and linked is also most of what a tenant gets back for consenting. Joined in the query rather than fetched per row. 2. LOKI ASKS. Consent was reachable only from a toggle nobody knew about, and a control nobody finds collects exactly one answer. The empty catalogue that follows is what gets "fixed" by widening the query again — the bug 0075 removed. So the project workspace now invites the owner once, and listing_prompt_dismissed_at takes no for an answer: per project (declining for a client build says nothing about the open-source one beside it) and in the database (a refusal that resets on a new device is a product that nags). The rule lives in src/lib/listing-invitation.ts, pure and unit-tested. The bar is repo + active, deliberately NOT a live URL: /fleet's own facets list "Being built" beside "Live", so requiring a deployment would ask only the projects that least need the exposure. 3. THE BOX IS NOT THE FLEET. apps.conf describes ONE box and is a file in this repo, and unmatched entries MINTED rows — so a Loki with one consented project still published 19 sites belonging to someone the viewer has never heard of. buildFleetRegister now takes includeUnlinkedSites, true only for the operator, for whom those rows are the entire point (the register read sideways is a to-do list). A hosted app still ENRICHES a project that exists, so a consented project keeps its real address either way; only row creation is gated, because only row creation publishes something nobody asked to publish. Verified: operator sees 20 projects / 19 sites, the public sees 1 / 0. 4. THE COPY. "This is the studio's whole catalogue" was true when one account was the whole fleet. It now says what the page is: projects their owners chose to show. Also, from re-auditing: .ui-public-fleet-name (the row's PRIMARY link) measured 21px tall on a phone. It had been invisible to every previous audit because while the page listed hosted sites alone, nothing in a row was a link at all — the fix in 3 is what made a real project row render and the gap appear. Same cause as .ui-public-fleet-site last time: the coarse-pointer floor sets min-height, which does nothing to an inline box. Every public page: zero horizontal overflow and zero sub-44px targets at 320/390/768/1440. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(home): the hero console had an empty third column Making the hero tenant-agnostic dropped "runs this week", because the old one counted getRecentOrchestrationRuns(userId) — one account's week, which is not a number a visitor should be shown. But the console's metric row is grid-cols-3, so removing it left a visibly empty third of the panel. Caught by looking at the rendered page rather than the diff. Restored fleet-wide, counted the same way as the other two: it is the metric that answers "is anything actually happening here", and an aggregate across every tenant identifies nobody, so it needs no consent and grows with the product instead of describing one account. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(footer): the studio's sites were labelled as Loki's fleet Every public page's footer lists 14 sites generated from apps.conf under "Part of the fleet — 14 more sites". apps.conf describes ONE box, the studio's, and several of those sites belong to clients — so on a multi-tenant Loki the label told every visitor that one account's client work was what Loki is. Same error as the /fleet lede, and the same fix: say whose they are. "Built by the studio" now, and the link beside it points at the tenants' catalogue by its real name rather than calling it "the whole register". Deliberately a COPY change and nothing more. The links themselves stay, all 14 of them: they are real work, several had no inbound link from anywhere before this block existed, and the cross-linking is the entire reason it is here. Removing them would trade a genuine asset to fix a sentence. Only the claim was wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(home): the hero console looked broken with nothing featured 0076 deliberately does not backfill a feature stamp — featuring is an editorial act nobody has performed yet — so the live hero will really render with zero project rows until someone features something. I had asserted that was fine without looking at it. It was not. The bar carries mb-4 + border-b and the metrics carry mt-4 + border-t, so with no rows between them the panel drew TWO horizontal lines with 32px of nothing in between: the shape of content that failed to load, on the first screen of the product. The metrics now sit flush under the bar's own border in that state, which is a panel with nothing to list rather than a panel that broke. Verified in both states: with rows the divider is back and the flush class is absent. Not fixed by falling back to showing consented-but-unfeatured projects, which was the tempting option: the invitation asks permission for the public fleet page specifically, so putting those projects in the hero would take more than the owner agreed to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(fleet): an empty catalogue told visitors to clear filters they never set With nothing listed, /fleet rendered "Nothing matches that. Clear the filters →" — to a visitor who had set no filters, offering a link that changes nothing. That is the FIRST thing a freshly self-hosted Loki ever says on that page, and it reads as a fault rather than an empty shelf. Two states now, told apart by `rows` (the whole catalogue, before the query) rather than `result.rows` (after it): nothing listed at all → says so, and says why: owners choose which of their projects appear, and nothing is published without them saying so. Links to what Loki does. filtered away → unchanged: "Nothing matches that" + clear the filters. Found by putting the local database into the state a new install starts in, rather than only the state mine happened to be in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
602a581c46 |
Organise navigation around the operator loop, give the header an identity, and stop Control contradicting itself (#797)
* refactor(shell): organise navigation around the operator loop, and give the header an account menu The sidebar carried 27 destinations in four sections, one of which was named "More" and held Approvals, Terminal, Prompts, Activity, System, Thoughts and the PUBLIC /fleet register — seven pages whose only shared property was that nobody had decided where they went. Alongside them sat a "Site" section: Mission, Philosophy, Roadmap, Whitepaper and Investors, in the signed-in app navigation. Loki is an operator console. Its surface answers three questions, so the sidebar now has exactly three sections and each one states its question: Now — what needs me? Today, Approvals, Feedback Fleet — what is my fleet doing? Control, Projects, Activity, System Command — how do I act on it? Loki, Terminal, Prompts Private stays PIN-gated below them. The marketing pages left the signed-in shell and stay reachable through Cmd-K, which now indexes NAV directly rather than whatever happens to be in the sidebar — curating the sidebar must never make a page unfindable. Alongside that, identity: - There was no way to sign out from the header, and nothing anywhere in the top bar said who was signed in. A grep of components/shell/ for "avatar", "UserMenu" or "ProfileMenu" returned nothing. Sign out, Settings and the private-zone lock lived in the sidebar footer, which is `hidden md:flex`, and were duplicated in the mobile Menu sheet's footer: two account menus, neither called one, and none where users look first. - AccountMenu now owns all of it, in the top bar, on every viewport. - The theme toggle moved inside it. It was the only control in the top bar drawn with a border and a fill (ui-theme-cycle-btn) while every signal beside it was a bare ghost circle (ui-topbar-btn) — a preference outweighing every piece of live state on the page. - SidebarFooter is deleted. Its collapse button was marked `md:hidden` inside a panel marked `hidden md:flex`, so it could never render on any viewport; SidebarBrand has always owned the working toggle. Two retired NAV entries are deleted rather than hidden: `agents` → /control and `atlas` → /projects pointed at the pages that replaced them, and since NAV_ITEMS is what AppTopBar and PageTitle scan for "which page am I on?", the first match won — /control would have been titled "Agents". Their redirect pages reference the targets, so the redirects stay honest. scripts/test/navigation.ts is rewritten to defend the new structure: every section must state its question, "more"/"misc"/"tools"/"site" are rejected by name, account items may not appear in the sidebar, marketing items may not, no two items may share an href, and the bottom bar must carry one entry point per loop section. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx * fix(control): stop the hero claiming "Idle" over a queue of six things Observed on prod: the Control hero read "Idle — nothing queued" while a panel titled "Needs you", badged 6, sat roughly a screen and a half below it, under a 23-project list. One page, one question — is anything waiting on me? — and two answers, with the confident wrong one on top. Two distinct faults, fixed together because either alone leaves the page contradicting itself. 1. The hero could not see the queue. deriveFleetPulse read agents, run outcomes and projects awaiting input, and nothing else, so the one queue on the page that literally counts things waiting on the operator was invisible to the headline that summarises them. It now takes `inbox` and ranks it last among the states that say something is up — a stall, a failure, a half-finished run and a blocked project all still outrank chores — but comfortably above "Idle". `unknown` is a separate state from `count: 0` on purpose. A queue we failed to read is not a queue we know to be empty; ControlInbox already refused to render silence as the answer "no", and the hero now refuses too. The count could not be lifted while it lived inside the panel rendering it, so the fetches moved to `useControlInbox`, called once in ControlPanel and passed down. One read, two consumers, one truth. It also removes a third copy of the /api/feedback/summary request from the page. 2. The panel was filed in the wrong tier. ControlPanel's own ordering rule says tiers 1-2 are about a human being blocked and "reporting never renders above blocking" — and a queue titled "Needs you" with a count badge is the definition of tier 2. It sat in tier 4. It now sits with AttentionBar and AgentEscalations, which it can afford because of how it was built: one line per group until opened, nothing auto-expanding, and nothing at all rendered when the queue is empty. Two rows above the fleet, not the ~1,400px of unbounded strips it replaced. The `inbox` state takes the warning dot rather than neutral grey, for the reason the `partial` state already does: grey beside the words "Waiting on you" is the page agreeing with itself in tone while disagreeing in substance. `unknown` stays neutral — that one really is "no idea". Four tests pin it: a non-empty queue is never Idle, an empty one still is, an unreadable one is not a claim of emptiness, and real trouble still outranks chores. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx * fix(design): un-invert the dark text ramp, and make token drift a build failure @bitbaum/design-tokens calls itself "the design single source of truth for OrangeCat, Loki and Solon". Solon proves it — its globals.css is 19 lines and imports the package. Loki's is ~5,800 and declares its own ramp, with the package present only as a devDependency used to generate the widget theme. A comment here said the quiet part out loud: "Loki still declares its ramp locally, so the value is kept in step by hand." Nothing was keeping it in step. Measured: Loki and the package disagree on 32 of the 36 tokens they both define, and the disagreement has a shape — someone transcribed the DIGITS between colour spaces without converting them. `--text-secondary` is `oklch(0.4 0 0)` here and `0 0% 40%` there; those are 30 of 255 apart. light: surfaces agree within 5/255; the TEXT ramp is 20-30 apart dark: text agrees within 7/255; the SURFACE ramp is 17-30 apart (Loki's ground is #010101, the fleet's is #121212) Comparing them exposed a real bug, which this commit fixes. Loki's documented ramp is primary → secondary → tertiary → muted, each quieter than the last. The light block follows it (0.1 → 0.4 → 0.58 → 0.72). The DARK block was written in the order primary/secondary/muted/tertiary with values descending in THAT order — so `--text-muted` sat at 0.65 while `--text-tertiary` sat at 0.59, and text marked muted rendered BRIGHTER than text marked tertiary. The two quietest tiers in the system, inverted, on the theme that is the default. The two values are swapped rather than retuned, so no new colour enters the system and the contrast range is unchanged. The rest is a gate, not a migration. Some of the divergence is deliberate: Loki is an operator console that sits beside a terminal, its near-black ground is a product decision, its borders are translucent overlays rather than opaque greys, and its typeface is Geist where the fleet's is Inter + Instrument Serif. Adopting the package wholesale would restyle every surface and every glyph of a running product in one unreviewable step. So scripts/test/token-drift.ts requires every difference to be DECLARED. A divergence listed in DIVERGENCES is a decision somebody signed; one that is not listed fails the build. Tokens that currently agree are pinned, so agreement cannot quietly lapse. It also asserts the text ramp descends in both themes, and complains if a token listed as divergent has since converged — which is how the list shrinks, one reviewable token at a time. It is picked up automatically by scripts/test-unit.ts (which globs scripts/test/*.ts), so it runs in `verify` and in CI without further wiring. Verified to bite: re-introducing the ramp inversion and silently retuning a pinned token each exit 1. Docs corrected to match the shell as it now is: CLAUDE.md claimed ThemeToggle ships in 8 places and described a "Today/Control/Projects + Loki + More" mobile nav; responsive-design.md described sidebar sections "Work / Private / Site" with account actions in two different footers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx * refactor(shell): stop two navigation surfaces answering a question already answered Loki ran six navigation surfaces at once — sidebar, top bar, the Profile/Chat/Control/Terminal strip, the mobile bottom bar, the Menu sheet and the command palette. On a phone at /control, four were on screen together and three were answering "where am I?". Two of them now stand down where they add nothing. FleetSurfaceGuide renders only with an active project. Its whole claim is that the four tabs are views of ONE project and that moving between them preserves it — but `fleetSurfaceHref(surface, null)` falls back to /projects, /loki, /control and /terminal, which are four sidebar entries. So with no project it was rendering the sidebar a second time, above every Control, Terminal and Projects page, preserving nothing. A navigation surface that carries no information the others lack is not a shortcut; it is a fifth nav system charging rent. AppTopBar drops its mobile page label on pages the bottom bar already names. Below md the bar shows Today / Loki / Control as labelled, highlighted tabs, so on those three the top bar's title was the third simultaneous answer after the bottom tab and the page's own heading. It still speaks on all 15 other destinations, where the bottom bar can only show "Menu" and genuinely cannot say. scripts/test/nav-surfaces.ts pins both, and pins them against the config rather than against a screenshot: it derives the projectless hrefs from fleetSurfaceHref and asserts each is a real sidebar destination (the premise the first fix rests on), checks every tab carries the project when there is one, and checks the label suppression uses the same isCurrentPath the bottom bar does — otherwise it would silently never fire. It also holds the Menu sheet to having no account footer, now that AccountMenu owns those actions. Verified to bite: reverting the strip gate fails the suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx * fix(ci): pre-push ran the wrong suite for scripts/test/ The hook classifies changed paths into three arms and runs the gates each one can break. `scripts/test/` was in the `_ops` arm, and that was backwards in both directions at once: • test:ops runs `scripts/hetzner/test-*.sh` and nothing else — verified: all 18 scripts it invokes are under scripts/hetzner/. No file under scripts/test/ can affect its result, so editing a unit test ran eighteen Hetzner shell suites for nothing. • scripts/test/ holds the 218 .ts files that ARE the unit suite (scripts/test-unit.ts globs the directory). The unit suite runs in the `_app` arm, which scripts/test/ did not trigger. So a broken unit test added under scripts/test/ passed pre-push: the hook never ran the suite that file is a member of. Now: `scripts/test/*.ts` → `_app` (tsc, lint, design, desktop, test:unit, test:home). `scripts/test/*gate.sh` → `_register`, the arm that actually runs the deploy-ref / not-behind / client-ledger / deploy-ready gates; they had no arm that ran them before either. `_ops` keeps hetzner and site-template. scripts/test/pre-push-routing.ts pins it by deriving both sides rather than restating them: it parses the hook's own `touches '<regex>' && _arm=1` lines, reads the scripts test:ops actually invokes out of package.json, and asserts each path reaches the arm that covers it. The failure mode this guards is invisible — a gate running the wrong suite still prints a wall of green. Disclosure, because it matters for how this commit is read: this also unblocks pushing this branch. test:ops fails 4 of 92 checks in a container running as root (the .env-repair cases assert file ownership against a systemd unit's User=), and that is not caused by this branch — confirmed by running it on a clean worktree of origin/main, where it fails identically, 88 passed / 4 failed. The routing above is a defect on its own merits and the fix is the same one either way; the side effect is stated rather than left to be noticed. Those 4 ops failures remain, unaddressed by this branch, on main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx * chore(design): ratchet the dead ui-* rules in globals.css check-loki-classes.mjs holds `ui-loki-*` to zero in both directions — a class used but undefined, and a class defined but unused. The other ~1,000 `ui-*` rules had never been checked at all, and 35 of them are referenced by nothing. That matters more here than in most codebases. This repo's Layer 3 contract is that every recurring visual pattern gets a named class, so the class IS the decision. Someone looking for "how do we draw a metric card" finds .ui-control-metric-card, -value, -label and .ui-control-metrics-grid sitting in globals.css and reasonably concludes that is the house style. Nothing has used them in months. Dead CSS in a system built on that premise does not read as dead; it reads as load-bearing, and the next person builds to match it. It is a ratchet, not a hard zero, for the reason the dead-exports ratchet already is one: 35 rules is real work to remove safely, and a check that fails on day one is a check that gets switched off on day two. The number may not rise, and each deletion lowers it for good — the script fails in BOTH directions, so cleaning up without lowering the baseline is also an error and the gained ground cannot be given back. Dynamic class names are honoured: `ui-dot-${kind}` appears in source as the literal `ui-dot-`, so a token ending in a hyphen marks every matching rule used. Without that the check reports ~77 false orphans, which is how a lint earns being ignored. Eight such prefixes are in play. Also deletes .ui-mobile-nav-sheet-footer, which the previous commit orphaned when the Menu sheet's account footer moved into AccountMenu. Verified in both directions: adding an unreferenced rule fails with "rose to 36", and deleting a genuinely dead one fails with "fell to 34 — lower the baseline". The first attempt at that second test was itself wrong and is worth recording: deleting `.ui-btn-pill {` changed nothing, because the class is also targeted by a compound selector 2,500 lines further down. The checker was right and the test was wrong — which is exactly the sort of thing a rule counted by hand gets wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159PhgGrn6ccwfwVTJoTuYx --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
d14796ca4a |
fix(widget): the mode chips were unstyled on every customer site (#796)
#734 pasted the .modes / .mode rules into the middle of the .dot rule's declaration block, and left .dot's `background` unterminated. CSS error recovery swallows everything from that declaration to the matching brace, so two things were broken on every site embedding /widget.js: - .dot lost its own `flex: none` and `box-shadow` halo, - .modes, .mode, .mode.on, .mode:disabled and .mode-hint never applied at all, so Report / Chat / Watch rendered as naked 16px text instead of chips. Neither is catchable by tsc — the CSS is a template string. The same rules also carried literal hex fallbacks (#333, #aaa, #f60, #fff, #888) behind var() lookups. The widget's Shadow DOM sets `all: initial` and defines no custom properties, so those var()s could only ever resolve to their fallback: a hardcoded colour wearing a token's clothes. Every colour now interpolates from the boot theme, which is generated from @bitbaum/design-tokens, like the rest of the file. Ratchet, so this class ends here: widget-theme-from-tokens now parses both emitted stylesheets and fails on a nested block inside a plain rule, an unterminated declaration, any var(), and any hex that is not a colour the generated theme supplied. All three faults were proven by mutation. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
ae92bde49e |
test(access): pin the project permission boundary, which nothing tested (#795)
Priority 5 of the 2026-09-17 review asks for the journey to be proved
with an editor and a reporter account. The live two-account walk still
needs two real sign-ins and is NOT what this does — see below. This is
the half that needs no accounts, and it turned out to be missing
entirely.
`getProjectAccess` is the one authorization decision every project
surface reads, and the rule inside it —
canEdit: member.role === "editor",
canManageMembers: false,
— lived in a function that cannot be imported without a DATABASE_URL. So
it had no test. The only way to find out that a viewer could edit, or
that an editor could add members, was to sign in as one and look. A
boundary whose only proof is a manual walk regains a hole the first time
someone adds a role.
The rule is now its own pure module and the query reads it. Behaviour is
unchanged — same two expressions, one place — and it is a Record over
ProjectRole, so adding a role without deciding its capabilities is a
type error rather than a silent `false` or, worse, a copy of another
role's answer.
Six checks, including two that hold for EVERY declared role rather than
the two that exist today: nobody but the owner can manage members, and
no collaborator role is silently as powerful as the owner. That is the
part a future role would break.
Proved by mutation: granting `viewer` canEdit fails with "a reporter
must not be able to dispatch work" — a viewer is the role a reporter
gets on the project they filed against, so that assertion is the
tenancy boundary itself.
WHAT THIS DOES NOT DO: it does not prove the end-to-end journey with two
real accounts. That needs credentials I do not have, and creating
accounts is not something to do unasked. Priority 5 stays open for the
live walk; this makes the rule it would be checking impossible to break
silently in the meantime.
tsc clean, lint 0 errors, test:unit 205/205.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
54ee73791f |
feat(control): say what a dispatch will do before it is dispatched (#794)
Priority 4 of the 2026-09-17 review: "Show agent, model, machine, and known cost/quota information before dispatch." All three were already settable on the project profile — agent, "Runs on", Model — as three separate controls, stacked, and nothing stated the combination. So the operator chose a builder in one row, a model two rows down, pressed a prompt button, and the first statement of what actually ran arrived afterwards, on the run record. Now, directly above the prompt buttons that dispatch: Dispatch runs Claude Code · opus · This computer [last run $0.42] COST IS THE LAST RUN'S, AND SAYS SO. What this dispatch will cost cannot be known before it runs, and a predicted number beside a button reads as a quote. What the previous run on this project cost is measured, and it is the best available answer to "what am I about to spend" — labelled as the past, in the tag and in its title text, never as an estimate. A real sub-cent run renders "<$0.01", not "$0.00". Rounding a run that cost something down to free is exactly the move that turns a measurement back into a claim, and it is pinned by a test. QUOTA IS EVIDENCE, NOT A BLOCK. The one piece available without asking anything: the previous run here died with capacity language (looksLikeAgentCapacityIssue, the same predicate the provider chooser uses). Quota refills, so the caution says "may still be spent" and leaves the decision with the operator. An ordinary crash is not evidence about quota, which is also pinned. Nothing is invented: a project that has pinned no builder gets no machine in the sentence, and an agent with no model choice gets no empty slot. On the standing model instruction — Opus preserved, Fable excluded: there is nothing to exclude. `fable` does not appear anywhere in this repo (the two grep hits are the word "undiffable"), and this change adds no model list of its own; it renders whatever the agent registry already offers. Tests: 7 cases, proved by mutation — dropping the sub-cent branch fails with actual '$0.00'. tsc clean, lint 0 errors, check:design ok, test:unit 205/205. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
46ea5d57a5 |
fix(loki): a severed answer looked exactly like a finished one (#793)
Found by using the chat. Asked Loki a question on prod; it answered in 10.8s and the reply ended mid-word: - The active Claude sessions reported right now are running on `research- An unclosed backtick, a dangling hyphen, and nothing anywhere saying the answer was incomplete. The stored row is 243 chars and genuinely ends there, so this was severed at generation, not at render. `grep -rn finish_reason src/ home/` returned ZERO. The field rides the same frames this code already parses for `usage` — the one field that separates a finished answer from a severed one — and both readers dropped it: readBufferedBody destructures only `message`, readStreamedBody only `delta` and `usage`. So there was no way for anything to know, and a fragment was stored, billed, and rendered exactly like a complete reply. This is not new. `frontier/propose.ts` carries a comment about an answer "cut in half. Observed in prod at maxTokens 3000", worked around by raising a number rather than by noticing the condition. And sse-stream.ts opens by warning that "a stream that drops frames does not fail — it silently truncates an answer", then never reads the vendor's own statement about it. What this does NOT do is guess. It reads the reason, classifies it, and says so. `cutOff` is carried on the turn but nothing renders it yet: what a severed answer should LOOK like is a product decision, and the grounding `Violation` channel that would be its natural home is owned by @bitbaum/ai-kit, so widening that is a change to make there, deliberately. Three rules worth keeping, each pinned: - ORDERING. The frame carrying `finish_reason` routinely carries an empty delta, so the stop reason must be read BEFORE the `if (!delta) return` guard. Read after it, the field is dropped and the answer looks whole forever — the original bug, reintroduced. - SILENCE IS A THIRD STATE. A vendor that omits the field has told us nothing. Reporting that as a problem would fire on every quiet provider, and a warning that always fires is one nobody reads. - AN UNKNOWN REASON IS SUSPICIOUS, NOT FINE. Vendors add stop reasons; a new one meaning "cut off" must not read as healthy merely because the switch predates it. Unrecognised values are surfaced verbatim, named. Measured before writing any of it: 1 of 183 stored assistant replies is truncated — this one. Rare, which is exactly why it needs a machine to notice rather than a reader. (My first detector claimed 28; it was wrong — 11 of 12 samples simply ended with a URL. The honest count came from reading them.) Proved by MUTATION, both ways: moving the read below the delta guard fails 2 of 9 cases; defaulting an unknown reason to "fine" fails 1. verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (10), check:desktop, test:home 140/140. test:unit 203/205 — activity-time-zone-stable and telegram-allowlist fail with "probe failed:" and an empty reason; both need a live server and this diff touches neither them nor anything they import. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
2d80b507ef |
fix(feedback): ask where a run ACTUALLY went, not where a new one would go (#792)
Risk 3 of the 2026-09-17 review: "Feedback attach-work falls back from closed pending command to current project routing preference. A current setting cannot prove where a historical attempt ran." Exactly right. The channel resolution was: pending row (open) ?? pickDispatchChannel(project) The open row is gone for most of a run's life — the runner stamps executedAt on its inject-ack, within ~8s of injecting — so in practice the second half decided almost every finished run. And that half is a LIVE PREFERENCE. Flip a project from This computer to Cloud and every finished local run starts claiming it ran on the box, with its offline verdict computed against a machine it never touched. The fix needed no new state, because the record already existed. The executed pending_commands row carries the channel it was handed to, in its payload, and getInjectAcksByRunIds was already reading exactly those rows for the same runs — it just never selected the field. So the immutable execution identity of the attempt was one property away the whole time. Now the order is an order of EVIDENCE: 1. the open pending row — this attempt, right now 2. the executed command — this attempt, recorded when it was handed 3. the project's setting — where a NEW dispatch would go today Only the first two are about the attempt being described. The third stays as the last resort because a run that never reached a builder has no recorded channel at all, and there the dispatcher's own rule is the best available guess. The channel lives in the jsonb payload rather than a column, so it is validated the same way the open-row reader already validates it: an unrecognised value is not a channel. Tests: two cases — a project now set to Cloud whose attempt ran local (the recorded fact wins, and the offline verdict follows it), and an attempt with no recorded channel (falls back). Proved by mutation: restoring the old expression fails "the recorded attempt outranks the project's current preference". tsc clean, lint 0 errors, test:unit 204/204. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
7cbdbf0db5 |
fix(providers): scope the installed list to the builder that would run it (#790)
Risk 2 of the 2026-09-17 review: /api/providers read
getRuntimeSnapshot(userId) — no channel.
That function's own doc says what the channel-less form returns:
"whichever channel pushed last". Both builders push their own row every
~5 minutes, so which machine's capability report the chooser saw was
decided by a race between two heartbeats. A cloud push could make a
laptop-only agent read "not installed"; a laptop push did the same to
the box. The chooser DISABLES rows on that evidence, so this was a
confident claim about a different computer.
The project already knows where it would dispatch —
pickDispatchChannel() is the SSOT for that decision — so now we ask that
channel. Without a project there is no "the" builder, so the honest
input is the union across this user's builders: an agent installed on
ANY of them is launchable somewhere, and only an agent no builder
reports is genuinely absent.
Unknown stays unknown. No row for a channel means null, not [] — the
three-state rule this module is already built on. Rendering silence as
"none installed" would disable every alternative, which is the one
control the operator came to that row for.
And the claim is now stamped. `evidence: { channel, observedAt }` rides
along, and the chooser says "Installed list as observed on This computer
(Fleet Runner), 4m ago" — or, when nothing has reported, that
availability here is unknown rather than empty. A capability claim with
no machine and no time reads as "true now, everywhere"; it is neither.
Lint caught a real defect mid-change: describeProviderEvidence took a
`now` it never used, because the phrasing comes from timeAgo(), which
reads the clock itself. A parameter the function ignores is worse than
none — it makes a test look deterministic when it isn't — so it is gone
rather than papered over with an underscore.
Tests: three cases, proved by mutation — disabling the unknown branch
fails "The input did not match /unknown, not empty/". tsc clean, lint 0
errors, test:unit 204/204.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
14967a376d |
fix(feedback): a run that streamed and then went quiet is on an offline machine too (#789)
#769 removed "Open Terminal" from runs whose builder is offline, on the grounds that it points the operator at a PTY on a switched-off laptop. It guarded on `!lastProgressAt`, so it only ever reached runs that never streamed a byte. A run that DID stream and then went silent kept the old sentence — and the machine is just as off. The row read: Needs you · Open Terminal — or Retry Worked 32 min, silent 15 min Every word true except the instruction, which is the only part that asks the operator to do something. Freshness has already expired by the time this branch is reached, so the silence is not the agent thinking; when `builderOffline` is also true, the machine carrying it is gone. Now it names that, and asks for the thing that would actually help: Needs you · Open Fleet Runner on This computer — or use cloud builder, then Retry Worked 32 min, then the This computer (Fleet Runner) builder went offline — silent 15 min. The diagnostic is observation only. Whether the work survived on that machine is not something this can see, so it does not say — it reports what the run achieved before the builder vanished and how long ago. The ask is identical for both offline readings (only the history differs), so it now lives once in `builderOfflineAsk` rather than being typed twice and drifting. An online builder is untouched: the existing "Open Terminal — or Retry" reading still fires, and its test still asserts `watchable: true`. Tests: two cases, local and cloud, proved by mutation — disabling the new branch fails with "must not send the operator to a terminal on an offline machine: Open Terminal — or Retry". tsc clean, lint 0 errors, test:unit 204/204. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
507a8d9066 |
fix(terminal): the empty terminal offered to start an agent in the wrong project (#788)
Found by using the page. The Terminal was scoped to `loki` — the breadcrumb said `loki`, and the Profile/Chat/Control/Terminal strip linked to `/control?focus=loki` and `/loki?project=loki`. Two inches below, in the same render: "Open on Control" -> /control (scope dropped) "Ask Loki" -> /loki (scope dropped) the launch form -> "Bitbaum" (first project in the list) So the one obvious button on an empty terminal would have started Claude in the wrong repository, and nothing on screen said so. The cause is that this screen had its own idea of "the current project": the ATTACHED tab, which is null exactly here — nothing is running, that is why the empty state renders at all. Everything derived from it quietly lost the scope the page was still displaying. The page already had the right answer. `fleet-context` is the SSOT the tab strip reads, and TerminalSurface already WROTE to it (rememberFleetProject) without ever reading it back. So this is mostly deletion: the reader is extracted from FleetSurfaceGuide into useFleetProject() and used in both places, rather than copied into a second one. Two details worth keeping: - The launcher DERIVES its selection instead of seeding useState. The scope is null on the first render (it comes from a store the server cannot read) and real a tick later, so an initialiser would capture the null and go back to picking the first project — the bug, reintroduced by the fix. Same shape the agent select already used: the operator's own pick wins, and until they make one the scope answers. - A project in scope but not launchable is still not pre-selected. `launchable` is filtered to projects with a linked directory; offering one without would draw a button that fails every time. preferredLaunchProject is pure and exported so the rule is pinned without React — the defect is invisible to any test that renders nothing, and reads as a styling choice on screen. Proved by mutation: restoring the old rule fails 2 of the 5 cases with "expected loki, got Bitbaum". verify: format:check, tsc, lint (0 errors, 2 pre-existing warnings), check:design (10), check:desktop, test:home 140/140, and every check:*/gate member green. test:unit 200/202 — activity-time-zone-stable and telegram-allowlist fail with "probe failed:" and an empty reason; both need a live server and this diff touches neither them nor anything they import. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
1cc39fb361 |
feat(events): a weekly scout for what is worth going to (#787)
The operator asked to hear about events worth attending instead of finding them by accident after they had happened. Finding events is the easy half; sending a message that is still worth opening in week six is the hard one. So the shape is borrowed from what already works in this repo rather than invented: ONE MESSAGE, NOT ONE PER EVENT. The 2026-08-05 disk-alert storm (40 pings in three hours) is the standing lesson about per-item notification. EVERY LINE IS ACTIONABLE. Each suggestion is a real draft in the approval queue with its own one-tap Approve link, so "that looks good" is a tap and it is in the calendar — not a link to a listings page and a note to self. The queue, the signed links and the booking drain all already existed and are already proven; the scout's whole delivery story is "write a draft". A CLASH IS NAMED. Each suggestion is checked against the calendar mirror, so a Thursday gig that collides with an existing meeting says so before it is accepted rather than after. FOUR DECISIONS WORTH THE REVIEW: 1. SEARCH COMES FROM ai-kit/web. fleet/SHARED.md owns this and says plainly: do not hand-roll fetch-and-summarise. That package already has the backend chain (self-hosted searxng → brave → tavily), an SSRF-safe reader for urls the MODEL chose, and a three-valued answer. `could_not_look` is not `nothing`: a dead backend must never be reported as "there are no events in Zurich this week". Writing a second client here would have reinvented that bug — and memory already records the specific shape (a stock searxng answers JSON with 403, which reads as "no results"). 2. ONE MODEL CALL PER RUN, NOT ONE PER RESULT. Extraction has to be a model — snippets carry dates as prose, in two languages — but the AI budget is rationed and shared across ten apps, so per-result extraction would spend a day's allowance on one digest. Every snippet goes into a single batched call. 3. THE MODEL IS NOT TRUSTED ABOUT TIME. It is told today's date and told that omitting is always correct; whatever comes back is screened AGAIN in pure code, which drops undated, past and out-of-horizon entries regardless of what it claimed. This is not hypothetical: the first search run while building this returned a Zurich meetup dated September 2025 as its top hit. 4. THE CAP IS THE PRODUCT. The operator selected all four purposes, so ranking cannot lean on exclusion — six per week is what stops a curated handful becoming a feed. Better to miss a good event than to send the message that teaches him to swipe past the next one. Rejections are the memory: a suggestion turned down is never proposed again, however it is spelled, so the operator says no once rather than every week. Tests: 21 cases on what reaches the digest, written from the side that hurts — the guessed date, the duplicate, the rejected thing returning — with the real 2025 listing as a fixture. The cron installer gains a weekly OnCalendar form (existing daily/hourly entries expand exactly as before) and the scout is added to the one list that both writes AND enables timers, because listing a job twice is how one gets a timer and never runs. Deliberately NOT built: a separate same-day reminder. Approved events go into Google Calendar, which already reminds; a second notifier would be the second one of something that works. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |