fix: invalidate skills cache with loadSkills directory key

performConfigRefresh passed client-directory-first path into
invalidateSkillsLoadCache, missing the active-project cache key used by
loadSkills after the repository-local skills discovery fix.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-03 08:23:37 +00:00
co-authored by Serhii Dziupin
parent 049600df72
commit 576791d024
2 changed files with 19 additions and 1 deletions
+3 -1
View File
@@ -700,7 +700,9 @@ async function performConfigRefresh(options: {
uiRefreshTasks.push(commandsStore.loadCommands().then(() => undefined));
}
if (refreshSkills) {
invalidateSkillsLoadCache(currentDirectory);
// Match loadSkills cache key (active-project-first). Passing client/directory-store
// path here misses the key when those diverge after getRequestDirectory().
invalidateSkillsLoadCache();
uiRefreshTasks.push(skillsStore.loadSkills().then(() => undefined));
uiRefreshTasks.push(skillsCatalogStore.loadCatalog({ refresh: true }).then(() => undefined));
}
@@ -100,4 +100,20 @@ describe('useSkillsStore directory resolution', () => {
group: undefined,
}]);
});
test('invalidateSkillsLoadCache() with no argument clears the active-project cache key used by loadSkills', async () => {
expect(await useSkillsStore.getState().loadSkills()).toBe(true);
expect(runtimeFetchCalls.length).toBe(1);
// Wrong key: client-directory-first null maps to __default__, not the active project.
invalidateSkillsLoadCache(null);
expect(await useSkillsStore.getState().loadSkills()).toBe(true);
expect(runtimeFetchCalls.length).toBe(1);
// Default resolution must match loadSkills (active project first).
invalidateSkillsLoadCache();
expect(await useSkillsStore.getState().loadSkills()).toBe(true);
expect(runtimeFetchCalls.length).toBe(2);
expect(runtimeFetchCalls[1]?.url).toContain(`directory=${encodeURIComponent(activeProjectPath)}`);
});
});