From 85960351594596085ede009270800714d51f95a0 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Mon, 13 Jul 2026 20:01:04 -0700 Subject: [PATCH] fix: bind fallback CentralCore to the async layer so projectId-only boots resolve projects on PostgreSQL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getOrCreateForProjectImpl constructed its fallback CentralCore without the caller's AsyncDataLayer. Post-cutover a layer-less CentralCore has no database at all (the SQLite CentralDatabase path is deleted and init() degrades to a no-op), so project lookups returned empty and every projectId-only boot through the startup factory (engine InProcessRuntime, dashboard project-store-resolver) failed with 'Project "" not found' even though central.projects had the row — dashboard UI came up but the engine never connected. Co-Authored-By: Claude Fable 5 --- .../pg-central-core-layer-bound-project-lookup.md | 7 +++++++ packages/core/src/task-store/remaining-ops-1.ts | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/pg-central-core-layer-bound-project-lookup.md diff --git a/.changeset/pg-central-core-layer-bound-project-lookup.md b/.changeset/pg-central-core-layer-bound-project-lookup.md new file mode 100644 index 0000000000..6a8f0329e0 --- /dev/null +++ b/.changeset/pg-central-core-layer-bound-project-lookup.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Fix engine failing to connect after the PostgreSQL migration with "Project not found". +category: fix +dev: getOrCreateForProjectImpl built its fallback CentralCore without the AsyncDataLayer; post-cutover a layer-less CentralCore has no database (legacy SQLite CentralDatabase is deleted), so projectId-only boots (engine InProcessRuntime, dashboard project-store-resolver) threw ProjectRequiredError despite the row existing in central.projects. The fallback is now bound to the caller's layer. diff --git a/packages/core/src/task-store/remaining-ops-1.ts b/packages/core/src/task-store/remaining-ops-1.ts index fba8ae5b1e..e6f13d4482 100644 --- a/packages/core/src/task-store/remaining-ops-1.ts +++ b/packages/core/src/task-store/remaining-ops-1.ts @@ -43,7 +43,19 @@ import {listGoalCitations as listGoalCitationsAsync} from "../task-store/async-e import type {GoalCitationRow, RunAuditEventRow} from "../task-store/row-types.js"; export async function getOrCreateForProjectImpl(store: typeof TaskStore, projectId?: string, centralCore?: CentralCore, globalSettingsDir?: string, asyncLayer?: AsyncDataLayer,): Promise { - const central = centralCore ?? new CentralCore(); + /* + FNXC:PostgresCutover 2026-07-13-20:05: + The fallback CentralCore must be bound to the caller's AsyncDataLayer. + Post-cutover, a layer-less CentralCore has no database at all (legacy + SQLite CentralDatabase is deleted; init() is a graceful no-op with + db=null), so project lookups return empty and resolveProjectContext + throws ProjectRequiredError — surfaced as `Project "" not found` + even though central.projects in PostgreSQL has the row. This broke every + projectId-only boot through the startup factory (engine InProcessRuntime, + dashboard project-store-resolver): dashboard UI came up but the engine + never connected. + */ + const central = centralCore ?? new CentralCore(undefined, asyncLayer ? { asyncLayer } : {}); let initializedHere = false; if (!centralCore) {