diff --git a/src/backend_server.py b/src/backend_server.py index 2f85ddc..9788236 100644 --- a/src/backend_server.py +++ b/src/backend_server.py @@ -1000,6 +1000,19 @@ def _ensure_schema(conn): ).fetchone() if exists is None: schema.create_schema(conn) + # 2026-08-06 (real incident): create_schema() above only ever runs for a + # BRAND NEW db file. Every schema.migrate_*() function is documented as + # idempotent/safe-to-call-unconditionally (including against a fresh + # create_schema()'d db, which already has whatever they'd add), but + # nothing ever actually called them against an EXISTING, already- + # populated database until now -- caught for real when this exact + # process restarted against the live production db and every + # GET /api/tasks/:id started 500ing with "no such column: parent_run_id" + # (D's migrate_add_work_graph_fork_columns had shipped and been tested, + # but never wired into the one code path that runs on every real + # startup). Run all three every time, not just on first-ever creation. + schema.migrate_expand_artifact_types(conn) + schema.migrate_relax_org_node_constraints(conn) # also runs migrate_add_work_graph_fork_columns internally class _Server(ThreadingHTTPServer):