diff --git a/apps/webapp/app/env.server.ts b/apps/webapp/app/env.server.ts index 320362d384..3ec6fd2301 100644 --- a/apps/webapp/app/env.server.ts +++ b/apps/webapp/app/env.server.ts @@ -754,8 +754,8 @@ const EnvironmentSchema = z /** The max number of runs per API call that we'll dequeue in DEV */ DEV_DEQUEUE_MAX_RUNS_PER_PULL: z.coerce.number().int().default(10), - /** The maximum concurrent local run processes executing at once in dev */ - DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().default(25), + /** The maximum concurrent local run processes executing at once in dev. This is a hard limit */ + DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().optional(), /** The CLI should connect to this for dev runs */ DEV_ENGINE_URL: z.string().default(process.env.APP_ORIGIN ?? "http://localhost:3030"), diff --git a/apps/webapp/app/routes/engine.v1.dev.config.ts b/apps/webapp/app/routes/engine.v1.dev.config.ts index 73276b9f7d..bdf7e21054 100644 --- a/apps/webapp/app/routes/engine.v1.dev.config.ts +++ b/apps/webapp/app/routes/engine.v1.dev.config.ts @@ -20,7 +20,11 @@ export const loader = createLoaderApiRoute( environmentId: authentication.environment.id, dequeueIntervalWithRun: env.DEV_DEQUEUE_INTERVAL_WITH_RUN, dequeueIntervalWithoutRun: env.DEV_DEQUEUE_INTERVAL_WITHOUT_RUN, - maxConcurrentRuns: env.DEV_MAX_CONCURRENT_RUNS, + // Limit max runs to smaller of an optional global limit and the environment limit + maxConcurrentRuns: Math.min( + env.DEV_MAX_CONCURRENT_RUNS ?? authentication.environment.maximumConcurrencyLimit, + authentication.environment.maximumConcurrencyLimit + ), engineUrl: env.DEV_ENGINE_URL, }); } catch (error) {