Skip to content

feat(tasks): live output streaming for in-progress cron jobs #526

@nesquena-hermes

Description

@nesquena-hermes

Summary

The Tasks panel shows the last run output as a 300-char snippet. There is no way to watch a cron job that is currently running — no live output, no streaming tail. If you hit "Run Now" you have no feedback until the job finishes and the snippet updates.

This is separate from #468 (run history and full output viewer), which covers browsing past runs. This issue is specifically about live streaming output while a job is in-progress.

Current behaviour

  • "Run Now" triggers the cron job
  • No indication the job is running beyond the status badge changing
  • Output only appears (truncated) after the job completes
  • Users tail the cron output file in a terminal to see progress

Proposed behaviour

When a cron job is running (triggered manually via "Run Now" or auto-scheduled), an expandable live output pane appears below the job card. It streams the output in real time — same SSE pattern used for chat messages — and stops updating when the job completes.

A "Running..." spinner on the job card and a "View live output ▾" toggle to show/hide the stream pane would be sufficient. Auto-scroll to bottom while output is incoming; freezes on completion.

Implementation notes

  • The cron scheduler already runs jobs in a thread and writes output to ~/.hermes/cron/outputs/. A new GET /api/crons/<id>/stream SSE endpoint could tail the active output file (or pipe from a queue if the scheduler writes to one).
  • The frontend opens an EventSource for the active job and appends tokens to the live pane, same pattern as static/messages.js streaming.
  • On job completion the stream closes; the pane shows a "Completed" badge and the output stays readable.
  • If no job is running for that ID, the endpoint returns 404 immediately (no hanging connection).

Files involved

  • api/routes.py — new GET /api/crons/<id>/stream SSE endpoint
  • static/panels.js — live output pane, EventSource open/close, spinner
  • static/style.css — live pane styles

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststreamingSSE streaming, gateway sync, real-time updatestasksCron jobs, task scheduling, background jobs

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions