feat(agents): fleet-health panel — saturation, queue, cost burn, last activity #239

Closed
opened 2026-04-21 12:50:22 +00:00 by claude-desktop · 1 comment
Collaborator

User story

As an operator, I want the Agents page to open with a fleet-health strip showing aggregate saturation, queue depth, USD/hr burn, and last-activity ages, so I can answer "is the fleet saturated?" / "is it burning too fast?" without scanning every card.

Dependencies

  • Blocked by the fleet-health Penpot mockup (sibling).

Acceptance criteria

Server

  • New endpoint GET /agents/health — returns { saturation: {busy, capacity, per_type}, queue: {total, per_type}, cost_burn_usd_per_hour, last_activity: {newest_dispatch_ts, oldest_idle_ts}, degraded_agents: [...] }. 5 s cache.
  • Degraded-state detection reuses container-watchdog.ts missing/stopped signals.

UI

  • Render the strip per the mockup on routes/agents.tsx.
  • Per-agent card gains last-activity + cost-sparkline per the mockup.
  • Live-updates via SSE task-lifecycle events (no poll storm).

Verification

  • Unit test for /agents/health with a synthetic fleet state.
  • Visual: saturate the fleet manually (dispatch 12 concurrent tasks), confirm the tile goes red.

Out of scope

  • Alerting (email / Matrix) on degraded state — file a follow-up.

References

  • apps/server/src/main.ts — worker registry.
  • apps/server/src/task-store.ts::computeUsage — cost rollup reference.
  • Mockup ticket — blocker.
## User story As an operator, I want the Agents page to open with a **fleet-health strip** showing aggregate saturation, queue depth, USD/hr burn, and last-activity ages, so I can answer "is the fleet saturated?" / "is it burning too fast?" without scanning every card. ## Dependencies - **Blocked by the fleet-health Penpot mockup** (sibling). ## Acceptance criteria ### Server - [ ] New endpoint `GET /agents/health` — returns `{ saturation: {busy, capacity, per_type}, queue: {total, per_type}, cost_burn_usd_per_hour, last_activity: {newest_dispatch_ts, oldest_idle_ts}, degraded_agents: [...] }`. 5 s cache. - [ ] Degraded-state detection reuses `container-watchdog.ts` missing/stopped signals. ### UI - [ ] Render the strip per the mockup on `routes/agents.tsx`. - [ ] Per-agent card gains last-activity + cost-sparkline per the mockup. - [ ] Live-updates via SSE task-lifecycle events (no poll storm). ### Verification - [ ] Unit test for `/agents/health` with a synthetic fleet state. - [ ] Visual: saturate the fleet manually (dispatch 12 concurrent tasks), confirm the tile goes red. ## Out of scope - Alerting (email / Matrix) on degraded state — file a follow-up. ## References - `apps/server/src/main.ts` — worker registry. - `apps/server/src/task-store.ts::computeUsage` — cost rollup reference. - Mockup ticket — blocker.
Collaborator

🤖 Auto-assigned to boss (heuristic: area:agents → boss (architecture-touching)). Reply /unassign to reroute.

🤖 Auto-assigned to **boss** (heuristic: area:agents → boss (architecture-touching)). Reply `/unassign` to reroute.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

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