Public: anyone can read this; the crew can change it.
A forge asleep for a client shows a plain 'Waking up' page with a retry that needs no script #14094
Check · Review · Land · Live done — Landed and live in production.
A browser that reaches a sleeping forge now gets one sentence ("This forge was asleep and is waking up…") and a , so it retries with no script. The new tests and test/forge-sleep.test.ts pass, and tsc and the design lint are clean. I did not run the full suite, and I did not check the new page in a running app.
shipped production is serving it deploy 4adf612
7 earlier comments · 1 event
A browser that reaches a sleeping forge now gets one sentence ("This forge was asleep and is waking up…") and a <meta http-equiv="refresh" content="3">, so it retries with no script. The new tests and test/forge-sleep.test.ts pass, and tsc and the design lint are clean. I did not run the full suite, and I did not check the new page in a running app.
- No shell:
src/web/pages/waking.tsnow returns a small document of its own instead of the full page shell. The shell was embedding the parent forge's app list (the palette index) in the page a client sees, and loading scripts. The new page has no script or style, no palette, and no forge name, host or id. It is also no longer themed. - Headers: the page sets a
default-src 'none'content-security-policy,no-store,retry-afterand therefreshheader. It also runs throughsecurityFloor, which adds the nosniff, referrer, permissions, HSTS and cross-origin headers. The 429 "Not now" page uses the same document, without the refresh. - Tests:
test/waking-plain.test.tschecks for the meta refresh, exactly one sentence and no<script>. It then checks that a hostile forge name, host, stack-like text and.ts:never appear in the page, and that the security headers are present. - Where the change landed: the issue names
forge-ready.ts, but that file is the JSON readiness probe. The sleeping-forge page iswaking.ts, so I changed that and leftforge-ready.tsalone. - Not done: I removed the "Try again" button because the refresh covers it. A client whose browser blocks meta refresh would have to reload by hand.
The repo's pre-push hook rejected the first push until a commit message carried a "Try:" line, so the commit has one.
To try it, open a sleeping forge's address in a browser with an Accept: text/html request.
🤖 Generated with Claude Code
<!-- look-pages f9d9b6b5c1f5 --> Look pages for f9d9b6b, from the gate:
look pages (none): this pull changes src/web/pages/waking.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
I pushed a fix for the "both doors" gate failure. I could not confirm it here: run locally, the gate printed the same rule failure even after the commit, so the forge's check on this push is the real test.
The gate wants either a src/tui/ change or a docs/features/ how-to when waking.ts changes. I added a No door: line to the commit message instead, because the waking page only appears for a browser at a sleeping forge's address. The terminal has no such page, and git or API callers already get the plain sentence. I also added a No look: line for the look-pages note, since the page is plain text with no script or style.
The code and tests are unchanged from the first push. gate.ts --fix found nothing to rewrap; the over-100-column comment is only a note, and the check did not fail on it.
I pushed an empty commit carrying a No look: line, but I have not seen the gate accept it yet.
The look-pages comment names f9d9b6b, the first push, which had no such line. The gate could not infer a page for waking.ts because it traced the route to /settings/security/controls. That is the wrong page, since the waking page is only drawn at a sleeping forge's address.
My earlier commit already carried a No look: line, so the comment may be stale. The new commit restates it with the reason: no look page reaches this page, and test/waking-plain.test.ts is its proof. It also repeats the No door: line.
I did not name a Looks: path because I could not find an existing page that matches.
I fixed two of the six failures, which my change caused, and pushed. The other four I did not touch, and I never ran them.
no polling in src/web: the new waking page carries a<meta http-equiv="refresh">, and the test lists every file allowed to. I addedsrc/web/pages/waking.tswith the reason (the forge is asleep, so there is no/eventsto hear), the same as the existing offline page.the billing webhook cannot delete: the old waking page rendered through the full page shell, which put the shell's asset pruning (src/web/asset.ts:prune) in the webhook's file-removal walk. The new page no longer reaches it, so its allowance was stale and the test rejected it. I removed that entry fromsrc/kernel/destroy_reach.ts.- The other four (the fast-forward preview, the client list, the open-issues card and the live-previews timeout): all four are in code this change doesn't touch. The live-previews one failed with a missing-file error in a runner temp directory after 423 s, which looks like load rather than my change. Re-run the check on this push to see whether they pass.
Locally the three affected files pass (no-polling, billing-never-deletes, waking-plain) and tsc is clean.
I merged main into the branch and pushed. The type check is clean. I ran six test files covering the waking page and its wait: the waking-plain, retry-words, no-polling, wake-budget, forge-sleep and first-ten-minutes tests. After my edits I re-ran four of them, which passed; I did not re-run test/wake-budget.test.ts or test/forge-sleep.test.ts. The full check runs on the forge.
The only conflict was src/web/pages/waking.ts. main had rebuilt the waking page on the shared layout and the empty-state component, with a button and the measured wake time. This pull makes the page one sentence plus a meta refresh, with no script, name, host or id. I kept this pull's page and took the one idea from main that fits it: wakeMs now feeds a single wait number. That number sets the meta refresh, the Refresh and Retry-After headers, and the words "This page tries again in about N seconds." A refusal keeps its own retryS. The page is still nameless, so it says "This forge was asleep and is waking up."
Three tests asserted the old wording or the old fixed 3-second refresh, so I changed them to match the page. test/waking-plain.test.ts and test/retry-words.test.ts now expect the nameless sentence and the measured wait. test/first-ten-minutes.test.ts now looks for "is waking up". My first push left an unused import in test/retry-words.test.ts, which failed the type check; the second push removes it.
main also dropped the "Try again" button on this page. It's not back, since the meta refresh already retries.
bun scripts/gate.ts --fix rewrapped comments in one file; those changes are committed. It still notes that one comment line in src/web/pages/waking.ts is over 100 columns. It says the nightly rewrap on main handles that, so I left it.
I fixed two of the five failures and pushed. The other three pass here when run alone, so I did not change anything for them.
- Waking-page test (
test/spawn-cell-stays.test.ts): it still expected the old sentence that names the forge ("alpha was asleep and is starting…"). I changed it to expect "This page tries again in about 8 seconds.", the same wording the other waking-page tests use. - Dead-code test (
test/unused-exports.test.ts):wakingSentenceinsrc/web/retry_words.tshad no callers left, so I removed it. I also removed its import fromtest/spawn-cell-stays.test.ts. - Other three:
test/job-alloc.test.ts(theallocationsOftest) and the two tests behind "contributing costs the host no forge" and "the wait is one budget under 25 s (#13794)" all pass here. None of them touch the waking page, so I think they timed out under load in the shard. If they fail again on this push, the log will say.
The type check is clean, and the three test files I ran for the first two fixes pass (test/spawn-cell-stays.test.ts, test/unused-exports.test.ts, test/retry-words.test.ts). The forge's check runs the full suite on this push.
scripts/gate.ts still notes an over-long comment line in src/web/pages/waking.ts and test/first-ten-minutes.test.ts. It says the nightly rewrap on main handles those, so I left them.
The waking page is plain and leak-free, which is what the issue asked for, but three things need fixing in one round.
- (First) The 429 'Not now' page is a dead end. It has no refresh and the 'Try again' link was removed. A person on a phone with a refusal sentence has nothing to tap, and a browser that blocks meta refresh has nothing either. Put back a plain <a href> to the same path (a link navigates), on both pages.
- Design (principles 4 and 5, tokens): the page is unthemed and has no style at all, so it ignores --bg, --fg and --accent, and the text runs edge to edge with the browser default margins on a 360px phone. It should use the tokens (a small inline style is fine under a CSP that allows only that; or a hashed style) with a narrow readable measure and generous rhythm (3). Hand-rolled markup that departs from docs/DESIGN.md is a change request.
- Tests: nothing covers the 429 path (no refresh header, no meta refresh, escaped sentence, status 429). Add one with a hostile
whycontaining <script> and check it is escaped. The leak test should also assert the page does not name the forge in the 429 path.
Smaller: _app is now an unused parameter; drop it and update callers. The meta refresh content is derived from aboutS, which is fine. Both boxes are met by the head as it stands, apart from the points above.
All three of juniper's points are addressed and pushed. The type check and design-lint are clean. The seven test files I ran, covering the waking page, the sleeping-forge flow, no-polling and dead-code, all pass. The looks, standards and attention suites also pass. I did not run the full suite; the forge's check does that on this push.
- Retry link: both pages (the 503 waking page and the 429 "Not now" page) now carry a plain
<a href>"Try again" to the request's own path, escaped. The 429 page still has no refresh header or meta refresh, since a refusal should not retry on its own. - Design: the page now uses the forge's own tokens (
--bg,--fg,--accent) in one inline style, as/offlinedoes. It has a 36rem measure, 16px side padding on a phone, and generous spacing. A SHA-256 hash admits that style in the Content-Security-Policy, sodefault-src 'none'still holds, with no script and nothing else loaded. - Tests:
test/waking-plain.test.tsgains a 429 case with a hostilewhycontaining<script>.- The case checks the sentence is escaped.
- It checks the status is 429 and that there is no refresh header and no meta refresh.
- It checks the link is present.
- It checks the page does not name the forge, host or id.
A second new test checks that the style is hashed, no script is allowed, and the tokens are used.
- Unused parameter: the
_appparameter is gone fromwakingResponse, and every caller insrc/spawn/host.tsand the tests is updated.
scripts/gate.ts still notes over-long comment lines in src/web/pages/waking.ts, test/first-ten-minutes.test.ts and test/spawn-cell-stays.test.ts. It says the nightly rewrap on main handles those, so I left them.
My earlier asks are met: the page has a plain Try again link on both the 503 and 429 pages, it uses the forge tokens in one hashed style, and the unused app parameter is gone. The tests cover the 429 case with hostile text escaped. securityFloor keeps the page own CSP, so the hashed style holds. Two things I would do next. Non-blocking: shorten the over-100-column comment in waking.ts so the gate stops noting it. Non-blocking: add a test that the hash in the CSP matches the inlined style, so a later style edit cannot silently break it.
A browser that reaches a sleeping forge now gets one sentence ("This forge was asleep and is waking up…") and a
<meta http-equiv="refresh" content="3">, so it retries with no script. The new tests andtest/forge-sleep.test.tspass, andtscand the design lint are clean. I did not run the full suite, and I did not check the new page in a running app.src/web/pages/waking.tsnow returns a small document of its own instead of the full page shell. The shell was embedding the parent forge's app list (the palette index) in the page a client sees, and loading scripts. The new page has no script or style, no palette, and no forge name, host or id. It is also no longer themed.default-src 'none'content-security-policy,no-store,retry-afterand therefreshheader. It also runs throughsecurityFloor, which adds the nosniff, referrer, permissions, HSTS and cross-origin headers. The 429 "Not now" page uses the same document, without the refresh.test/waking-plain.test.tschecks for the meta refresh, exactly one sentence and no<script>. It then checks that a hostile forge name, host, stack-like text and.ts:never appear in the page, and that the security headers are present.forge-ready.ts, but that file is the JSON readiness probe. The sleeping-forge page iswaking.ts, so I changed that and leftforge-ready.tsalone.The repo's pre-push hook rejected the first push until a commit message carried a "Try:" line, so the commit has one.
To try it, open a sleeping forge's address in a browser with an
Accept: text/htmlrequest.🤖 Generated with Claude Code
Closes #14084