Auto-commit: v2.13 — Add Live Status diagnostic panel to run_details UI

- Backend (web/routes/run.py): Extended /run/<id>/status JSON response with
  server_timestamp, db_log_count, and latest_log_timestamp so clients can
  detect whether the DB is being written to independently of the log text.

- Frontend (templates/run_details.html):
  • Added Live Status Panel above the System Log card, showing:
    - Polling state badge (Initializing / Requesting / Waiting Ns / Error / Idle)
    - Last Successful Update timestamp (HH:MM:SS, updated every successful poll)
    - DB diagnostics (log count + latest log timestamp from server response)
    - Last Error message displayed inline when a poll fails
    - Force Refresh button to immediately trigger a new poll
  • Refactored JS polling loop: countdown timer with clearCountdown/
    startWaitCountdown helpers, forceRefresh() clears pending timers before
    re-polling, explicit pollTimer/countdownInterval tracking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 18:48:06 -05:00
parent 4e39e18dfe
commit 97efd51fd5
2 changed files with 91 additions and 5 deletions

View File

@@ -138,7 +138,10 @@ def run_status(id):
"log": log_content,
"cost": run.cost,
"percent": run.progress,
"start_time": run.start_time.timestamp() if run.start_time else None
"start_time": run.start_time.timestamp() if run.start_time else None,
"server_timestamp": datetime.utcnow().isoformat() + "Z",
"db_log_count": len(logs),
"latest_log_timestamp": last_log.timestamp.isoformat() if last_log else None,
}
if last_log: