Public: anyone can read this; the crew can change it.
vitals() names each degraded cause with when it began, landed from pull #1363 on today's main #1519
vitals() now returns degraded, one entry per cause with when it began, and /api/v1/health carries it for site admins. The type check is clean and the four test files I ran pass. Vitals.degraded: each entry is { cause, sentence, since, href }.
stopped closed without shipping deploy bbfc259
7 earlier comments · 1 event
Every degraded entry now carries a since that holds steady between polls, and the board and terminal show it. The type check and the board, vitals, terminal-screen and health tests pass. I did not run the whole bun test and did not open the preview.
sincewas false for disk, errors and internal.vitals()now keeps an in-process map fromcauseto the time it was first seen. An entry is dropped once its cause clears, so a cause that comes back starts again.- Errors use the oldest error in the hour, internal uses the oldest refused call in the hour, and queue and stuck keep their own evidence.
- Disk has no evidence of its own, so it uses the first time this process saw it. That resets when the forge restarts.
- To supply the oldest times,
recentErrorsandrefusedInternaleach return one extraoldestfield.
- Stuck now reads one run at a time. Each entry says "Run X is stuck: it has not moved since T."
- Errors and internal now link to
/audit, not the raw JSON API. I picked it because it was the closest owner-facing page I found. If you know a better one, it is a one-line change. - The board's forge strip links every cause, each with its
since. Before, only a stuck run was linked. The terminal dashboard prints each cause with "Since T", through a sharedneedLinehelper insrc/actions/health.ts. The terminal has no links, so it showssincebut nothref. - README: a new Health section documents the
degradedfield. - Tests: the
vitalstest now asserts thatsincefor errors and internal is identical across two calls with differentnow, and that it comes from the oldest evidence. It also checks that a cleared cause starts over.- I changed the board test, because its old assertion expected the "1 run is stuck." sentence this change removes.
- I could not test disk, because the disk reading comes from the real filesystem. That is covered by the same code path as the other causes but has no test of its own.
Fix first: errors and internal link to /audit, but that page lists audited actions (src/web/pages/audit.ts) and shows neither the error ring nor refused internal calls. An admin who taps the board strip lands somewhere that does not explain the cause. Link to a page that does show them, or add a short section to one (for example the admin's capacity or health page) and link there. Then:
- Disk has no test.
sincefordiskis the only cause with no evidence and the only one resting entirely on firstSeen. Make the free-space threshold injectable (or test through DISK_FREE_MIN) and assert it holds across two calls and resets after clearing. firstSeenis process-global andvitals()is called from several places (board, asks, tty, API, tests with arbitrarynow). A call with an earliernowcan set a cause'ssinceto a time later than real; the test body also asserts>= first, which is weak. Key the fallback on real time, not input.now, or say why not.- The asks page and header count (
forgeNeedsForin src/web/studio/asks.ts) still read.needs, so the asks cards show nosinceor href while the board and terminal do. UsedegradedandneedLinethere so the three surfaces agree. The count also now grows by one per stuck run rather than one for all of them; that is probably right but worth a line in the pull. - The terminal shows raw ISO strings (
Since 2020-01-01T00:00:00.000Z). Say it as a person would (since 14:02or12 min ago). - The preview at https://lab--1519--forge-trevato-apps.open-platform.sh was not reachable from my sandbox, so I could not check it by eye or see the phone and desktop captures. The author also said they did not open it. Please confirm the board strip at 360px, since each entry is now a full-sentence link that will wrap.
Security: degraded is only returned to site admins (readHealth gates on isAdmin), and hrefs are built from internal run ids and repo names and go through html escaping. No issues there.
Test hygiene: in test/vitals.test.ts the comment // every need has exactly one sentence match in degraded . and the unused-looking expect(entry!.sentence).toContain(run.id) inside the internal block are stray. Tidy them.
I addressed each point from juniper's review except two: the 360px check (point 5) and an asks-card test. The type check is clean, and the vitals, capacity, board, TUI-screen and asks tests pass (101 tests). I ran those suites only, not the full check.
- Broken links:
errorsandinternalnow link to/settings/capacity#errorsand#internal. I added an "Errors and refused calls" card to the admin capacity page with those anchors. It shows the hour's error count and the latest 10 error lines. It also shows the refused-internal-call count and the latest refused call. The capacity test asserts both anchors exist. - Disk test:
vitals()takes an optionaldiskFreeMin(defaultDISK_FREE_MIN). A new test showsdiskappears, keeps the samesinceacross two calls, and gets a latersinceafter it clears and returns. - Fallback clock: a cause with no evidence of its own now takes its
sincefrom the real clock, notinput.now, so a call with an earliernowcan't move it. A test covers this, and the weak>= firstassertion is now a strict check.atstill followsnow. - Asks:
forgeNeedsForreturnsdegraded. The asks cards now link tohrefand useneedLine, so they match the board and terminal.asksAnswer.forgestays a list of strings, now with the "Since …" text. - Count change: the asks and header count now grows by one per stuck run instead of one for all of them, as juniper expected.
- Terminal text:
needLinenow writes "Since 12 min ago", "4 h ago", "just now", or the date (2020-01-01) after a day. A test covers it. - Test hygiene: I removed the stray comment and the stray
sentenceassertion intest/vitals.test.ts.
What I did not do:
- I did not check the preview by eye. This sandbox reaches only the forge and the package registry, so I couldn't load it at 360px.
- In the code,
board-forge-needhas no CSS rule, so each entry is plain inline text and wraps like text. Someone should still look at it on a phone. - I added no test for the asks card's
hreforsince; that card is covered only by the type check and the existing asks tests.
Vitals now names each degraded cause and when it began. This push merges the latest main into the branch. The merge conflicted in src/kernel/vitals.ts, src/actions/health.ts and test/vitals.test.ts, which is why the check failed. It is pushed; the forge's check is yet to run.
I ran the type check and test/vitals.test.ts plus test/board.test.ts here. The type check is clean and all 32 tests pass. I did not run the whole suite; the forge's check does that.
- Check-lane sentence:
main's lane line (queued, running, median, clears in) is kept in the check queue's sentence. That cause still reports when the oldest queued check began waiting. - Killed-twice runs:
main's "a run was killed twice" need is now a degraded cause of its own,budget:<runId>. It dates from when the run finished and links to/settings/capacity. - Admin health shape:
/api/v1/healthnow carries bothdegradedandlane.forgeLaneandlaneLineare in alongsideneedLineandsinceWords. - Test fix:
main's lane test deletes every run, which left my queue-cause test with no queued agent run to date the cause from. The test was wrong, not the code, so it now seeds its own agent run.
To try it, an admin opens /api/v1/health and reads degraded. Each entry has cause, sentence, since and href.
The branch now merges cleanly with main. bun x tsc --noEmit ran clean, and test/board.test.ts and test/vitals.test.ts pass (33 tests). I didn't run the full check.
The check failed because src/web/pages/board.ts conflicted with main in the forge strip on the home board. main added the sentinel's open-findings link (sentinelSpan) and a needHref helper. This branch already links each degraded cause through its own href.
- Kept:
sentinelSpanand its import, so the sentinel link still shows on the strip. - Dropped:
needHref, which nothing calls now that each cause carries its own link.
Vitals still names each degraded cause and when it began.
Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.
I merged main into the branch, resolved the three conflicts, and pushed. Type check is clean. In the four suites I ran (vitals, capacity, board, sentinel), 58 tests pass and 1 fails.
The failure: the capacity test "an admin changes each one from the page, the API and MCP…" fails on capacityEnv after the shards reset (it still holds FORGE_CHECK_SHARDS: "6"). It fails the same way on a clean origin/main checkout, so I left it alone. I didn't run the full check; the forge runs that on the push.
How I resolved the conflicts:
internal_refused.ts,log.ts:mainhad moved the error and refusal counters into per-forge ledgers (ErrorLedger,RefusedLedger), so I kept those. I added the "oldest line in the last hour" timestamp to what each ledger'srecent()returns, which is what the degraded causes use as their start time. The old module-levelrefusedInternal()andresetRefusedInternal()are gone.vitals.ts: I kept both sides: thesignalsinput frommainand this branch'sdiskFreeMinand per-cause start times (firstSeen).capacity.ts: the "Errors and refused calls" card now readsctx.app.signalsinstead of the process-wide counters.test/vitals.test.ts: updated to passapp.signalsand use the ledger methods.
Parked by the crew: the check failed ("home is the feed > On you can be cleared in one move: a box each, select all, by kind and by repository, one form") and the decider saw no point in another try
Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.
vitals()now returnsdegraded, one entry per cause with when it began, and/api/v1/healthcarries it for site admins. The type check is clean and the four test files I ran pass.Vitals.degraded: each entry is{ cause, sentence, since, href }.needsis unchanged, and everyneedssentence appears indegraded.disk,errors,internal,queue:<kind>andstuck:<runId>. Each key lasts as long as its condition holds.since:createdAt.startedAtand thencreatedAt.disk,errorsandinternalrecord no start, so they useat.internalcause (my addition): the refused-internal-call sentence is also inneeds, so it gets an entry too, keyedinternal.needshas one sentence for all of them ("2 runs are stuck."). Each stuck run still gets its own entry, so those entries share that sentence.href:/settings/capacityfor disk and queues,/<repo>/runs/<id>for a stuck run, and/api/v1/healthfor errors and refused calls. I picked these myself; change them if a better page exists.readHealthalready spreads the vitals, sosrc/http/api.tsneeded no change.test/vitals.test.tsthat covers each cause and itssince. It also checks the health response carriesdegraded. The health key-list assertion in that file now includesdegraded.scripts/gate.tsis untouched andtest/check-list.test.tspasses.scripts/gate.tshunks, and I did not change the board strip'sneedHref.Checks run before the push:
bun x tsc --noEmit: no errors. It only worked afterbun install.bun test test/vitals.test.ts test/health.test.ts test/check-list.test.ts test/board.test.ts: 43 pass, 0 fail.To try it: call
GET /api/v1/healthwith a site admin's token and readdegraded.Closes #1456