From 0398b00b082fc2b925b14327bf72e1c68fcdb3db Mon Sep 17 00:00:00 2001 From: skl <57862504+sklsp@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:53:09 +0100 Subject: [PATCH 1/2] Q1: agents and dashboard: running or stopped, and how long ago 2475 passed in 108.17s (0:01:48) --- CHANGELOG.md | 1 + PROGRESS-qwen93.md | 3 +++ iris/agents.py | 4 ++++ iris/dashboard/index.html | 10 ++++++++-- tests/test_agents.py | 33 +++++++++++++++++++++++++++++++++ tests/test_dashboard.py | 12 +++++++++++- 6 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 PROGRESS-qwen93.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b17d29e..5b50f76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/PROGRESS-qwen93.md b/PROGRESS-qwen93.md new file mode 100644 index 0000000..7c41e20 --- /dev/null +++ b/PROGRESS-qwen93.md @@ -0,0 +1,3 @@ +# Progress: nightshift run qwen93 + +- [x] Q1. agents and dashboard: running or stopped, and how long ago (2475 passed in 108.17s (0:01:48)) diff --git a/iris/agents.py b/iris/agents.py index 9c747b8..5a772c2 100644 --- a/iris/agents.py +++ b/iris/agents.py @@ -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, @@ -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: diff --git a/iris/dashboard/index.html b/iris/dashboard/index.html index b487e46..64fcf7a 100644 --- a/iris/dashboard/index.html +++ b/iris/dashboard/index.html @@ -574,10 +574,16 @@

Settings

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)); } diff --git a/tests/test_agents.py b/tests/test_agents.py index 964694b..d984707 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -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", }) @@ -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], diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index 044c9f5..a0fef47 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -482,7 +482,8 @@ 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() @@ -490,6 +491,15 @@ def test_agents_payload_carries_the_nightshift_run_when_configured(tmp_path, mon 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 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 From da60c04af82983c82dbf273cefc407cfa6a0be8b Mon Sep 17 00:00:00 2001 From: skl <57862504+sklsp@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:55:59 +0100 Subject: [PATCH 2/2] chore: drop the qwen93 progress file --- PROGRESS-qwen93.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 PROGRESS-qwen93.md diff --git a/PROGRESS-qwen93.md b/PROGRESS-qwen93.md deleted file mode 100644 index 7c41e20..0000000 --- a/PROGRESS-qwen93.md +++ /dev/null @@ -1,3 +0,0 @@ -# Progress: nightshift run qwen93 - -- [x] Q1. agents and dashboard: running or stopped, and how long ago (2475 passed in 108.17s (0:01:48))