tasks: report recent terminal tasks per engine so the Tasks page shows last-N across ALL engines

Each engine's status payload reported only running/queued/paused tasks, so finished
generations on a non-primary engine (e.g. radeon, reached via the API) never got to the
front and vanished from the Tasks page. Now every engine also reports its most recent
terminal tasks (capped at 10, newest-first); the front's _merge_engine_tasks already
merges non-primary e.tasks (tagged by engine), so the page shows the last-N per engine.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mw2KQiswmD69T45fTfjKwW
parent b9a84c01
......@@ -335,8 +335,15 @@ async def internal_engine_state():
tasks = []
try:
from codai.tasks import task_registry
tasks = [t for t in task_registry.list()
if t.get("status") in ("running", "queued", "paused")]
# Report active tasks AND the most recent terminal (done/cancelled/error) ones,
# so the front's Tasks page can show the last-N history for EVERY engine — not
# just running work. Without the terminal ones, finished generations on a
# non-primary engine (e.g. radeon) never reach the front and vanish from the
# page. Newest-first; cap the terminal slice to keep the ~2s status poll small.
_all = task_registry.list() # newest-first (active + recent terminal)
_active = [t for t in _all if t.get("status") in ("running", "queued", "paused")]
_recent = [t for t in _all if t.get("status") not in ("running", "queued", "paused")]
tasks = _active + _recent[:10]
except Exception:
tasks = []
# This engine's thermal cooldown state, so the front can show WHICH engine is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment