Files
loki/scripts
CatoandClaude Opus 5 083cda1089 fix(control): name the signal that says a project is working (#775)
* fix(control): render verified runs as working

* fix(control): name the signal that says a project is working

Control rendered "Working · Live agent process detected" for a project
whose own /api/control reported agentRunning=false and activeAgents=[].
The badge was right — a hook-reported turn was open — but the reason
under it was invented, and an operator reading it goes looking for a
process that was never there.

isRunning had three causes and the evidence line asserted one of them
for all three. None of the three is a /proc scan:

  promptRunning     a dispatch sentinel exists (the code comment right
                    below it even says the process "may not yet appear
                    in /proc on the current tick")
  liveTurnRunning   the agent's own hook report of an open turn
  verifiedRunActive fresh PTY output on an unfinished run

`agentRunning` cannot stand in for the process either: the control route
ORs verifiedRunActive into it, so a verified run alone sets it. Where a
process and a run could both explain the state we report the run —
under-claiming, which is the safe direction.

One derivation now produces both the boolean and the reason, so the
badge and the line beneath it cannot drift apart:

  const runningEvidence = ... ;
  const isRunning = runningEvidence !== null;

RUNNING_EVIDENCE_LABEL is keyed by that union, so a fourth running
signal cannot be added without stating what it observed.

Also carries 6c30b29a forward: verified run output makes a project
Working rather than session-open. Before it, a verified run only moved
agentRunning in the API, which the presenter reads as "a process is
open" — so a real cloud run showed as idle.

Tests: three cases pinning the labels, each proved by mutation —
restoring the old single string fails "a live agent turn is reported as
a turn, not as a detected process" with the exact text Control showed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 10:24:19 -07:00
..
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00