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) {