Skip to content

feat(judge+server): stream judge progress over SSE with graceful shutdown [8/9] - #32

Open
LarsArtmann wants to merge 8 commits into
cosmtrek:masterfrom
LarsArtmann:judge-progress-sse
Open

LarsArtmann wants to merge 8 commits into
cosmtrek:masterfrom
LarsArtmann:judge-progress-sse

Conversation

@LarsArtmann

Copy link
Copy Markdown

What

Evaluations now report step-level progress instead of an opaque spinner:

  • judge.Options.OnProgress receives milestone events (start, rubric skip/reuse/generate/complete/fail, scoring, retry, done, error); nil keeps the CLI behaviour unchanged
  • schema/progress.schema.json documents the event contract, with a schema-parity test
  • the server keeps a per-job append-only progress log and exposes GET /api/sessions/{id}/analyze/stream: SSE progress events with id: lines, then a terminal status event. Last-Event-ID reconnects resume where they left off
  • Start now uses http.Server with a ReadHeaderTimeout (Slowloris cap, gosec G112) and gains Shutdown; serve/open/map handle SIGINT/SIGTERM with a 5-second drain so in-flight SSE handlers finish instead of dying mid-stream

Why

A judge run takes one to two minutes with zero feedback; the SSE contract makes the pipeline phase observable by any client (the browser UI consumes it in my fork; the API is useful on its own and the schema pins it).

Series

Part 8/9; stacks on #31 (and #25–#30 before it). "Files changed" shows the cumulative stack — this PR's own delta is just the eighth commit, feat(judge+server): stream judge progress over SSE with graceful shutdown.

Validation

  • go test -count=1 ./... and go test -race ./internal/server/ green at the tip
  • new tests: SSE framing + resume offset, progress schema parity, port-0 binding, Shutdown-before-Start no-op

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