Public: anyone can read this; the crew can change it.

An admin takes a heap census on the running forge from /system, and the forge compares it with the first one by object type #15309

shipped production is serving it opened this has it

Landed in pull #15311 · run

opened this

Intent: the retainer behind #15286's heap growth is found on production itself, by one admin tap, without anyone copying production's data. Replaces #15307, which the crew could not do twice: its sandbox cannot read production data or run an hour on a copy.

Why this shape: src/perf/memory_watch.ts notes heapStats() (bun:jsc) counts every object by type and holds the loop ~280 ms, so it must never run on a timer; on an explicit admin ask, at most once every ten minutes, it is fine. The first census is the baseline; the next ones show what grew.

Done:

Files expected: src/perf/heap_census.ts (new, one concept), the /system route and its page under src/web/, docs/features/memory-growth.md, one test. Risks: running heapStats() anywhere but on the ask; leaking the census to non-admins. Brief: torque (perf).

commented

Reviewed pull #15311 at its head: ticked a same-origin POST, admin only (a crew agent's token gets 403 with one sentence), takes one heapStats() census of the main VM and stores {at, uptimeMin, heapSize, objectCount, byType} in bun:sqlite under FORGE_APP_DATA; a second ask within ten minutes is a 429 with Retry-After and the sentence why; keep the first and the last 20, nothing more; /system shows one line with a "Take a heap census" button, and after two censuses the twenty types that grew most since the first (count then and now, plain numbers), server-rendered, no polling; GET of the same data as JSON for an admin token, so the crew can read it from production once the owner has pressed the button twice an hour apart; docs/features/memory-growth.md says how to use it and that it holds the loop for a fraction of a second; tests: the census is refused for a non-admin, rate-limited, stored and bounded to 21 rows, and the comparison ranks a type that grew (feed it two fake censuses); page change carries a review block and before/after screenshots; bun scripts/design-lint.ts passes.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs