fix(lanes): render undeclared lanes at their detected stage, quiet tmux polling noise

A lane whose sessions never call `ccam stage` had no declaration at all, so
its pipeline map stayed 100% pending even though detection was tracking real
progress. inferredDisplayStage renders such a lane AT its last detection
instead (display only — the DB's declared `stage` and detection-as-evidence
rules are untouched). Also stops tmux's own "no session" stderr noise from
spamming the journal on every poll.
This commit is contained in:
2026-09-03 11:28:06 +07:00
parent b27e679eac
commit 8711917d44
4 changed files with 78 additions and 11 deletions
@@ -25,12 +25,18 @@ const LIVENESS_DOT: Record<Lane["liveness"], string> = {
* ALIAS (`tests`, `booting`, `ship` — most of what the ship-feature skill
* declares) is not a node id, so indexOf answers -1 and a detection sitting
* well BEHIND the declaration would still be badged as the live one.
*
* `>=`, not `>`: an undeclared lane is rendered AT its detected node by the
* server (see `inferredDisplayStage`), so the detection and the "current" node
* are the same one — and that lane is precisely the one whose stage the badge
* is the only readout for. A declared lane can never tie, because
* recordDetection refuses any detection that isn't strictly ahead.
*/
function detectionLeads(lane: Lane): boolean {
if (!lane.detected_stage) return false;
const nodes = lane.pipeline_nodes;
return (
nodes.findIndex((n) => n.id === lane.detected_stage) >
nodes.findIndex((n) => n.id === lane.detected_stage) >=
nodes.findIndex((n) => n.state === "current")
);
}