Commit 0418961
authored
feat: add the /report health report (get_report MCP tool + CLI + API) (#4327)
## Overview
Adds the first **Report** — `health`. The server computes a
deterministic verdict and renders it as text + unicode sparklines.
`health` separates **flow** (is work starting?), **execution** (are the
runs that start succeeding?), and **liveness** (is the telemetry
fresh?), each with a headline verdict and a suggested next action — no
LLM in the verdict, so there's nothing to hallucinate.
Surfaces:
- **`get_report` MCP tool** — markdown with sparklines + 🟢/🟡/🔴 status
markers (or ANSI via `color`).
- **`report` MCP prompt** — a slash command in hosts that support
prompts.
- **`trigger report [key]` CLI** — colourised in a real terminal, plain
markdown when piped.
- **`GET /api/v1/reports/:key`** — `format=markdown|ansi|json`.
Flow is diagnosed by a cause tree (env-limit saturation, queue
throttling, key starvation, trigger spike, dequeue stall) off measured
queue metrics, with a runs-snapshot fallback. One `ReportViewModel`,
rendered to markdown / ANSI / JSON.
Also: `trigger mcp` now always starts the server — the interactive
install wizard is gated behind `trigger mcp --install`. Previously a TTY
dropped into the wizard, so MCP hosts that spawn the server over a PTY
never got a server and timed out.
---
## Preview
**Degraded — env concurrency-limit saturation:**
```
/report health prod · last 1h · vs your 7d normal
🟡 Flow slowing · 🟢 Execution healthy · 🟢 data fresh
FLOW 🟡 at your env concurrency limit (last 40 min)
concurrency 100/100 ▁▅▆█████ pinned 40 of last 60 min
pending 1,910 ↑ 16× ▁▁▂▃▅▅▇█ (normal ~120)
start latency p95 42s ↑ 6× ▁▁▂▄▆▆▇█ (normal ~7s)
worst queue email-sends — 82% of pending
read: limit saturated → starts lag → backlog grows
not workers, not platform — dequeue keeps pace at ~820/min
nothing dead-lettered
EXECUTION 🟢 the runs that DO start are fine
failures 1.3% (normal ~1.1%) · durations normal
read: NOT a code problem
LIVENESS 🟢 fresh — last completion 4s ago
→ Raise the env concurrency limit
or do nothing — backlog drains in ~2.3 min once triggers ease
```
**Healthy:**
```
/report health prod · last 1h · vs your 7d normal
🟢 Flow healthy · 🟢 Execution healthy · 🟢 data fresh
FLOW 🟢 starting normally — pending 84 (normal ~120) · starts p95 6s
EXECUTION 🟢 completing normally — failures 0.9% (normal ~1.1%) · durations normal
LIVENESS 🟢 fresh — last completion 2s ago
→ nothing to do
```1 parent 76e3062 commit 0418961
27 files changed
Lines changed: 3220 additions & 3 deletions
File tree
- .changeset
- apps/webapp
- app
- presenters/v3/reports
- health
- routes
- services
- test
- packages
- cli-v3/src
- cli
- commands
- mcp
- tools
- core/src/v3/apiClient
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments