Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(mcp): cap ui-apps build concurrency to avoid oom (#60156)

Raúl Negrón-Oterod80d0848eb61
diff --git a/services/mcp/scripts/build-ui-apps.ts b/services/mcp/scripts/build-ui-apps.ts
index 5cf863a70666..5a0877588ee9 100644
--- a/services/mcp/scripts/build-ui-apps.ts
+++ b/services/mcp/scripts/build-ui-apps.ts
@@ -66,8 +66,11 @@ function buildAppAsync(appName: string): Promise<void> {
}
async function buildAllAppsParallel(apps: string[]): Promise<void> {
- // CI environments have limited memory — limit concurrency to avoid OOM kills
- const concurrency = process.env.CI ? 4 : apps.length
+ // Each Vite build peaks at a few hundred MB, so cap parallelism: the summed
+ // peak of an unbounded run (one process per app) OOM-kills memory-constrained
+ // builders — e.g. the Docker image build, where 27 concurrent Vite processes
+ // saturated the builder. The constraint is memory, not which environment we run in.
+ const concurrency = Math.min(apps.length, 4)
if (concurrency < apps.length) {
console.info(`\n📦 Building ${apps.length} apps (concurrency: ${concurrency})...`)