fix(gateway): restart heartbeat on model config changes

This commit is contained in:
User
2026-03-03 02:42:32 +08:00
committed by Peter Steinberger
parent ee68fa86b5
commit e1e93d932f
2 changed files with 22 additions and 1 deletions

View File

@@ -147,6 +147,18 @@ describe("buildGatewayReloadPlan", () => {
expect(plan.restartChannels).toEqual(expected);
});
it("restarts heartbeat when model-related config changes", () => {
const plan = buildGatewayReloadPlan([
"models.providers.openai.models",
"agents.defaults.model",
]);
expect(plan.restartGateway).toBe(false);
expect(plan.restartHeartbeat).toBe(true);
expect(plan.hotReasons).toEqual(
expect.arrayContaining(["models.providers.openai.models", "agents.defaults.model"]),
);
});
it("treats gateway.remote as no-op", () => {
const plan = buildGatewayReloadPlan(["gateway.remote.url"]);
expect(plan.restartGateway).toBe(false);

View File

@@ -59,6 +59,16 @@ const BASE_RELOAD_RULES: ReloadRule[] = [
kind: "hot",
actions: ["restart-heartbeat"],
},
{
prefix: "agents.defaults.model",
kind: "hot",
actions: ["restart-heartbeat"],
},
{
prefix: "models",
kind: "hot",
actions: ["restart-heartbeat"],
},
{ prefix: "agent.heartbeat", kind: "hot", actions: ["restart-heartbeat"] },
{ prefix: "cron", kind: "hot", actions: ["restart-cron"] },
{
@@ -73,7 +83,6 @@ const BASE_RELOAD_RULES_TAIL: ReloadRule[] = [
{ prefix: "identity", kind: "none" },
{ prefix: "wizard", kind: "none" },
{ prefix: "logging", kind: "none" },
{ prefix: "models", kind: "none" },
{ prefix: "agents", kind: "none" },
{ prefix: "tools", kind: "none" },
{ prefix: "bindings", kind: "none" },