Skip to content

feat: live streaming for active runs (per-iteration feed + live web viewer)#25

Merged
aktasbatuhan merged 1 commit into
mainfrom
feat/live-streaming
Jun 5, 2026
Merged

feat: live streaming for active runs (per-iteration feed + live web viewer)#25
aktasbatuhan merged 1 commit into
mainfrom
feat/live-streaming

Conversation

@aktasbatuhan

Copy link
Copy Markdown
Member

Lets you watch an active run progress in real time on both surfaces, instead of waiting for checkpoints (which only land every checkpoint_interval).

(b) Per-iteration progress feed

The process controller appends one JSON line per completed iteration to <output>/progress.jsonl{iter, score, best, program_id, model, ts} — wrapped in try/except so telemetry can never break the evolution loop. explore.read_progress / progress_trajectory read it, and run_state now prefers it for the live iteration / best / curve, so the already-live kai monitor and the viewer overview stop lagging to checkpoints.

(a) Live web viewer

  • The run dashboard shows a pulsing ● live badge while a run is active (run_state.is_active).
  • The trajectory chart is drawn from the per-iteration feed.
  • A new …/run/{idx}/live.json endpoint returns {active, iteration, best, cost, calls, chart}; the dashboard polls it every 3s and updates the chart + headline stats in place (no full-page reload, and the chart is re-rendered server-side via svg.trajectory so there's no chart logic duplicated in JS). When the run finishes, the badge flips to "● finished" and polling stops.
  • Falls back cleanly to checkpoint steps for older runs that have no feed.

Verification

  • test_live.py (5): feed readers, run_state live override, dashboard badge + live.json for both active and idle runs.
  • Full suite green (342 tests). Verified live in-browser on a synthetic active run (badge, per-iteration chart, live stats).

🤖 Generated with Claude Code

…iewer)

Two parts so active runs can be watched in real time instead of waiting on
checkpoints (which only land every checkpoint_interval):

(b) Per-iteration progress feed. The process controller appends one JSON line
per completed iteration to <output>/progress.jsonl
{iter, score, best, program_id, model, ts}, wrapped so telemetry can never
break the evolution loop. explore.read_progress / progress_trajectory read it,
and run_state now prefers it for the live iteration / best / curve (so the
already-live `kai monitor` and the viewer overview stop lagging to checkpoints).

(a) Live web viewer. The run dashboard shows a pulsing "● live" badge while a
run is active (run_state.is_active), draws the trajectory from the per-iteration
feed, and polls a new /setup/{label}/run/{idx}/live.json every 3s to update the
chart + headline stats in place (no full reload, no chart logic duplicated in
JS - the endpoint re-renders svg.trajectory). Falls back cleanly to checkpoint
steps for older runs with no feed.

Tests: test_live.py covers the feed readers, the run_state live override, and
the dashboard badge + live.json (active and idle). Full suite green (342).
@aktasbatuhan aktasbatuhan merged commit 635de99 into main Jun 5, 2026
1 check passed
@aktasbatuhan aktasbatuhan deleted the feat/live-streaming branch June 5, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant