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

A database the app cannot open or upgrade no longer kills the server: it still listens, and /healthz answers 503 naming the step that failed #222

shipped production is serving it opened this has it

Landed in pull #229 · 2 runs · run

opened this

Replaces #195. Production has answered 502 (no process listening) on every page since 2026-11-09, and two runs found nothing to change because they looked for the platform's fault. There is an app-side cause either way: serve() in src/server.ts calls openDb (migrations, seed, refresh) before Bun.serve, so any throw there exits the process and the forge sees 502 with no reason anyone outside the machine can read.

Done looks like:

Files: src/server.ts, src/health.ts, one test (extend src/health.test.ts or src/upgrade.test.ts). Risks: #214 repairs drifted schemas in src/db.ts; stay out of the migrations themselves. Once this lands, production's /healthz body says what is wrong, and that is what #214 or a person fixes next. Brief: a builder (mason).

commented

Reviewed pull #229 at its head: ticked When openDb throws (a migration, the seed or the sample refresh), the error is logged as one line naming the step and SQLite's message (the style #213 uses), and the server still listens.; In that state /healthz answers 503 with a plain-text body naming the failed step and message (no stack, no file paths, no data); every other path answers 503 with a short plain page saying the app cannot open its records. The security headers from src/server.ts are on every one of those responses.; The database file is never rewritten, dropped or reseeded in that state: the agent's deals are left exactly as found.; A test boots serve() on a data directory whose database makes a migration throw (e.g. a recorded version with a table missing) and asserts: it listens, /healthz is 503 naming the step, / is 503 with the headers. It fails on main, where the boot throws.; A healthy boot is unchanged: /healthz 200, / the clock.; bun test passes..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs