Both close notifications — the outcome turn in /loki and the push/Telegram
message — read only `payload.resultText`. The hosted runner and openclaw set
it. The local PTY path, which is the one a person watches after typing into
/loki, does not: it closes from the agent's session handoff, and the agent's
own words land in `summary`.
So the main path reported "🟡 **loki** — partly done." and nothing else. The
agent had written `done: e2e ok — no changes`, the judge had written exactly
what it found missing, and none of it reached the thread — which is the trip
out of the product this message exists to prevent.
One shared `runReportText` now answers "what did the agent say", preferring a
runner's own result text and falling back to the handoff: `done`, plus `next`
when it holds something, because on anything short of success `next` carries
the definition-of-done gap and the gap is what the operator must act on.
And the live check stops asserting what its own prompt forbids. The probe says
do NOT change a file, commit, or open a pull request; the judge then correctly
grades the run partial for having no committed change; the check demanded a ✅
and so failed on a perfect run (2026-09-17, run 69cdbdb7: injected 11:56:11,
handoff "e2e ok — no changes" thirty-two seconds later, every leg working).
It now asserts the thing that actually proves the loop — the agent's own
handoff summary coming back into the thread — and still fails on ❌ or on a
turn that carries somebody else's words.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The window was twenty minutes and guessed. On 2026-09-15 a cold-start agent
on the box — fresh PTY, boot, trust prompt, then the task — wrote its handoff
at 13:44 for a dispatch injected at 13:23: twenty-one minutes to answer
`git status`. The check aborted at 13:43 and reported a broken loop that was
one minute from succeeding, which is the worst thing a health check can do.
Thirty minutes in the script, thirty-five on the box timer (the timer runs
six-hourly, so the extra slack costs nothing and the check must outlast the
slowest healthy path it exercises).
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Loki serialises per project: while a run is open, the next dispatch is HELD —
the run row is created, the assistant says "Dispatched", and no
pending_command is written, so no builder can claim it and no outcome can
arrive. Correct behaviour. From outside it is indistinguishable from a builder
that never picked the work up.
The scheduled check waited twenty minutes on exactly that and then reported
"First suspect: the box builder cannot authenticate" — while the builder was
fine and the blocker was the check's OWN previous run, left open when an
earlier invocation was killed. A check that poisons its next run and then
misnames the cause is worse than no check.
It now reads the absence of a commandId, aborts its own held run, and skips
with the real reason. The tell is durable: held = no command; stuck builder =
a command that is unclaimed or never acked.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two ways this check lied about a working product, both found by running it on
the box rather than by reading it.
It printed `still ?/- after 20 min` when a dispatch produced no outcome turn.
`GET /api/orchestration/runs/[id]` answers the DERIVED dispatch view
(status/label/terminal), not the raw row, so reading it as {state, outcome}
told nobody anything — exactly when the diagnosis mattered most. It now reads
`status` + `terminal`, so a closed run with no turn is named as a lost
notification and an open one as a stuck builder.
And it FAILED "knows the fleet" when Loki correctly answered "You've used your
share of today's free AI budget for now." The free tier is rationed by design;
on a six-hourly timer with Telegram on flip, that pages for a healthy product
until the alerts get muted. A test against a rationed dependency needs three
verdicts, so there is now SKIP-with-reason: it does not fail the run, it says
why, and it never retries a rationed refusal (which would only spend the next
window too).
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
A hosted dispatch ran, Hermes did the task, the run closed `done/success`
with its summary — and the conversation that asked for it never heard a word.
Nothing errored. Nothing logged.
`updateOrchestrationRun` fires `void notifyRunClosed(...)` — its contract is
never to slow a close — and that call is what writes the outcome turn. The web
server outlives such a promise for free. `hosted-runner.ts --once` is a
45-second cron tick: it drained the command and called `process.exit(0)`
while the write was still in flight.
- settle-background-work.ts: a bounded drain window (5s,
HOSTED_RUNNER_DRAIN_MS), paid only by a tick that actually drained
something. A window rather than a promise registry, because the void-call is
this codebase's convention at dozens of sites and threading bookkeeping
through all of them to repair one process boundary is the larger change.
- loki-loop-e2e.ts now reads the run's state when no turn arrives, so the two
halves can never be confused again: a CLOSED run with no turn is a lost
notification (the work happened); an OPEN one is a stuck builder. That
distinction cost an hour today.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three testable meanings, one script, no browser and no mocks
(scripts/test/loki-loop-e2e.ts, run as the signed-in operator through the
same API the /loki page uses):
1. knows the fleet — a fleet-shaped question is answered from the studio map
(all three pillars named, fleet_map among the retrieved sources) and the
reply is an answer, not the model's plan for one;
2. publishes the map — /api/fleet/map is public with the pillars live, and
bitbaum's map.json is the same map, recently generated;
3. closes the loop (--dispatch) — a request typed into a thread comes back
into that thread as an outcome turn. A run that never returns is aborted
with a [loki-e2e] marker so no test leaves the operator's queue hanging.
Proven against production before commit: 3/3 without dispatch; with dispatch
and the builder unauthenticated, the loop failed honestly inside two minutes
with the runner's own diagnosis delivered into the thread.
Scheduled on the box every six hours (install-loki-e2e-watch.sh ->
loki-e2e-check.sh, alert on flip; the dispatch leg only when the builder-auth
probe last said ok). pnpm run test:e2e:loki runs it from a laptop.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>