Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- git, Cline CLI and lms output are decoded as UTF-8 with replacement, so the dashboard's agent status and autopilot survive any text on a non-UTF-8 locale code page.
- The dashboard's Settings tab has a "Start Iris in the tray at login" switch that writes or removes the Startup-folder entry (`/api/startup`); an installer build answers that it manages its own entry.
- When `agents.toml` names a nightshift command, the dashboard's Repos tab shows the active run above the repo list (done and blocked counts, current item and minutes on it, last gate check); `/api/agents` carries it as a `nightshift` key.
- The dashboard's nightshift line now starts with whether the supervisor is running or stopped and ends with how many minutes ago the run was last updated; older nightshift versions that report neither read as stopped with no age.

## 1.0.0 (release date): steady, safer and measured

Expand Down
4 changes: 4 additions & 0 deletions iris/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def nightshift_run(
data = json.loads(proc.stdout)
done = len(data["done"]) if isinstance(data.get("done"), list) else 0
blocked = len(data["blocked"]) if isinstance(data.get("blocked"), list) else 0
updated = data.get("updated")
return {
"name": str(data["name"]),
"done": done,
Expand All @@ -225,6 +226,9 @@ def nightshift_run(
"next_title": data["next_title"],
"current_minutes": data["current_minutes"],
"gate": str(data["gate"]),
# older nightshift versions print neither key: the line then reads stopped with no age
"supervisor_running": bool(data.get("supervisor_running", False)),
"updated": updated if isinstance(updated, str) else None,
"dir": str(run_dir),
}
except (KeyError, TypeError, ValueError) as exc:
Expand Down
10 changes: 8 additions & 2 deletions iris/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,16 @@ <h2>Settings<span class="log-path" id="settings-path"></span></h2>
if (n.error){
line = n.error; // already says what happened ("no nightshift runs found", ...)
} else {
const state = n.supervisor_running ? "running" : "stopped"; // a live supervisor holds the repo lock
const on = n.next_item != null ? "on " + n.next_item + " " + (n.next_title || "") : "complete";
const mins = n.current_minutes != null ? " for " + n.current_minutes + " min" : "";
line = "nightshift " + n.name + ": " + n.done + "/" + n.total + " done, " + n.blocked +
" blocked, " + on + mins + ", last check " + n.gate;
let updated = ""; // minutes since the last supervisor event, from the browser's clock; left out when unknown
if (n.updated){
const ageMin = Math.max(0, Math.round((Date.now() - new Date(n.updated).getTime()) / 60000));
updated = ", updated " + ageMin + " min ago";
}
line = "nightshift " + n.name + ": " + state + ", " + n.done + "/" + n.total + " done, " + n.blocked +
" blocked, " + on + mins + ", last check " + n.gate + updated;
}
body.appendChild(el("div", "ns-line", line));
}
Expand Down
33 changes: 33 additions & 0 deletions tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ def _status_json() -> str:
"gate": "pass",
"commits": [{"hash": "abc1234", "subject": "Q1: agents: read the active nightshift run"}],
"events": [],
"supervisor_running": True,
"updated": "2026-11-15T23:06:00",
})


Expand Down Expand Up @@ -380,10 +382,41 @@ def fake(*args, **kwargs):
"next_title": "dashboard: show it on the agents view",
"current_minutes": 7,
"gate": "pass",
"supervisor_running": True,
"updated": "2026-11-15T23:06:00",
"dir": str(run_dir),
}


def test_nightshift_run_defaults_the_supervisor_fields_when_missing(tmp_path):
"""Older nightshift versions print no supervisor keys at all: stopped, with no age."""
make_run_dir(tmp_path, "qwen92")
payload = json.dumps({"name": "old", "total": 1, "done": [], "blocked": [],
"next_item": None, "next_title": None, "current_minutes": None, "gate": "pass"})

def fake(*args, **kwargs):
return _StatusProc(stdout=payload)

out = agents.nightshift_run(Config(nightshift_command=["ns"], nightshift_runs=[str(tmp_path)]), run=fake)
assert out is not None and "error" not in out
assert out["supervisor_running"] is False and out["updated"] is None


def test_nightshift_run_maps_a_null_updated(tmp_path):
"""A live supervisor with no events yet: running, but nothing to date."""
make_run_dir(tmp_path, "qwen92")
payload = json.dumps({"name": "fresh", "total": 1, "done": [], "blocked": [],
"next_item": None, "next_title": None, "current_minutes": None, "gate": "pass",
"supervisor_running": True, "updated": None})

def fake(*args, **kwargs):
return _StatusProc(stdout=payload)

out = agents.nightshift_run(Config(nightshift_command=["ns"], nightshift_runs=[str(tmp_path)]), run=fake)
assert out is not None and "error" not in out
assert out["supervisor_running"] is True and out["updated"] is None


def test_nightshift_run_counts_done_and_blocked_items(tmp_path):
make_run_dir(tmp_path, "qwen92")
payload = json.dumps({"name": "done-run", "total": 5, "done": [1, 2], "blocked": [3, 4],
Expand Down
12 changes: 11 additions & 1 deletion tests/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,24 @@ def test_agents_payload_carries_the_nightshift_run_when_configured(tmp_path, mon

fake = {"name": "qwen92", "done": 1, "total": 2, "blocked": 0, "next_item": 2,
"next_title": "dashboard: show it on the agents view", "current_minutes": 7,
"gate": "pass", "dir": "C:/runs/qwen92"}
"gate": "pass", "supervisor_running": True, "updated": "2026-11-15T23:06:00",
"dir": "C:/runs/qwen92"}
monkeypatch.setattr(agents_mod, "nightshift_run", lambda cfg=None: fake)

data = agents_payload()
assert data["nightshift"] == fake # the runner's result, untouched; the rows are still there
assert [r["name"] for r in data["rows"]] == ["fresh"]


def test_page_nightshift_line_shows_supervisor_state_and_age(server):
status, _headers, page = get(server + "/")
assert status == 200
fn = page.split("function renderAgents", 1)[1].split("\n}", 1)[0]
assert 'n.supervisor_running ? "running" : "stopped"' in fn # the line starts with the supervisor's state
assert "new Date(n.updated)" in fn # minutes since the last event, from the browser's clock
assert '" min ago"' in fn # and it ends with "updated <n> min ago"


@pytest.fixture(scope="module")
def runs_repos(tmp_path_factory):
"""alpha and zeta are not done, beta is done, gamma has no PROGRESS file at all. Built once for both /api/runs
Expand Down