fix(skills): ignore Python venvs and caches in skills watcher
Add .venv, venv, __pycache__, .mypy_cache, .pytest_cache, build, and .cache to the default ignored patterns for the skills watcher. This prevents file descriptor exhaustion when a skill contains a Python virtual environment with tens of thousands of files, which was causing EBADF spawn errors on macOS. Fixes #1056 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
718bc3f9c8
commit
57aa6aa6a1
@ -12,7 +12,7 @@ vi.mock("chokidar", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("ensureSkillsWatcher", () => {
|
describe("ensureSkillsWatcher", () => {
|
||||||
it("ignores node_modules, dist, and .git by default", async () => {
|
it("ignores node_modules, dist, .git, and Python venvs by default", async () => {
|
||||||
const mod = await import("./refresh.js");
|
const mod = await import("./refresh.js");
|
||||||
mod.ensureSkillsWatcher({ workspaceDir: "/tmp/workspace" });
|
mod.ensureSkillsWatcher({ workspaceDir: "/tmp/workspace" });
|
||||||
|
|
||||||
@ -21,11 +21,35 @@ describe("ensureSkillsWatcher", () => {
|
|||||||
|
|
||||||
expect(opts.ignored).toBe(mod.DEFAULT_SKILLS_WATCH_IGNORED);
|
expect(opts.ignored).toBe(mod.DEFAULT_SKILLS_WATCH_IGNORED);
|
||||||
const ignored = mod.DEFAULT_SKILLS_WATCH_IGNORED;
|
const ignored = mod.DEFAULT_SKILLS_WATCH_IGNORED;
|
||||||
|
|
||||||
|
// Node/JS paths
|
||||||
expect(ignored.some((re) => re.test("/tmp/workspace/skills/node_modules/pkg/index.js"))).toBe(
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/node_modules/pkg/index.js"))).toBe(
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
expect(ignored.some((re) => re.test("/tmp/workspace/skills/dist/index.js"))).toBe(true);
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/dist/index.js"))).toBe(true);
|
||||||
expect(ignored.some((re) => re.test("/tmp/workspace/skills/.git/config"))).toBe(true);
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/.git/config"))).toBe(true);
|
||||||
|
|
||||||
|
// Python virtual environments and caches
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/scripts/.venv/bin/python"))).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/venv/lib/python3.10/site.py"))).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/__pycache__/module.pyc"))).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/.mypy_cache/3.10/foo.json"))).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/.pytest_cache/v/cache"))).toBe(true);
|
||||||
|
|
||||||
|
// Build artifacts and caches
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/build/output.js"))).toBe(true);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/.cache/data.json"))).toBe(true);
|
||||||
|
|
||||||
|
// Should NOT ignore normal skill files
|
||||||
expect(ignored.some((re) => re.test("/tmp/.hidden/skills/index.md"))).toBe(false);
|
expect(ignored.some((re) => re.test("/tmp/.hidden/skills/index.md"))).toBe(false);
|
||||||
|
expect(ignored.some((re) => re.test("/tmp/workspace/skills/my-skill/SKILL.md"))).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -31,6 +31,15 @@ export const DEFAULT_SKILLS_WATCH_IGNORED: RegExp[] = [
|
|||||||
/(^|[\\/])\.git([\\/]|$)/,
|
/(^|[\\/])\.git([\\/]|$)/,
|
||||||
/(^|[\\/])node_modules([\\/]|$)/,
|
/(^|[\\/])node_modules([\\/]|$)/,
|
||||||
/(^|[\\/])dist([\\/]|$)/,
|
/(^|[\\/])dist([\\/]|$)/,
|
||||||
|
// Python virtual environments and caches
|
||||||
|
/(^|[\\/])\.venv([\\/]|$)/,
|
||||||
|
/(^|[\\/])venv([\\/]|$)/,
|
||||||
|
/(^|[\\/])__pycache__([\\/]|$)/,
|
||||||
|
/(^|[\\/])\.mypy_cache([\\/]|$)/,
|
||||||
|
/(^|[\\/])\.pytest_cache([\\/]|$)/,
|
||||||
|
// Build artifacts and caches
|
||||||
|
/(^|[\\/])build([\\/]|$)/,
|
||||||
|
/(^|[\\/])\.cache([\\/]|$)/,
|
||||||
];
|
];
|
||||||
|
|
||||||
function bumpVersion(current: number): number {
|
function bumpVersion(current: number): number {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user