From c976d75d8d4e1adbed35566805fda53b0b4e86b3 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Thu, 2 Jul 2026 21:53:05 -0700 Subject: [PATCH] fix(dashboard): start the engine on project creation so it isn't reported unavailable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POST /api/projects registered a project but only started its engine lazily on the first scoped store access, so a freshly-created project — especially the operator's FIRST project on the desktop, where no other engine is running — left engineManager with no running engine. The dashboard's project view then showed "AI engine is not running" (EngineUnavailableBanner keys off /api/health engine.available). Proactively warm the engine via getOrCreateProjectStore (fires the onProjectFirstAccessed hook -> engineManager.onProjectAccessed -> ensureEngine) right after the project is activated, fire-and-forget so it never blocks/fails the registration response. Co-Authored-By: Claude Opus 4.8 --- .../dashboard/src/routes/register-project-routes.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/dashboard/src/routes/register-project-routes.ts b/packages/dashboard/src/routes/register-project-routes.ts index fd6694353e..c1c673e6d7 100644 --- a/packages/dashboard/src/routes/register-project-routes.ts +++ b/packages/dashboard/src/routes/register-project-routes.ts @@ -426,6 +426,19 @@ export const registerProjectRoutes: ApiRouteRegistrar = (ctx) => { return { activeProject, outcome: ensured.outcome }; }); + /* + * FNXC:Onboarding 2026-07-03-05:40: + * Proactively warm the new project's engine on creation. getOrCreateProjectStore fires the + * onProjectFirstAccessed hook (engineManager.onProjectAccessed -> ensureEngine), so the + * project's engine starts immediately instead of waiting for the first lazy store access. + * Without this, a freshly-created project (especially the operator's FIRST project on the + * desktop, where no other engine is running) leaves engineManager with no running engine, so + * /api/health reports engine.available=false and the dashboard shows "AI engine is not + * running" right after project creation. Fire-and-forget: engine startup is async and must not + * block or fail the registration response. + */ + void getOrCreateProjectStore(activeProjectWithOutcome.activeProject.id).catch(() => undefined); + // Bootstrap memory files (non-blocking, non-fatal) ensureMemoryFileWithBackend(normalizedPath).catch(() => { // Memory bootstrap failure is non-fatal - project registration succeeded