
























11// Gateway config mutation guard coverage keeps agent-driven config edits inside
22// the documented low-risk allowlist.
33import { describe, expect, it } from "vitest";
4-import {
5-ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST,
6-assertGatewayConfigMutationAllowedForTest,
7-} from "./gateway-tool.js";
4+import { assertGatewayConfigMutationAllowedForTest } from "./gateway-tool.js";
8596function expectBlocked(
107currentConfig: Record<string, unknown>,
@@ -59,23 +56,6 @@ function expectAllowedApply(
5956}
60576158describe("gateway config mutation guard coverage", () => {
62-it("keeps a narrow allowlist of agent-tunable config paths", () => {
63-// This list is the contract between the public gateway tool and protected
64-// operator-owned config surfaces.
65-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).not.toContain("agents.defaults.promptOverlays");
66-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).not.toContain("agents.defaults.model");
67-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("agents.defaults.subagents.thinking");
68-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("agents.list[].id");
69-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("agents.list[].model");
70-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("agents.list[].subagents.thinking");
71-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("channels.*.requireMention");
72-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("messages.visibleReplies");
73-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain("messages.groupChat.visibleReplies");
74-expect(ALLOWED_GATEWAY_CONFIG_PATHS_FOR_TEST).toContain(
75-"messages.groupChat.unmentionedInbound",
76-);
77-});
78-7959it("blocks global prompt overlay edits via config.patch", () => {
8060expectBlocked(
8161{ agents: { defaults: { promptOverlays: { gpt5: { personality: "off" } } } } },
@@ -167,7 +147,10 @@ describe("gateway config mutation guard coverage", () => {
167147{
168148messages: {
169149visibleReplies: "automatic",
170-groupChat: { visibleReplies: "automatic" },
150+groupChat: {
151+visibleReplies: "automatic",
152+unmentionedInbound: "user_request",
153+},
171154},
172155},
173156);
@@ -181,7 +164,10 @@ describe("gateway config mutation guard coverage", () => {
181164{
182165messages: {
183166visibleReplies: "message_tool",
184-groupChat: { visibleReplies: "automatic" },
167+groupChat: {
168+visibleReplies: "automatic",
169+unmentionedInbound: "room_event",
170+},
185171},
186172},
187173);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。