Public: anyone can read this; the crew can change it.
The forge says how it is at /api/v1/health: disk, memory, queue, stuck runs, apps asleep and previews, as one plain answer #352
Check · Review · Land · Live done — Landed and live in production.
`GET /api/v1/health` now returns the forge's standing to a site admin. The new tests in `test/vitals.test.ts` pass (4 tests). I did not run the full check: `bun x tsc --noEmit` fails here because it can't find the `bun` type definitions, so the type-check part of `forge.json`'s `check` is unverified.
shipped production is serving it deploy d63cf43
I merged main into the branch and pushed. The only conflict was forge.json. I kept main's version of the check line and added test/vitals.test.ts back to it. forge.json still parses as JSON.
I re-ran only test/vitals.test.ts after the merge, and its 4 tests pass. I did not re-run the full check command (tsc plus the test shards).
src/http/api.ts auto-merged without conflicts. The pull's content is otherwise unchanged: GET /api/v1/health returns the forge's standing to site admins only and 404s for everyone else.
GET /api/v1/healthnow returns the forge's standing to a site admin. The new tests intest/vitals.test.tspass (4 tests). I did not run the full check:bun x tsc --noEmitfails here because it can't find thebuntype definitions, so the type-check part offorge.json'scheckis unverified.What changed
src/kernel/vitals.tsbuilds{ ok, needs, disk, memory, queue, stuck, apps, at }from the db. Disk comes fromstatfsSyncon theFORGE_DATAvolume, and memory fromprocess.memoryUsage()andos. Nothing shells out.src/core/runs.tsgainsqueueDepth(one grouped count by kind) andlistRunning(one joined query for repo and issue number). The builder uses a fixed two queries however many runs exist. A test asserts the count stays the same after 40 more runs.leaseLapsedwithSTALE_AFTER_MS) or has been running over 6 hours. A queue is flagged when its oldest run has waited over 30 minutes; runs paused bynot_beforeare not counted as waiting.needssentences: disk under 10% free, and a stuck run.src/http/api.tsreturns 404 to anyone who isn't a site admin, including anonymous callers and non-admin tokens. A session or any token scope works for an admin, since the route only reads./healthzis unchanged.docs/ARCHITECTURE.mdnames the route. I addedtest/vitals.test.tstoforge.json's check.Apps counts
appscounts come from the in-memory runtime, so the builder takes the environments as an input, not from the db.servingandasleepcount production environments only;previewscounts every non-production environment.Left out
Try it: run the forge, then
curl -H "authorization: Bearer $ADMIN_TOKEN" $FORGE_URL/api/v1/health. A non-admin token gets 404.bun test test/vitals.test.tscovers the shape, the admin gate, a stuck run instuckandneeds, and a full queue.🤖 Generated with Claude Code
Closes #343