Public: anyone can read this; the crew can change it.
A front router wakes an asleep forge on its first request and says "waking…" while it does #16882
Check · Review · Land · Live done — Landed and live in production.
A browser is now held only 1.5 s at an asleep forge before it gets the "waking up" page. API calls, git clients and POSTs are still held for up to 20 s and never get HTML. I ran four test files, which pass (front-wake, spawn-cell-stays, first-ten-minutes, spawn-cell).
-
Reviews
ApprovedSmall, correct split by client kind on top of the existing single-start wake path. A navigating GET/HEAD that accepts HTML is held 1.5 s and then gets the self-refreshing 503 page; API, git and POST are held up to 20 s and never shown HTML. The tests cover one start for concurrent requests, the page versus held kinds, and the p95. Docs are updated in docs/features/forge-sleep.md, not the README. I did not exercise the preview, so this is a read of the diff and tests.
Two things I would do next:
- A Try-it line or a real-cell wake check in the forge's own check, since the p95 test stubs the cell start and measures router overhead only.
- A browser navigation that sends no Accept header (some embedded webviews do) is treated as an API client and held 20 s. Consider treating a missing Accept on GET as a page, or capping that case lower.
-
Checks
shipped production is serving it deploy 63ed874
-
History
- front-wake test: mark the start's sleep as a real timer 26ac0cc
- Front router: a browser is held 1.5 s then shown the waking page; API, git and POST are held (#16854) a021bf3
- Cost ledger: measure compute for deploys and agent runs, not only checks (#16841) 8a8c14a
- Two order-dependent flakes made deterministic: tui-crawlers pins loop lag; job-alloc measures a kept buffer after a full collection (#16875) b5f87f0
- Checks run rule and scan tests first and stop on their red (a rule red in ~2 min, not 14) (#16866) 372ce5e
- cloud_accounts answers in a few lines per account, and Talk asks infra about machines and cost (#16869) d7b5e43
- small-machine-off test runs past its 2s per-test budget under load (#16839) 8f7b949
- Crew briefs carry the week's recurring refusals in the gate's own words; commit before gate (#16818) f2f074a
- Talk carries on by itself and keeps a live plan; a quiet turn says what it waits on (#16624) aa9eb22
- The cache spectrum, chosen on purpose: in-process snapshots, SQLite, the edge's own cache, and a global read-cheap config pushed to the edge in seconds; offered to apps (#16824) 7104c92
- A DXF drawing measures: pick two points and read the distance in the drawing's units (#16827) 8d02ba4
- A weekly design wave: a designer role passes over every page and component (tabs first), fixes small things as pulls, and files design asks for next time (#16253) 9bea861
- Database: one-shot compaction at boot (opt-in), incremental vacuum after, decision retention (#16726) c90d084
- A wave's changelog line for each landed pull is that pull's own first sentence, grouped by pillar (#16811) 0496446
- Sentinel: memory-growth was degraded 12 minutes today: The forge's own memory is 4183 MiB, over twice its first-hour 1629 MiB and past the 2176 MiB more its database caches m… (#16828) 814939d
- The Data tab of an SQLite file filters a table by one column's value, from the address (#16823) 8b76613
- Peek cards: read 4 KB of a body and strip markup in one pass (review fix missed by #16700) (#16815) 1be49ab
- One acceptance test opens a board JSON, an STL, a PDF, a CSV and an mp4 on the blob page and each renders with its view switch (#16825) 860d8a7
- The edge keeps the last Resilience page and serves it, marked as a copy, while the forge is down (#16793) c02779f
- Open-pull ceiling: a pull handed to a person after changes were requested does not count (#16717) 58f6866
A browser is now held only 1.5 s at an asleep forge before it gets the "waking up" page. API calls, git clients and POSTs are still held for up to 20 s and never get HTML. I ran four test files, which pass (front-wake, spawn-cell-stays, first-ten-minutes, spawn-cell). tsc and the gate are clean. I did not run the full suite.
Most of this already existed. answerFromCell and settleCell in src/spawn/host.ts already start an asleep cell forge on the first request, share one start between concurrent requests, and hold requests until it answers. The wakingResponse page and the wakeMs measurement were there too. What was missing was the split by kind of client. Before, every client waited the full 20 s, so a browser saw the waking page only after that.
What changed
patienceOf(request)insrc/spawn/host.tspicks the wait. A GET or HEAD that accepts HTML waitswakeLimits.pageMs(1.5 s, new), then gets the self-refreshing page. Everything else waitswakeLimits.waitMs(20 s).- A POST stays on the long wait because a refresh would lose its body.
test/front-wake.test.tsis new. It covers:- Wake time: 20 wakes against a stubbed 20 ms cell start, with p95 asserted under 1 s.
- One start: four concurrent requests (browser, API, POST, wildcard) are all served by a single start.
- Client kinds: a browser gets the refresh page while API, git and POST get the upstream answer.
docs/features/forge-sleep.mddescribed the old behaviour ("waking up page at once; git and API wait up to 4 s"), so I corrected it.
Left out
- No new router. One router owning every forge's address on a machine already exists as the parent's host routing, so I extended it instead of adding a process.
- Stubbed cell start. The sandbox skips real cells, so the p95 test measures the router's overhead, not a real cell boot. The forge's own check is where real cells run.
- Hosted children. Only cell forges are touched. Children hosted in-process open synchronously.
- No
Try:line. The change is insrc/spawn, so I did not add one.
To try: bun test test/front-wake.test.ts. On a preview, curl -H 'accept: text/html' and curl -H 'accept: application/json' against a sleeping forge's address.
The front router now wakes an asleep forge: a browser is held 1.5 s and then shown the waking page, while API, git and POST requests are held until the forge is up. This push only fixes the failing gate rule.
- What changed since the last push:
test/front-wake.test.ts:43now ends with// real-timer: <why>. The test simulates a cell start with a realBun.sleep, because the router under test holds a browser on a real 1.5 s timer. A fake clock would not exercise that path. No behaviour changed. - Checks I ran: after committing,
bun scripts/gate.tsno longer reports the rule, andbun x tsc --noEmitis clean.bun test test/front-wake.test.tspassed (4 tests) on the first attempt. I did not re-run it after the one-line comment change. - Not done: the gate's note about a long comment line in
src/spawn/host.tsis untouched. It is outside this change, and the nightly rewrap handles it. The gate's duplicate scan also stopped after 8 s and compared against only part of the tree. - To try it:
bun test test/front-wake.test.ts.
A browser is now held only 1.5 s at an asleep forge before it gets the "waking up" page. API calls, git clients and POSTs are still held for up to 20 s and never get HTML. I ran four test files, which pass (
front-wake,spawn-cell-stays,first-ten-minutes,spawn-cell).tscand the gate are clean. I did not run the full suite.Most of this already existed.
answerFromCellandsettleCellinsrc/spawn/host.tsalready start an asleep cell forge on the first request, share one start between concurrent requests, and hold requests until it answers. ThewakingResponsepage and thewakeMsmeasurement were there too. What was missing was the split by kind of client. Before, every client waited the full 20 s, so a browser saw the waking page only after that.What changed
patienceOf(request)insrc/spawn/host.tspicks the wait. A GET or HEAD that accepts HTML waitswakeLimits.pageMs(1.5 s, new), then gets the self-refreshing page. Everything else waitswakeLimits.waitMs(20 s).test/front-wake.test.tsis new. It covers:docs/features/forge-sleep.mddescribed the old behaviour ("waking up page at once; git and API wait up to 4 s"), so I corrected it.Left out
Try:line. The change is insrc/spawn, so I did not add one.To try:
bun test test/front-wake.test.ts. On a preview,curl -H 'accept: text/html'andcurl -H 'accept: application/json'against a sleeping forge's address.Closes #16854