mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:57:09 +01:00
The owner used Loki from a phone (2026-10-18) and could not tell whether
anything worked. Four separate faults, each passing every check:
The cloud builder ran code days behind the app. Its restart waits for
every agent to be idle, and autopilot refilled the queue the instant one
finished: ten consecutive deploys (23:38 → 09:12) found "2 agent(s)
working — deferring restart". Hence "Model: not known yet" of an answer
the screen was showing. Now, while the cloud runner's heartbeat version is
behind the deploy's, the commands route hands it no work-starting
commands (dispatch, launch_agent, auto_continue, browser_task) — a
person's own words into a session still go through — so the idle moment
comes, the restart lands, the queue resumes on the new code. Server-side
on purpose: a runner-side rule would have waited for the very restart it
was meant to allow. Control's builder line says "a newer version waits
for its agents to finish" meanwhile.
An agent renamed a preview site, committed, and reported "the work lives
only on this machine — tell Loki where this preview's remote should
live". The box contract says push or fail loudly; a preview folder is
served from disk and has no remote by design, so the change had been live
since the save and the owner read a failure and a chore. Every dispatch
to a preview folder now carries "Where this goes" (lib/previews/
delivery-note), and the contract has the same section.
The session sheet's Change and Set typed /model and /effort into the
terminal and closed; Claude Code drew its picker behind the conversation
and nothing on screen moved. Each row now lists its choices; a tap sends
the command with the choice named (/model sonnet, /effort high), the
sheet stays open and says what is changing, and settles when the log
names it. The sheet is built like the Settings sheet.
The session box had a 26px library button beside 44px round ones, a 36px
chip and a 34px Keys pill, the microphone second from the left in one
view and beside Send in the other, and "claude" on the tab beside
"Message Claude…". One row, one size, one order in both views; the
agent's name everywhere (terminal-strip-tabs badgeNames).
Widget: the owner's change list reads what needs them first (the line
counted nine, the list showed none); "9 needs you" → "9 need you"; a
failed call is named ("my call to Loki to save your note failed… Your
words are still here — press it again") instead of "one of my calls to
Loki failed — nothing for you to do".
Tests: runner-update-hold, preview-delivery-note, owner-changes-order,
session-sheet-browser (new); builder-presence, widget-changes,
widget-self-report, inject-context-boundaries extended.
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
Co-authored-by: Claude <noreply@anthropic.com>
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
/**
|
|
* A dispatch to a preview folder tells the agent the folder is the site —
|
|
* live on save, no remote, nothing to push (lib/previews/delivery-note).
|
|
*
|
|
* Run: npx tsx scripts/test/preview-delivery-note.ts
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { isUnderPreviewsRoot, previewDeliveryNote } from "@/lib/previews/delivery-note";
|
|
|
|
const root = "/home/ubuntu/dev/previews";
|
|
assert.equal(isUnderPreviewsRoot(`${root}/tsentr-som`, root), true);
|
|
assert.equal(isUnderPreviewsRoot(`${root}/tsentr-som/site`, root), true, "a subfolder counts");
|
|
assert.equal(isUnderPreviewsRoot("/home/ubuntu/dev/loki", root), false, "a repository is not one");
|
|
assert.equal(
|
|
isUnderPreviewsRoot("/home/ubuntu/dev/previews-old/x", root),
|
|
false,
|
|
"a prefix is not the root",
|
|
);
|
|
assert.equal(isUnderPreviewsRoot(root, root), false, "the root itself is no project");
|
|
assert.equal(isUnderPreviewsRoot(`${root}/x`, null), false, "no previews here: never claimed");
|
|
assert.equal(isUnderPreviewsRoot(null, root), false);
|
|
|
|
const note = previewDeliveryNote({
|
|
projectPath: `${root}/tsentr-som`,
|
|
liveUrl: "https://tsentr-som.orangecat.ch",
|
|
previewsRoot: root,
|
|
})!;
|
|
assert.match(note, /^## Where this goes/);
|
|
assert.match(note, /served straight from disk at https:\/\/tsentr-som\.orangecat\.ch/);
|
|
assert.match(note, /do not ask where the remote should live/);
|
|
assert.match(note, /Commit your work on the current branch/);
|
|
assert.match(note, /There is no delivery step after saving/);
|
|
assert.match(
|
|
previewDeliveryNote({ projectPath: `${root}/x`, liveUrl: null, previewsRoot: root })!,
|
|
/at its address/,
|
|
"no address recorded: still the truth about delivery",
|
|
);
|
|
assert.equal(
|
|
previewDeliveryNote({
|
|
projectPath: "/home/ubuntu/dev/loki",
|
|
liveUrl: "https://loki.orangecat.ch",
|
|
previewsRoot: root,
|
|
}),
|
|
null,
|
|
"a repository keeps the push contract",
|
|
);
|
|
|
|
// The box contract carries the same rule, in the file every box agent reads.
|
|
const contract = readFileSync("scripts/hetzner/box-agent-claude.md", "utf8");
|
|
assert.match(contract, /## A preview folder is the site/);
|
|
assert.match(
|
|
contract,
|
|
/never\s+add an origin, push, create a repository, or ask where the remote should\s+live/,
|
|
);
|
|
|
|
// And the dispatch assembler rides it on every prompt to such a folder.
|
|
const assembler = readFileSync("src/lib/inject-prompt.ts", "utf8");
|
|
assert.match(
|
|
assembler,
|
|
/previewDeliveryNote\(\{ projectPath, liveUrl, previewsRoot: previewsRoot\(\) \}\)/,
|
|
);
|
|
assert.match(readFileSync("src/lib/inject-core.ts", "utf8"), /liveUrl: dbMatch\.liveUrl/);
|
|
|
|
console.log(
|
|
"✓ preview-delivery-note: a preview folder is the site; the agent is told so on every dispatch",
|
|
);
|