

















@@ -35,20 +35,18 @@ const MISSING_CONFIG_MAX_RETRIES = 2;
3535 */
3636const SKILLS_INVALIDATION_PREFIXES = ["skills"] as const;
373738-export function shouldInvalidateSkillsSnapshotForPaths(changedPaths: string[]): boolean {
39-return changedPaths.some((path) =>
40-SKILLS_INVALIDATION_PREFIXES.some(
41-(prefix) => path === prefix || path.startsWith(`${prefix}.`),
42-),
38+function matchesSkillsInvalidationPrefix(path: string): boolean {
39+return SKILLS_INVALIDATION_PREFIXES.some(
40+(prefix) => path === prefix || path.startsWith(`${prefix}.`),
4341);
4442}
45434644function firstSkillsChangedPath(changedPaths: string[]): string | undefined {
47-return changedPaths.find((path) =>
48- SKILLS_INVALIDATION_PREFIXES.some(
49- (prefix) => path === prefix || path.startsWith(`${prefix}.`),
50- ),
51-);
45+return changedPaths.find(matchesSkillsInvalidationPrefix);
46+}
47+48+export function shouldInvalidateSkillsSnapshotForPaths(changedPaths: string[]): boolean {
49+return firstSkillsChangedPath(changedPaths) !== undefined;
5250}
53515452export function diffConfigPaths(prev: unknown, next: unknown, prefix = ""): string[] {
@@ -194,12 +192,10 @@ export function startGatewayConfigReloader(opts: {
194192// the user touches skills.* config. Without this, sessions keep advertising
195193// tools that no longer exist in the allowlist, which causes infinite
196194// tool-not-found loops against the model.
197-if (shouldInvalidateSkillsSnapshotForPaths(changedPaths)) {
198-const changedPath = firstSkillsChangedPath(changedPaths);
199-bumpSkillsSnapshotVersion({ reason: "config-change", changedPath });
200-opts.log.info(
201-`skills snapshot invalidated by config change (${changedPath ?? "skills.*"})`,
202-);
195+const skillsChangedPath = firstSkillsChangedPath(changedPaths);
196+if (skillsChangedPath !== undefined) {
197+bumpSkillsSnapshotVersion({ reason: "config-change", changedPath: skillsChangedPath });
198+opts.log.info(`skills snapshot invalidated by config change (${skillsChangedPath})`);
203199}
204200205201opts.log.info(`config change detected; evaluating reload (${changedPaths.join(", ")})`);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。