refactor: use command lane enum

This commit is contained in:
Peter Steinberger
2026-01-20 10:50:18 +00:00
parent e5f7435d9f
commit 48f733e4b3
7 changed files with 32 additions and 17 deletions

View File

@@ -1,9 +1,10 @@
import type { loadConfig } from "../config/config.js";
import { resolveAgentMaxConcurrent, resolveSubagentMaxConcurrent } from "../config/agent-limits.js";
import { setCommandLaneConcurrency } from "../process/command-queue.js";
import { CommandLane } from "../process/lanes.js";
export function applyGatewayLaneConcurrency(cfg: ReturnType<typeof loadConfig>) {
setCommandLaneConcurrency("cron", cfg.cron?.maxConcurrentRuns ?? 1);
setCommandLaneConcurrency("main", resolveAgentMaxConcurrent(cfg));
setCommandLaneConcurrency("subagent", resolveSubagentMaxConcurrent(cfg));
setCommandLaneConcurrency(CommandLane.Cron, cfg.cron?.maxConcurrentRuns ?? 1);
setCommandLaneConcurrency(CommandLane.Main, resolveAgentMaxConcurrent(cfg));
setCommandLaneConcurrency(CommandLane.Subagent, resolveSubagentMaxConcurrent(cfg));
}

View File

@@ -9,6 +9,7 @@ import {
} from "../infra/restart.js";
import { setCommandLaneConcurrency } from "../process/command-queue.js";
import { resolveAgentMaxConcurrent, resolveSubagentMaxConcurrent } from "../config/agent-limits.js";
import { CommandLane } from "../process/lanes.js";
import { isTruthyEnvValue } from "../infra/env.js";
import type { ChannelKind, GatewayReloadPlan } from "./config-reload.js";
import { resolveHooksConfig } from "./hooks.js";
@@ -127,9 +128,9 @@ export function createGatewayReloadHandlers(params: {
}
}
setCommandLaneConcurrency("cron", nextConfig.cron?.maxConcurrentRuns ?? 1);
setCommandLaneConcurrency("main", resolveAgentMaxConcurrent(nextConfig));
setCommandLaneConcurrency("subagent", resolveSubagentMaxConcurrent(nextConfig));
setCommandLaneConcurrency(CommandLane.Cron, nextConfig.cron?.maxConcurrentRuns ?? 1);
setCommandLaneConcurrency(CommandLane.Main, resolveAgentMaxConcurrent(nextConfig));
setCommandLaneConcurrency(CommandLane.Subagent, resolveSubagentMaxConcurrent(nextConfig));
if (plan.hotReasons.length > 0) {
params.logReload.info(`config hot reload applied (${plan.hotReasons.join(", ")})`);