From 224afadbdba6b7e4da581791951cb540a5255451 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Wed, 4 Feb 2026 15:03:57 +0900 Subject: [PATCH] fix(skill-loader): respect disabledSkills in async skill resolution --- .../opencode-skill-loader/skill-content.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/features/opencode-skill-loader/skill-content.ts b/src/features/opencode-skill-loader/skill-content.ts index 3dec3161..3b359629 100644 --- a/src/features/opencode-skill-loader/skill-content.ts +++ b/src/features/opencode-skill-loader/skill-content.ts @@ -19,8 +19,13 @@ function clearSkillCache(): void { async function getAllSkills(options?: SkillResolutionOptions): Promise { const cacheKey = options?.browserProvider ?? "playwright" - const cached = cachedSkillsByProvider.get(cacheKey) - if (cached) return cached + const hasDisabledSkills = options?.disabledSkills && options.disabledSkills.size > 0 + + // Skip cache if disabledSkills is provided (varies between calls) + if (!hasDisabledSkills) { + const cached = cachedSkillsByProvider.get(cacheKey) + if (cached) return cached + } const [discoveredSkills, builtinSkillDefs] = await Promise.all([ discoverSkills({ includeClaudeCodePaths: true }), @@ -53,8 +58,15 @@ async function getAllSkills(options?: SkillResolutionOptions): Promise s.name)) const uniqueBuiltins = builtinSkillsAsLoaded.filter((s) => !discoveredNames.has(s.name)) - const allSkills = [...discoveredSkills, ...uniqueBuiltins] - cachedSkillsByProvider.set(cacheKey, allSkills) + let allSkills = [...discoveredSkills, ...uniqueBuiltins] + + // Filter discovered skills by disabledSkills (builtin skills are already filtered by createBuiltinSkills) + if (hasDisabledSkills) { + allSkills = allSkills.filter((s) => !options!.disabledSkills!.has(s.name)) + } else { + cachedSkillsByProvider.set(cacheKey, allSkills) + } + return allSkills }