M26-5 Lazy lifecycle metrics + SSE events #592

Closed
opened 2026-04-30 19:31:52 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a service operator, I want lazy starts, stops, and start failures to emit observable events on the SSE bus, so that the dashboard can show cold-start latency, idle stops, and failures without me tailing logs.

Acceptance criteria

Events

  • New SSE envelope types on /events:
    • container.lazy_started { instance, latency_ms } — emitted after readiness probe succeeds.
    • container.lazy_stopped { instance, idle_seconds } — emitted after docker stop returns.
    • container.lazy_start_failed { instance, error } — readiness probe failed or docker start errored.
  • Wired into the existing event log so the dashboard's Agents page surfaces them without schema work.
  • Events also written to the SQLite event_log so they survive service restart for post-hoc audit.

Dashboard surface

  • Agents page Activity timeline includes the three event types with appropriate icons and human-readable text ("reviewer-default started in 287 ms" / "designer-default stopped after 12 min idle").
  • No new aggregate widgets in this ticket — single-event rendering is enough; rollups can come later if needed.

Tests

  • Lifecycle module emits each event at the right transition (test via injected event sink).
  • Latency value is monotonic (Date.now() based, not random clock skew).
  • Failure path: docker start rejects → lazy_start_failed emitted, no lazy_started, dispatch surfaces error.

Out of scope

  • Lifecycle module (M26-1).
  • Reconcile + watchdog (M26-2).
  • Pool selection (M26-3).
  • Config + dashboard CRUD (M26-4).
  • Aggregate widgets (cold-start histograms, idle-time distribution) — follow-up if telemetry justifies.

References

  • specs/container-lazy-lifecycle.md §Metrics + events.
  • apps/server/src/infrastructure/event-log.ts — existing event log.
  • apps/web/ Agents page activity timeline.
## User story As a service operator, I want lazy starts, stops, and start failures to emit observable events on the SSE bus, so that the dashboard can show cold-start latency, idle stops, and failures without me tailing logs. ## Acceptance criteria ### Events - [ ] New SSE envelope types on `/events`: - `container.lazy_started` `{ instance, latency_ms }` — emitted after readiness probe succeeds. - `container.lazy_stopped` `{ instance, idle_seconds }` — emitted after `docker stop` returns. - `container.lazy_start_failed` `{ instance, error }` — readiness probe failed or `docker start` errored. - [ ] Wired into the existing event log so the dashboard's Agents page surfaces them without schema work. - [ ] Events also written to the SQLite `event_log` so they survive service restart for post-hoc audit. ### Dashboard surface - [ ] Agents page Activity timeline includes the three event types with appropriate icons and human-readable text (`"reviewer-default started in 287 ms"` / `"designer-default stopped after 12 min idle"`). - [ ] No new aggregate widgets in this ticket — single-event rendering is enough; rollups can come later if needed. ### Tests - [ ] Lifecycle module emits each event at the right transition (test via injected event sink). - [ ] Latency value is monotonic (`Date.now()` based, not random clock skew). - [ ] Failure path: `docker start` rejects → `lazy_start_failed` emitted, no `lazy_started`, dispatch surfaces error. ## Out of scope - Lifecycle module (M26-1). - Reconcile + watchdog (M26-2). - Pool selection (M26-3). - Config + dashboard CRUD (M26-4). - Aggregate widgets (cold-start histograms, idle-time distribution) — follow-up if telemetry justifies. ## References - `specs/container-lazy-lifecycle.md` §Metrics + events. - `apps/server/src/infrastructure/event-log.ts` — existing event log. - `apps/web/` Agents page activity timeline.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#592
No description provided.