From c8b507cdc3cbb0e80caee1cc8f2edd839493f3e3 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 3 Jun 2026 23:48:45 -0400 Subject: [PATCH] repo: add duration_s to get_group_run query The group run detail page was crashing because get_group_run returned no duration_s field, unlike the list queries. Fixes 500 on /group-runs/{id}. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- pipekit/repo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pipekit/repo.py b/pipekit/repo.py index b2ef192..da54df7 100644 --- a/pipekit/repo.py +++ b/pipekit/repo.py @@ -662,7 +662,10 @@ def create_group_run(group_id: int, *, triggered_by: str | None = None) -> int: def get_group_run(group_run_id: int) -> dict | None: with db.connect() as c: return _row(c.execute( - "SELECT gr.*, g.name AS group_name " + "SELECT gr.*, g.name AS group_name, " + "CASE WHEN gr.started_at IS NOT NULL AND gr.finished_at IS NOT NULL " + "THEN CAST(ROUND((julianday(gr.finished_at) - julianday(gr.started_at)) * 86400) AS INTEGER) " + "ELSE NULL END AS duration_s " "FROM group_run gr " "JOIN grp g ON gr.group_id=g.id " "WHERE gr.id=?",