refactor: centralize agent concurrency defaults

This commit is contained in:
Peter Steinberger
2026-01-20 10:27:58 +00:00
parent d88b239d3c
commit 213d9b47b0
8 changed files with 79 additions and 11 deletions

View File

@@ -1,8 +1,18 @@
import type { loadConfig } from "../config/config.js";
import {
DEFAULT_AGENT_MAX_CONCURRENT,
DEFAULT_SUBAGENT_MAX_CONCURRENT,
} from "../config/agent-limits.js";
import { setCommandLaneConcurrency } from "../process/command-queue.js";
export function applyGatewayLaneConcurrency(cfg: ReturnType<typeof loadConfig>) {
setCommandLaneConcurrency("cron", cfg.cron?.maxConcurrentRuns ?? 1);
setCommandLaneConcurrency("main", cfg.agents?.defaults?.maxConcurrent ?? 4);
setCommandLaneConcurrency("subagent", cfg.agents?.defaults?.subagents?.maxConcurrent ?? 8);
setCommandLaneConcurrency(
"main",
cfg.agents?.defaults?.maxConcurrent ?? DEFAULT_AGENT_MAX_CONCURRENT,
);
setCommandLaneConcurrency(
"subagent",
cfg.agents?.defaults?.subagents?.maxConcurrent ?? DEFAULT_SUBAGENT_MAX_CONCURRENT,
);
}