Gateway: keep auto-enabled plugin config through startup

This commit is contained in:
Gustavo Madeira Santana
2026-03-28 00:48:18 -04:00
parent 5167841ff8
commit 470d6aee0f

View File

@@ -551,12 +551,16 @@ export async function startGatewayServer(
}
initSubagentRegistry();
const defaultAgentId = resolveDefaultAgentId(cfgAtStart);
const defaultWorkspaceDir = resolveAgentWorkspaceDir(cfgAtStart, defaultAgentId);
const gatewayPluginConfigAtStart = applyPluginAutoEnable({
config: cfgAtStart,
env: process.env,
}).config;
const defaultAgentId = resolveDefaultAgentId(gatewayPluginConfigAtStart);
const defaultWorkspaceDir = resolveAgentWorkspaceDir(gatewayPluginConfigAtStart, defaultAgentId);
const deferredConfiguredChannelPluginIds = minimalTestGateway
? []
: resolveConfiguredDeferredChannelPluginIds({
config: cfgAtStart,
config: gatewayPluginConfigAtStart,
workspaceDir: defaultWorkspaceDir,
env: process.env,
});
@@ -566,7 +570,7 @@ export async function startGatewayServer(
let baseGatewayMethods = baseMethods;
if (!minimalTestGateway) {
({ pluginRegistry, gatewayMethods: baseGatewayMethods } = loadGatewayStartupPlugins({
cfg: cfgAtStart,
cfg: gatewayPluginConfigAtStart,
workspaceDir: defaultWorkspaceDir,
log,
coreGatewayHandlers,
@@ -671,7 +675,11 @@ export async function startGatewayServer(
}
const serverStartedAt = Date.now();
const channelManager = createChannelManager({
loadConfig,
loadConfig: () =>
applyPluginAutoEnable({
config: loadConfig(),
env: process.env,
}).config,
channelLogs,
channelRuntimeEnvs,
resolveChannelRuntime: getChannelRuntime,
@@ -1317,7 +1325,7 @@ export async function startGatewayServer(
if (!minimalTestGateway) {
if (deferredConfiguredChannelPluginIds.length > 0) {
({ pluginRegistry } = reloadDeferredGatewayPlugins({
cfg: cfgAtStart,
cfg: gatewayPluginConfigAtStart,
workspaceDir: defaultWorkspaceDir,
log,
coreGatewayHandlers,
@@ -1326,7 +1334,7 @@ export async function startGatewayServer(
}));
}
({ pluginServices } = await startGatewaySidecars({
cfg: cfgAtStart,
cfg: gatewayPluginConfigAtStart,
pluginRegistry,
defaultWorkspaceDir,
deps,