Commit Graph
6 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.2 64e2c6b543 fix(builder, runs): a held task waits minutes and says so; a build says when it is live (#1663)
* docs(handoff): checkpoint for building with Loki and with a Cat bot

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

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

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

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

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

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

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

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

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

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

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

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

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:48:29 +01:00
CatoandClaude Opus 5.5 7d3559909d fix(runner): an agent in the project's own dispatch worktree is the project's agent (#1052)
The xhiva agent ran in ~/.loki/worktrees/<project>-2ba3ac62/<runId> while 'is an
agent running?' matched only the primary checkout. A working agent read as absent
everywhere: the build card said 'no agent has picked it up, starting again is safe',
Terminal said 'session ended', Ask left it out, and the run never closed.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 07:36:42 -07:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

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

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

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

* chore: teach git blame to skip the reformat

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

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
ecb45ff219 chore(agents): derive default models from adapter SSOT; prune unparsed narration mandate (#119)
* chore(agents): derive default models from adapter SSOT; prune unparsed narration mandate

- AGENT_DEFAULT_MODELS in agent-registry.ts duplicated each adapter's
  defaultModel (claude.ts, codex.ts, gemini.ts, cursor.ts, grok.ts).
  Now derived from the adapter registry via findAdapter — the adapter
  definitions are the single source of truth. All consumers
  (agent-preferences.ts, orchestration/run/route.ts) unchanged.
- Removed the forced opening line 'Picked <X> (T_); displaced <Y>.'
  from the three autopilot templates in prompt-library.ts (next_best,
  test_and_fix, quality). Repo-wide grep confirms nothing parses this
  line — it was pure narration, which current prompting guidance flags
  as counterproductive. The parsed session-handoff contract
  (status:/tsc:/lint:/tests: fields) is untouched.

Note: re-run scripts/generate-agent-prompts.ts after merge to refresh
~/.config/agent-prompts.json.

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

* fix(test): stop worktree-workspace test from hijacking the real repo under git hooks

When git runs hooks (husky pre-push), it exports GIT_DIR — absolute when
pushing from a linked worktree. The test's git child processes inherited
it, and absolute GIT_DIR overrides `git -C <sandbox>`, so every
'throwaway repo' operation silently targeted the REAL repository:
stray 'init' commits authored by test@test landed on real branches
(replacing the tree with the sandbox's app.ts), and the test's worktree
add/prune ops ran against the real repo. This is the likely root cause
of the known 'git user test wipes .claude/worktrees/*' hazard, and it
made any push from a linked worktree both destructive and red.

Fix: strip GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE/GIT_COMMON_DIR/
GIT_OBJECT_DIRECTORY/GIT_PREFIX from process.env before any git
subprocess runs. Verified: suite passes standalone and with a hostile
absolute GIT_DIR exported; real repo untouched in both.

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

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 16:38:24 +02:00
GandClaude Opus 4.8 856fa9a4c5 feat(dispatch): worktree-per-agent isolation (opt-in) (#64)
Each dispatched agent runs in its own git worktree
(~/.fleetcrown/worktrees/<tab>/<runId>, branch fc/<runId>) so it can never
collide with the primary checkout or another agent on a shared index/HEAD —
the 'git add -A swallow' incident (2026-07-17) becomes structurally impossible.

- src/lib/agent-execution/worktree-workspace.ts: pure module — create/attach,
  artifact symlinks (node_modules, .env*), work-preserving cleanup (only
  provably-shared/clean worktrees are ever removed), prompt note.
- poller.ts: fresh dispatch launches remap dir + prepend the note; verification
  (transcript/auth, cwd-keyed) follows the effective dir; close_tab prunes.
- Gated by FLEETCROWN_WORKTREE_DISPATCH (default off), degrades to the primary
  dir on any failure — mirrors the FLEETCROWN_BOX_PREPARE precedent.
- scripts/test/worktree-workspace.ts: 14-check net incl. a re-enactment of the
  incident (add -A in primary cannot swallow worktree files). 37/37 unit files
  green; tsc + eslint clean.

docs/architecture/worktree-per-agent.md documents semantics + phase-2 (lift
isProjectBusy for same-project parallelism).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 16:18:28 +02:00