kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 18:23:04 +02:00
parent f6bccdceb3
commit c767c6157a
5 changed files with 61 additions and 13 deletions

View file

@ -139,7 +139,6 @@ def _render_ps(rows: list[dict]) -> None:
def cmd_watch(conn, task_id: str) -> None:
"""Polling monitor for a task. Updates every 5s. Exits on terminal pipeline state."""
import sqlite3
task = models.get_task(conn, task_id)
if not task:
print(f"Task '{task_id}' not found.")
@ -152,10 +151,7 @@ def cmd_watch(conn, task_id: str) -> None:
if pipeline:
log = models.get_current_agent_log(conn, task_id, pipeline['created_at'])
step_num = conn.execute(
'SELECT COUNT(*) FROM agent_logs WHERE task_id = ? AND created_at >= ?',
(task_id, pipeline['created_at']),
).fetchone()[0]
step_num = models.count_agent_logs_since(conn, task_id, pipeline['created_at'])
total = _parse_total_steps(pipeline.get('steps'))
else:
log, step_num, total = None, 0, '?'