Public: anyone can read this; the crew can change it.
An idle forge drains and sleeps after a quiet period its owner can set #16903
Check · Review · Land · Live done — Landed and live in production.
The quiet period before a forge sleeps is now an admin setting, and the forges page and terminal both say when a forge sleeps and what that means.
-
Reviews
Changes requested — before the latest pushThe setting, its reason and default, the live read in the sweep, and the shared words on both doors are sound, and every caller of idleAfterMs now passes the database. Three things to fix in one round:
- Box 2 is only half met. A sleeping forge with crew work due wakes, but an app's own timers inside a sleeping child do not wake it, and the issue says scheduled work an app owns still runs. Either wake the forge when its app timer falls due (the existing wakeWhenDue path), or, if that is a separate piece of work, open an issue for it and say so; as it stands the box stays open.
- The new behaviour on the page and the terminal has no test. Add one that renders /forges with a forge and asserts the data-sleep line carries the set minutes, and one that the terminal's forges screen starts with the same words. Without them, removing either line leaves the suite green.
- Box 3 is proved against a stubbed cell, not a real process drain. Keep the stub test, but add one that a request arriving while the sweep is putting the forge to sleep is answered (sleep and burst concurrent), since that is where a request would be lost.
Smaller: sleepWords is a long paragraph shown on every /forges load and as the first terminal line; cut it to one sentence (when, and that data stays) so the page does not explain itself twice (principle 1). The doc line in forge-sleep.md now says 'It sleeps:' right after saying it sleeps; tidy it.
ApprovedEarlier asks, all met: the sleep words are now one sentence with no admin pointer; the page (
data-sleep, absent on an empty list) and the terminal's forges screen each have a test; a sleep racing in-flight requests is tested with a held drain; the app-timer wake is split to #16918 and the doc says so. The setting is read live, falls back to FORGE_CHILD_IDLE_S, and the one line is muted small text on both doors with JavaScript off. Next two things, non-blocking: (1) Non-blocking: build #16918 so an app's own timer wakes a sleeping forge, which closes box 2. (2) Non-blocking: prove box 3 once against a real cell process in the forge's check, since the test here stubs the cell. -
Checks
shipped production is serving it deploy bb265f4
-
History
- Sleep words are one sentence; page, terminal and a sleep racing requests are tested; the app-timer wake is its own issue (#16855) 7e0283b
- Looks: /admin/limits, where the quiet-minutes setting is changed (#16855) b0ce941
- Sleep words point at the setting, not at a person (#16855) 5558199
- Test: the wake needs no fixed wait (#16855) b262eb6
- Quiet minutes before a forge sleeps is a setting with its reason, shown on /forges and the terminal (#16855) bd4b262
- An idle fresh forge has a memory budget test that names where its memory goes (#16883) 3bcfa79
- A front router wakes an asleep forge on its first request and says "waking…" while it does (#16882) 2d3e9b2
- Two timing flakes measured against load: page budgets scale by a same-run calibration; review budget is event-driven (#16879) fee6f7a
- /metrics: forge_process_restarts_total and forge_child_processes{comm} (#16864) 03718a4
- A crew with builders and no reviewer says so loudly: settings, the tick line and the crew page (#16842) 30b53d2
- telemetry_history and forges answer in a summary by default, with detail on request (#16893) 2601f32
- Detaching a fork keeps objects its own forks still borrow (repack --keep-unreachable) (#16892) df30c44
- Talk never reads none of a large answer: past 40,000 characters the agent gets its shape and head, and how to ask narrower (#16877) 07a9130
- Main green: four new pages' bare 'No …' empty states use the shared words; the empty-words test runs first (#16874) b1a6173
- Daily proof waits for the release's check: a pending line is proved again until it settles (#16890) 8928766
- Observability 6: a Grafana-like view bar on top - time range, compare, variables - and a grid that fills (#16865) 2aecd66
- Boards show check and crew slots against capacity; Capacity is findable; /flow answers first (3.3 MB → capped) (#16830) ff9bc70
- Model review moves a crew member up only on that model's own better outcomes; scorecard by kind; rework and no-account lines on /crew (#16817) 1c64b14
- A template card lists the files it will create before it is chosen (#16822) 2da2af9
- Cost ledger: measure compute for deploys and agent runs, not only checks (#16841) 8a8c14a
4 earlier comments
The quiet period before a forge sleeps is now an admin setting, and the forges page and terminal both say when a forge sleeps and what that means. The 3 tests I added pass, as do the existing forge-sleep, front-wake, spawn-limits and week-line tests I ran, bun x tsc --noEmit is clean, and bun scripts/gate.ts --explain reads 0 fail. I did not run the full suite or bun scripts/design-lint.ts after the last two commits.
What changed
- New setting
forges.idle_minutesat/admin/limits. The default is 10, with its reason beside it.FORGE_CHILD_IDLE_Sis read only while the setting is unset. The sweep and the awake-set bookkeeping insrc/spawn/host.tsread it live throughidleAfterMs(env, db). - The page and the terminal say it. A new
sleepWords()insrc/spawn/sleep.tsstates when a forge sleeps, that its process exits and its data stays, and that the next visit, push or scheduled run wakes it. It appears as adata-sleepline on/forgesand at the top of the terminal's "Forges you sent" screen. - The sleep and drain path already existed. Cell children drain with
FORGE_DRAIN_LINGER_S=0and the front router already wakes them, so I did not rebuild it. - Docs:
docs/features/forge-sleep.mdis updated. - Reused: the existing
limits.tssettings registry andsettled/limitIsSetpattern, thefront-wakestub of the cell (copied into the new test), andanswerFromCell/sleepIdleChildren.
Tests (test/forge-idle-setting.test.ts)
- The setting wins over the env, which wins over the default.
- The sleep words are correct.
- One forge is woken, put to sleep by the sweep using the 3-minute setting, then hit with 12 concurrent requests. All 12 are answered with the right body from a single wake.
What I left out
- Scheduled app work. Crew runs that fall due already wake a sleeping cell through
wakeWhenDue. I did not add a wake for an app's own timers inside a sleeping child forge, so the third part of "scheduled work still runs" is only partly met. The doc says so. - Sweep interval. It is fixed at 60 s, so a 1-minute setting sleeps a forge within about 2 minutes.
- Page test. There is no test of the
/forgesline itself. The sharedsleepWordstext is tested directly. - Similarity gate. It noted the new test's stub as similar to the one in
front-wake.test.ts. I left it as a copy.
Try it: as an admin, open /forges and read the sleep line. Change "Quiet minutes before a forge sleeps" at /admin/limits and reload.
<!-- look-pages 5558199102e2 --> Look pages for 5558199, from the gate:
look pages (none): this pull changes src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
The look-pages note is answered, and the branch is pushed. The change itself is unchanged: an idle forge sleeps after a quiet period its owner sets at /admin/limits, and /forges and the terminal show it.
- Look pages: the new commit carries
Looks: /admin/limitsand aNo look:line saying/forgesonly gains one muted line and isn't inapp.looks. The gate couldn't trace the/settings/security/controlsroute, so this tells the reviewer which page to open. - Test inputs:
test/forge-idle-setting.test.tshas noas neveroras any. - Issue number: the earlier commit that has a
Direction:line already carries(#16855), and the gate's "name the issue" rule passes. - Dead-code and untimed-job tests: I didn't run these. The gate's rules were the only part I ran here, and none of them failed.
- Comment rewrap:
bun scripts/gate.ts --fixrewrapped nothing. It still notes one comment line over 100 columns insrc/spawn/host.ts, which it says the nightly rewrap handles on main. - Not addressed: the gate's duplicate-function note says
parentWithAsleepForgein my test resemblesasleepintest/front-wake.test.ts. I left them separate because mine also records sleep requests and their start timing differs. The duplicate scan also stopped after 8000 ms, so it compared only part of the tree.
To try it: open /forges as an admin, read the line about when a forge sleeps, and change the setting at /admin/limits.
🤖 Generated with Claude Code
Box 2 stays open: an app's own timer still doesn't wake a sleeping forge. I split it into #16918 rather than build it here. The other review points are done, and the branch is pushed. The new tests, tsc and the gate's rules pass. I didn't run the dead-code or untimed-job tests.
- Box 2 (app timers): crew work due already wakes a sleeping forge through
wakeWhenDue. #16918 covers arming that same path from an app's timer, anddocs/features/forge-sleep.mdnow says the app-timer wake is not built yet and points to it. That tidies the "It sleeps:" line too. - Shorter words:
sleepWordsis now one sentence: "A forge nobody has asked for in N minutes goes to sleep; its data stays." The/admin/limitspointer is gone, so non-admins no longer see a link they can't use. - Page and terminal tests: in
test/clients-week-line.test.ts,/forgesmust show thedata-sleepline with the set 7 minutes, and nothing when the list is empty. The terminal's forges screen, driven through a headless terminal, must contain the same words. I removed the terminal line to check, and the test failed. - Sleep racing a request: in
test/forge-idle-setting.test.ts, the stubbed cell's drain now holds until released. Requests arrive while the sweep is mid-sleep and more arrive after, and every one is answered. The original burst-after-sleep stub test stays.
Box 3 is still shown only against a stubbed cell, not a real process drain. The cell suites are skipped in my sandbox, so the forge's check covers them.
The gate still flags parentWithAsleepForge as similar to asleep in test/front-wake.test.ts. I kept them separate because mine also records sleep requests and holds the drain. Its duplicate scan stopped at 8000 ms, so it only compared part of the tree.
To try it: open /forges as an admin and read the sleep line. Change the minutes at /admin/limits and reload.
🤖 Generated with Claude Code
Left #16855 open: 1 unticked item remain (Scheduled work an app owns still runs (it wakes the forge), and the forge's page says plainly when it sleeps and what that means.).
The quiet period before a forge sleeps is now an admin setting, and the forges page and terminal both say when a forge sleeps and what that means. The 3 tests I added pass, as do the existing forge-sleep, front-wake, spawn-limits and week-line tests I ran,
bun x tsc --noEmitis clean, andbun scripts/gate.ts --explainreads 0 fail. I did not run the full suite orbun scripts/design-lint.tsafter the last two commits.What changed
forges.idle_minutesat/admin/limits. The default is 10, with its reason beside it.FORGE_CHILD_IDLE_Sis read only while the setting is unset. The sweep and the awake-set bookkeeping insrc/spawn/host.tsread it live throughidleAfterMs(env, db).sleepWords()insrc/spawn/sleep.tsstates when a forge sleeps, that its process exits and its data stays, and that the next visit, push or scheduled run wakes it. It appears as adata-sleepline on/forgesand at the top of the terminal's "Forges you sent" screen.FORGE_DRAIN_LINGER_S=0and the front router already wakes them, so I did not rebuild it.docs/features/forge-sleep.mdis updated.limits.tssettings registry andsettled/limitIsSetpattern, thefront-wakestub of the cell (copied into the new test), andanswerFromCell/sleepIdleChildren.Tests (
test/forge-idle-setting.test.ts)What I left out
wakeWhenDue. I did not add a wake for an app's own timers inside a sleeping child forge, so the third part of "scheduled work still runs" is only partly met. The doc says so./forgesline itself. The sharedsleepWordstext is tested directly.front-wake.test.ts. I left it as a copy.Try it: as an admin, open
/forgesand read the sleep line. Change "Quiet minutes before a forge sleeps" at/admin/limitsand reload.Closes #16855