perf(dashboard): start project engines in background

Awaiting engineManager.startAll() during dashboard startup blocked the
TUI on the slowest project's git/state init. Engine startup now runs
fire-and-forget; the reconciliation loop and the server's on-access
fast path cover any engine the user reaches before it's up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-19 11:12:06 -07:00
parent 6d68c2d73b
commit d467725c74
2 changed files with 13 additions and 2 deletions

View File

@@ -1515,8 +1515,14 @@ export async function runDashboard(port: number, opts: { paused?: boolean; dev?:
getTaskMergeBlocker,
});
// Start engines for all registered projects eagerly
await engineManager.startAll();
// Start engines for all registered projects in the background. The
// on-access fast path (server's onProjectFirstAccessed) and the
// reconciliation loop below both cover correctness, so awaiting here
// just blocks the TUI on the slowest project's git/state init.
void engineManager.startAll().catch((err) => {
const message = err instanceof Error ? err.message : String(err);
logSink.warn(`Background engine startup failed: ${message}`, "dashboard");
});
let hybridExecutor: HybridExecutor | undefined = undefined;
const hybridGate = await shouldUseHybridExecutor(centralCoreForEngine);