Run status now reconciles with the runner (lib/run-status), once, in the
run-track loader that /api/control/sessions, Watch and the run and command
routes all read:
- an open run whose agent the runner no longer has (a fresh snapshot taken
after delivery does not list its tab, or the runner reported the agent
exited) is Failed, cause agent_gone, "Agent exited without answering;
Retry" (botsmann 51bbcc27 and loki 3a5a7c2b read Needs you with nothing
listening);
- a finished run is Done or Failed, keeping what is left to do with its
change in nextAction (six sessions read working weeks after their agents
finished);
- the run and command routes take the run's status over the track's live
word, so they cannot disagree with the session list.
A pull request the agent named in its handoff and opened during the run is
the run's even on a branch the runner never saw: an agent working in its own
worktree pushes from another branch than the session's checkout, and run
57632eae's track said "Nothing reached GitHub" beside loki#1747. Loki still
acts only on pull requests from the run's own branches.
Traced 2026-11-12. On the cloud builder tab-inject queues a task that the
claim gate holds while an earlier run of the project is open (so it never
types into an agent mid-task), but it answered only ok, and the walk said a
running session gets the prompt typed into it. A prompt for a plain shell
was queued and answered 200, then refused by the runner.
- tab-inject: a task held behind an open run answers heldBehind (runId,
startedAt, label) and a message, read with findQueueBlockers, the gate's
own predicate; a prompt for a shell is 403 before anything is queued
- LOOP-WALK: 'give it a task' says it waits its turn; 'type into it' says
how to send a message mid-task (bracketed paste, then Enter); open-tabs
names are lowercase; the shell refusals are the real statuses
- scripts/test/session-walk-truth pins the routes and the text together
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
Co-authored-by: Claude <noreply@anthropic.com>
* feat(sessions): a token reads its sessions and what was said in them
An agent that starts Claude Code in a Loki session (tab-inject) could read
the screen (#1641) but not the conversation: the parsed transcript was only
readable over the cookie-only transcript stream, and since #1644 over
OrangeCat's signed rail.
- lib/session-reads: the list, one run, or one project with the last things
said in its conversation, moved out of the signed route unchanged, so two
doors share one copy
- GET /api/control/sessions: the same reads with a session or ck_ token
(?project=, ?runId=, ?items=), no-store
- every row names its session and carries openUrl, the same session in
Loki's Terminal on that run (lib/dispatch-card sessionOpenUrl)
- the list says it is cut at 25 and carries total, so a cut list is never
read as the whole one
- LOOP-WALK's Session walk names the read; tests pin both doors to the one lib
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
* fix(sessions): the conversation read is current, on the session's builder, and never ends a person's view
Traced end to end before merge (2026-11-12):
- a cached conversation was served forever: after the first read sent
peek_stop the runner stopped streaming, so a later read returned the same
copy without the agent's answer. The cache now counts only while someone
is watching; otherwise the read waits for a frame posted after it asked.
- peek_start and peek_stop carried no channel, so the owner's laptop runner
could take a read meant for the cloud session (transcript null). They now
name the project's builder (projectPreferredChannel).
- the read counted its viewer under a key of its own, so its peek_stop could
end a person's live view of the same session on a phone. It now shares the
Terminal's viewer count (same user, tab and channel).
- a cloud link carried no source, so a phone that last chose 'Your computer'
opened the laptop's session of the same name. sessionOpenUrl names the
cloud builder, and each row's link uses the session's builder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(runs): whose pull request it is, after the review of #1643
A review of the merged attribution change found the remaining ways a run
could claim, or act on, a pull request that is not its own:
- The fix ledger decided "this run's" by time alone, and on that basis
could merge (auto-ship) or put back into draft a pull request somebody
opened on another branch, when the handoff named it. auto-ship
prOwnership: Loki acts only on a pull request on one of the run's own
branches; it reports one as the run's when it is on them, or, for a runner
too old to report branches, when the handoff names it.
- Evidence recorded before #1643 was never checked again, so run 70d1a78d
kept loki#1636. It is checked with GitHub once and removed when foreign;
Watch no longer falls back to evidence the ledger called foreign, and other
views do not trust unchecked old evidence.
- The window had no end, so an earlier run sharing a branch with a later one
claimed the later run's pull request. It ends 15 minutes after the run.
- Only the ten newest pull requests were scanned; a busy repository pushed
the run's own off the page. Pull requests are asked for by head branch.
- Legal branch names with # or + were dropped. The rules are git's.
- The runner also reports the remote branch a checkout pushes to, skips the
repository's default branch whatever it is called, and its exit and
shipped beats carry the branch. Runner 0.8.69.
scripts/test/run-evidence-ownership.ts.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj
* fix(runner): a run closes as shipped only with a pull request opened during it, and only then stops the agent
The runner's idle check took any open or merged pull request on the branch
the agent sat on. A session that carries on from an earlier run sits on that
run's branch, so a read-only probe was closed Done with the earlier run's
pull request, and the runner stopped the shared session whatever the server
answered (also when the run had already been closed another way).
- findShippedPr takes the run's start; a pull request opened before it is
not this run's.
- The server says closed: true when the beat closed the run; the runner
stops the agent only then.
Found by a review of the probe path (2026-11-12).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(inject): a read-only probe ends Done on the builder it asked for, and a refusal by choice is not a failure
Found by a review of the probe path end to end (2026-11-12):
- Every run's status went through the feedback-fix mapper, which calls a
run that finished well with no pull request "Needs you, nothing shipped".
A git status probe ended there. Only a feedback fix owes a change; any
other run that finished well with nothing pushed is Done, cause
finished_no_change (canonicalStatus expectsChange, from run-track-load).
- Neither POST /api/inject nor MCP loki_dispatch could ask for the cloud
builder: zod drops unknown keys, so builderChannel vanished without a word.
Both take it now (builderChannel / builder).
- A fresh session refused for lack of a free lane was closed as a failing
run and advanced the escalation ladder; four of them paged the owner with
no agent ever run. That refusal no longer counts.
scripts/test/probe-path.ts.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj
* test: two text pins follow the new shape of the inject route and the refusal close
busy-placement read the inject route's call on one line; refused-dispatch-
closes-run read closeRunUndelivered with a one-key options object. Both still
assert the same thing: the route passes session on, and a refused dispatch
closes its run quietly before the failure is reported.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj
---------
Co-authored-by: Claude <noreply@anthropic.com>
#1643 tied live evidence to the run's branches, but the track's own read of
the repository (lib/repo-progress) still took the newest pull request opened
since the run began, and the newest push. That read is where run 70d1a78d's
"Pushed: <#1636's commit>" and its pull request came from (2026-11-12).
- readRepoProgress takes the run's branches; a pull request's head and a
pushed ref must be one of them.
- run-track-load passes runBranches(run).
- scripts/test/run-branches.ts replays the incident against repo-progress;
the three new checks fail on main and pass here.
Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj
Co-authored-by: Claude <noreply@anthropic.com>
* feat(sessions): starting a session answers with where a person opens it
An agent that starts Claude Code in a Loki session hands the owner the
session to look at, on a phone or a computer. The Terminal's address was
built only inside the app's own cards, so a caller had to guess it.
- lib/dispatch-card sessionOpenUrl: the full link to the session in Loki's
Terminal, on that run when there is one, This computer for a local one
- tab-inject (live, dispatch, queued), /api/inject and MCP loki_dispatch
(through inject-core, a parallel lane included) and agent/launch return
openUrl
- LOOP-WALK's Session walk says so; scripts/test/session-open-url pins it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
* fix(sessions): a session's link names its builder
A cloud openUrl carried no source, so the Terminal opened whatever source
that browser last chose: a phone that last picked 'Your computer' opened the
laptop's session of the same name instead of the cloud one the agent drove
(traced 2026-11-12). sessionOpenUrl now says source=cloud for the cloud
builder, and the screen capture's openUrl (POST /api/control/peek-tab) is
the same full link instead of a bare path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
---------
Co-authored-by: Claude <noreply@anthropic.com>
Over MCP an agent could send a task to a project's agent (loki_dispatch) and
was told not to poll: it had no way to see that the session was up or to
read what the agent answered. The HTTP side got both for a token in #1641.
- loki_sessions: agent sessions open on the owner's builders, each with the
link that opens the same session in Loki's Terminal. Plain shells are
never listed.
- loki_session_read: the end of one session's terminal output as plain text
(escape sequences removed, redrawn and repeated lines collapsed). Queues
the same peek_tab command as POST /api/control/peek-tab and waits up to
twenty seconds; a builder that does not answer is an error that says so.
A plain shell is refused before anything is queued.
- both read only, so both sit under loki.chat, as the scope rule requires.
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
Co-authored-by: Claude <noreply@anthropic.com>
A QA bot files through POST /api/projects/<id>/feedback with its own seat's
token. A person's OrangeCat bot has no Loki token: it acts over the signed
rail as the Loki account linked to its owner. It had no way to file.
- lib/feedback/agent-filing.ts is now the one body of a machine filing and of
a report's status read (moved out of the two routes, unchanged in what it
does: rate limit, idempotent replay, source agent, the owner's opt-in
build; the two status shapes by seat)
- POST /api/orangecat/feedback: signed, fresh, the linked account, a project
by name that the account has a seat on. A filing (words only) answers like
the seat door; { feedbackId } reads the canonical status
- no second inbox and no second contract: both doors call the same body
Claude-Session: https://claude.ai/code/session_019MDtmsQh5BSKKaJXnf4KjU
Co-authored-by: Claude <noreply@anthropic.com>
/api/orchestration/runs/<id> and /api/control/commands/<id> answered status
"delivered" / "working" while track.summary in the same response said
"Waiting for a runner" (2026-11-12). The word came from the command row, the
sentence from the run's events, and the run route treated every run as
executed and verified from the moment it was opened.
- RunTrack.live: Queued, Starting, Working or Needs you, decided in the same
order as the track's summary; null once the run has finished.
- alignLiveViewWithTrack: while a run is open, both routes return status,
label, detail and tone from the track.
- An open run is never "Delivered to agent" on a runner's ack alone: it is
Starting until the agent prints after the prompt, then Working.
- The run route reads the run's own command row instead of assuming it.
- scripts/test/one-run-status.ts replays both contradictions.
Co-authored-by: Claude <noreply@anthropic.com>
* fix(runs): a pull request is a run's only when it is on one of the run's own branches
Run 70d1a78d on loki ran git status and nothing else; its page claimed
loki#1636 as its pull request and "Pushed:" with that pull request's commit.
#1636 was opened by hand on another branch while the run was open. "The
newest pull request since the run started" is a time window, not an
attribution.
- lib/run-branches: a run's branches are loki/run-<id8>, its worktree branch,
and every branch its runner reported the agent's checkout on. Never main.
- findRepoWorkEvidence takes those branches; a pull request's head or a
pushed ref must be one of them. Watch, the reaper's correction and the
outcome post all pass them.
- The runner's progress beat carries the checkout's branch; the server keeps
the list on the run (payload.branches).
- The two branch names have one source; the builder code re-exports it.
- scripts/test/run-branches.ts replays the incident against the real finder.
* chore(runner): 0.8.66 with its release note
---------
Co-authored-by: Claude <noreply@anthropic.com>
An agent could start a project's coding agent in a Loki session, type into
it and close it with a ck_ token (tab-inject, tab-inject-raw, close-tab),
and could even ask for a capture of its screen (POST peek-tab), but the
list of open sessions and the capture's answer took a browser session only.
It could not see that the session was up or read what the agent answered.
- GET /api/control/open-tabs takes a session or a token
- GET /api/control/peek-tab/[id] takes a session or a token, no-store
- POST /api/control/peek-tab takes an optional channel and returns
resultUrl and openUrl (the same session in Loki's Terminal)
- a plain shell's screen stays a signed-in browser's: a token gets 403 on
asking and 404 on reading (lib/peek-access)
- LOOP-WALK gains the Session walk; scripts/test/agent-session-read pins it
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
Co-authored-by: Claude <noreply@anthropic.com>
A Viewer or Reporter seat polling an archived report read 'the project's
owner or an editor has to act on it. Poll again later', and one marked done
without proof read 'needs the project's owner'. Nobody is going to move a
closed report. seatStatus now says so for closed_without_change and
done_unproven: who nobody, kind none, and what the filer can still do
(look at the live page, file a new report). Open reports are unchanged.
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
Co-authored-by: Claude <noreply@anthropic.com>
GET /api/feedback/[id]/status gave a non-owner seat only {state, label}, so a
machine filer saw "Needs you" with no cause and no reason. seatStatus adds
cause, reason and a non-dispatching next step, still with nothing of the
machine; filing still starts no build.
Claude-Session: https://claude.ai/code/session_019MDtmuwGtV473C5Jg3NXEZ
Co-authored-by: Claude <noreply@anthropic.com>
* docs(feedback): machine filer role and the scripted agent walk
Adds the machine filer to the LOKI-WORKS roles table and an Agent walk to
LOOP-WALK with the exact filing contract (seat token, idempotency, statusUrl,
canonical states, build opt-in default off). scripts/walk/agent-walk.mjs files
as an agent from the environment, polls statusUrl and never prints the token.
Claude-Session: https://claude.ai/code/session_019MDtmuk1DzMJHBJdsDfRhG
* docs(walk): statusUrl must share the LOKI_URL origin or the walk exits 3
Claude-Session: https://claude.ai/code/session_019MDtmuk1DzMJHBJdsDfRhG
---------
Co-authored-by: Claude <noreply@anthropic.com>
Failed and Needs you always carry a reason and an exact next action (with the
dispatch call). Done needs PR, merge, deploy and a live URL, else Needs you
(done_unproven, with what is missing). Closed without a change is Failed, not
a Done with empty evidence. Reporter state now reads the same live URL.
Claude-Session: https://claude.ai/code/session_019MDtmuk1DzMJHBJdsDfRhG
canonicalStatus() maps work.phase to the six statuses of RUN-STATUS-SSOT
plus cause, nextAction and evidence. GET /api/feedback/[id]/status serves
it (owner/editor in full, other seats the state of their own report),
Watch carries status.canonical, the reporter view carries state only, and
the agent filing route's statusUrl now points at the status route.
* feat(runs): one delivery track everywhere — the chat card draws the same track as Watch
The chat card under a dispatch had its own list (run-milestones: picked up →
pushed → PR → checks) and Watch had the delivery track, built from
different facts, so moving between the two screens meant reading two
stories about one change.
- lib/run-track-load: the one loader every run surface calls — events,
the runner's snapshot, what was asked, the branch or pull request on
GitHub while the run lives, the commits and checks behind it
(lib/repo-progress, was run-milestones-fetch), and after the run the
fix ledger through merge, deploy and Loki's look. Owner-only for anything
that reaches GitHub or the budget; never from a timer.
- The Watch route and both live-status routes the chat card polls carry
`track`; RunMilestones and the follow line are gone.
- lib/run-track: commits ride the working stage as facts ("Pushed: …", in
the builder's words); a red check is the merged stage in the needs-you
state, a green one "Checks passed — merging", before the ledger catches
up; the pull request's number and title come from the repository too.
- components/projects/RunTrack: `collapsible` — a settled track in a chat
thread folds to its one sentence and opens on a tap.
- components/projects/RunLook: the page before and after, side by side,
under the track in chat and on Watch (the before picture #1238 keeps).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67
* refactor(run-follow): drop followRun — every surface reads the ledger through loadRunTrack now
The dead-exports ratchet caught it: nothing referenced the follow-only
wrapper once the live-status routes moved to lib/run-track-load.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(watch): time on every stage, a tap for the facts, one card for the whole run, the walkthrough
The delivery track (#1236) said WHERE the change was. The owner, watching
the next run the same afternoon: "it would also be cool if there's some
time taking … how long each step takes or has taken by the moment I'm
looking at it. Maybe clicking on it and seeing what's going on would be
nice too" — and "smooth movement between different screens; if it's
working on something I should be able to see how it's working on it".
- Every stage carries `at` and `facts`. The page shows "took 1m 20s" on
each stage behind, a one-second clock on the one happening now, and the
time of day otherwise (lib/run-track: stageTimings, formatStageSeconds —
pure, tested). A tap opens the row: which builder claimed it and when,
when the request was delivered, when the agent started and last printed,
the pull request by number, the merge, the deploy run, what Loki saw on
the live page. The working row shows the agent's screen as Watch last
peeked it, so "is it working?" has the screen as its answer.
- A pull request that exists while the agent is still in its session now
reads "Claude Code is finishing up" (now), not "made the change" (done)
with nothing happening — a live track always has a stage marked now.
- One card for the run's whole life (ProjectWatchLive, keyed by run):
waiting → working → on its way → live/stopped. The old split into a live
card and an outcome card unmounted one and mounted the other, so the
page jumped at the moment the person was watching most closely. Marks
and labels transition instead of snapping.
- The Walkthrough: the pull request's own account (lib/feedback/fix-note —
problem, change, where, who it helps, why, alternatives, for us,
downsides, costs, proof, left for later) plays on the card once the run
is done. Every project dispatch now asks the agent for it (dispatchClosing
carries fixNoteInstruction), not only visitor fixes.
- The fix ledger records when the deploy run last moved (deploy.at), so
"live" has a time; GitHub's updated_at is read for it.
Checked in a real browser with the bundled components: the clock ticks,
rows open, no horizontal overflow at 390px, light and dark.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67
* test(watch): the browser fixture mounts the one-card Watch with its new props, and checks the track's clock and tap
terminal-clean-browser mounted ProjectWatchLive with the props the split
card had (working/startedAt), so the unified card's kicker looked up an
undefined phase and the page threw. The fixture now passes phase/track/
follow/walkthrough, and a second mount carries a track whose builder
stage is happening now: the row wears a running clock and a tap opens
the facts behind it, at 320 and 390px with no sideways scroll.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67
---------
Co-authored-by: Claude <noreply@anthropic.com>
The owner sent a one-line change to petvity from a phone, watched "Claude
Code is working · started just now" under a narrated headline that
paraphrased the request, and did not believe it: "I'm not sure if it's
being done or not, and I don't really have faith in it." Six minutes in,
GitHub already held the branch and the pull request; eleven minutes in it
was merged, deployed and live. Watch said none of that — it narrated, and
when the run closed it stopped at the agent's summary, on a change that was
still a pull request. The facts existed (run events, the fix ledger, the
repo) and were never put on one line a person could read top to bottom.
Now every run draws the same six stages, each done / now / next / needs you
/ failed on evidence only — an event, a URL on GitHub, a deploy run, never
the clock — with one sentence for the whole:
You asked → A builder picked it up → Claude Code made the change →
Pull request opened (link) → Checks passed and merged → Live on <site>
(link, and what Loki saw when it opened the page)
- lib/run-track (pure, scripts/test/run-track.ts): the stages and the
sentence, from run events + the fix ledger + repo evidence.
- lib/run-evidence-live: while a run is live (or closed well with a blind
ledger), ask GitHub for the branch or pull request inside the run's
window — at most once a minute per run, only for a page someone has
open — and record it as payload.evidence, the key the reaper writes, so
the ledger can follow a pull request the handoff never named instead of
reporting "nothing reached GitHub" beside a merged one.
- github-evidence: skip bot pull requests and pushes. Dependabot opens on
its own clock; "Pull request opened: bump 24 packages" about a font-size
change is worse than nothing.
- /api/projects/[id]/watch carries `track`, `following`, `follow` and
`liveUrl`; followRunLedger returns the ledger beside the follow line, and
RunFollow carries its state. The payload type now declares `fix`.
- Watch: the track sits under the narrated headline while it works, and an
outcome card (sentence, track, "Open the live page", Loki's picture)
replaces "Finished" after. The page polls every 10 s after the run
closes until the track settles, and not after.
- ui-track-* in globals.css; docs/foundation/RUN-STATUS-SSOT.md gains the
track's stage/evidence table.
Checked at 390px light and dark and 1024px: no horizontal overflow.
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67
Co-authored-by: Claude <noreply@anthropic.com>
Align Feedback ↔ Terminal to RUN-STATUS-SSOT: Working only when inject is
verified generating or a generating/progress hop lands after the prompt;
inject-no-generate → Needs you with Open Terminal / switch provider / Restart
Fleet Runner. Stamp injectVerified on runner ack; expand quota chooser to
Claude Code, Codex, Cursor, Grok, Antigravity (no Hermes). Prefer cloud-first
always-on box-runner; do not expand dual-channel status language.
Terminal is a ~60/40 PTY and Loki rail on the same run id Watch
follows. The rail shows phase, stall, and next action from run
events — not a log dump — with Ask vs Inject into this session,
PTY-byte ack after inject, and Grok/Cursor/Antigravity when quota
dies. Mobile opens the same rail as a bottom sheet. Empty Terminal
names Fleet Runner vs Kitty. Implement's Terminal link carries ?run=.
* docs: Loki foundation redesign (harness, AI, Robots, chrome)
SSOT for Cato’s 2026-09-16 program: honest run states, AI providers tab,
Robots foundation, OrangeCat-class chrome. Public name Cato only.
* docs: loop-first implement order (FleetCrown must work before polish)
Cato: P0 Implement honesty + visible Watch/Terminal + live Cloud provider before AI/Robots/chrome.
* docs: use Loki not retired FleetCrown name in foundation order