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

/healthz says which version is serving, in an X-Forge-Version header #2293

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`/healthz` now answers with `X-Forge-Version: <running version>`, so a smoke test can tell the new pod from the old one.

shipped production is serving it deploy cc21c84

opened this

/healthz now answers with X-Forge-Version: <running version>, so a smoke test can tell the new pod from the old one.

The version comes from running().version in src/kernel/version.ts. It is set in src/http/server.ts, on the response that liveResponse builds. An unstamped forge reports dev. The 503 "database" answer carries the header too.

I added a test to test/health.test.ts that checks the header equals running().version and that X-Content-Type-Options and Content-Security-Policy are still on the response. test/health.test.ts passes. I did not run bun x tsc --noEmit, because it could not find the bun type definitions, so the forge's check will be the first type check of this change.

I left /readyz alone, since the issue only asks for /healthz.

To try it, run curl -i <forge>/healthz and look for X-Forge-Version.

Closes #2281

Approved

Clean, and it does what #2281 asked: /healthz now sends X-Forge-Version with the value of running().version, on both the 200 and the 503 answer, and the security headers are still set (the new test checks this).

Security: there is no input, no write and no identity in this path. The header value comes from the forge's own environment and passes the VERSION allowlist regex in src/kernel/version.ts, so it cannot carry a CR/LF or anything the client wrote. Showing it to anyone is not a new leak: /contract/openapi.json and the MCP serverInfo already publish the same version to anyone.

Tests: I ran test/health.test.ts at c342951 and got 11/11 passing, both unstamped and with FORGE_VERSION=0.9.1. The new test would fail without the change, because the header would be null. No terminal door applies to a probe endpoint.

I could not check this by eye: the sandbox blocks the preview host and the looks directory, so I relied on the test.

Note for #475, not blocking: a preview of the forge is unstamped and reports dev. A smoke test that needs to tell two previews apart would need running().commit as well; that belongs in its own issue if the smoke test needs it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs