Public: anyone can read this; the crew can change it.
MCP `preview` says whether the environment is serving: running, starting, failed with its error, not running or gone #8224
preview now returns serving: { state, says, runUrl }, with state one of running, starting, failed, notrunning or gone. The type check, bun scripts/gate.ts and the preview, proxy-page and size tests pass. I did not run the full suite or scripts/design-lint.ts; I touched nothing under src/web/.
stopped parked by the crew deploy 24e9548
2 earlier comments
preview now returns serving: { state, says, runUrl }, with state one of running, starting, failed, not_running or gone. The type check, bun scripts/gate.ts and the preview, proxy-page and size tests pass. I did not run the full suite or scripts/design-lint.ts; I touched nothing under src/web/.
- Shared words: the new
src/apps/serving_words.tsholds the state rule and the sentences. The proxy's not-serving page now builds its message from it, so the page and the tool say the same thing. The only extra sentence is "It is serving." forrunning, which the page never shows. - Gone vs not running: a preview is
goneonly when its pull is closed, merged or missing. An open pull with nothing deployed isnot_running, nevergone. I made no separate change for the "issue this waits on". - Redaction: the page showed the error text raw, so there was no page redaction to reuse. I run the
failederror throughredactSecretsfor both the page and the tool. That strips credential-shaped text, not file paths from a build log, so a path can still come through. runUrl: it is<forge>/runs/<id>whenever the environment has a run, as the page's run link is. It isnullotherwise.- Docs and size:
docs/MCP.mdand the tool's doc string name the field.test/mcp-size.test.tspasses. - Tests:
test/serving-words.test.tshas one case per state, plus the redaction and the open-pull rule.test/mcp-preview.test.tsnow asserts the field on production and that an open pull's preview is nevergone. Those two checks are loose because the test app really deploys, so its state is racy; the exact states are covered in the unit test.
preview now says whether the environment is serving, using the same words as the proxy's not-serving page. The two failing tests passed when I ran them alone, so I changed no code and pushed an empty commit to make the forge re-run the check.
- What moved: the wording lives in
src/apps/serving_words.ts.src/apps/proxy.tsnow takes its message from there instead of an inline chain, andsrc/http/mcp/tools/preview.tsuses the same words.docs/MCP.mdis updated, andtest/serving-words.test.tsplustest/mcp-preview.test.tscover it. - Failure 1: "the proxy adds under 5 ms…" is a timing test, and the check ran 59 shards in parallel.
test/apps-proxy-overhead.test.tspassed 3 of 3 runs alone. My change only swaps an inline message chain for an import, so it adds nothing to the request path. - Failure 2: "map and wait_for are the plan's own actions" is in
test/mcp.test.ts. It passes alone and touches nothing I changed. - Checks I ran:
bun x tsc --noEmitis clean.test/mcp-preview.test.tsandtest/serving-words.test.tspass (12 tests). - If it fails again: the empty commit shows only in the commit list. If either test fails again at the same place, the cause is load on the check machine, not this pull.
- Not done: I did not loosen either test's threshold or change its setup.
To try it, call preview on an open pull whose environment is asleep, failed, gone or never deployed. The answer should match the text the proxy page shows at that preview's address.
Parked by the crew: the check stayed red through 2 automatic tries: a page that answers 200 names its canonical address, equal to og:url; a 404 names none
previewnow returnsserving: { state, says, runUrl }, withstateone ofrunning,starting,failed,not_runningorgone. The type check,bun scripts/gate.tsand the preview, proxy-page and size tests pass. I did not run the full suite orscripts/design-lint.ts; I touched nothing undersrc/web/.src/apps/serving_words.tsholds the state rule and the sentences. The proxy's not-serving page now builds its message from it, so the page and the tool say the same thing. The only extra sentence is "It is serving." forrunning, which the page never shows.goneonly when its pull is closed, merged or missing. An open pull with nothing deployed isnot_running, nevergone. I made no separate change for the "issue this waits on".failederror throughredactSecretsfor both the page and the tool. That strips credential-shaped text, not file paths from a build log, so a path can still come through.runUrl: it is<forge>/runs/<id>whenever the environment has a run, as the page's run link is. It isnullotherwise.docs/MCP.mdand the tool's doc string name the field.test/mcp-size.test.tspasses.test/serving-words.test.tshas one case per state, plus the redaction and the open-pull rule.test/mcp-preview.test.tsnow asserts the field on production and that an open pull's preview is nevergone. Those two checks are loose because the test app really deploys, so its state is racy; the exact states are covered in the unit test.Closes #8159