#6777: fix(skills): ignore Python venvs and caches in skills watcher
agents
Cluster:
Skill Enhancements and Fixes
## Summary
- Add Python virtual environment directories (`.venv`, `venv`, `.envs`, `ENV`) to `DEFAULT_SKILLS_WATCH_IGNORED`
- Add Python cache directories (`__pycache__`, `.pytest_cache`, `.mypy_cache`, `.ruff_cache`)
- Add build output directories (`build`, `coverage`)
- Add temp directories (`.cache`, `.tmp`)
## Problem
The skills watcher currently only ignores `.git`, `node_modules`, and `dist`. When a skill directory contains a Python virtual environment (`.venv`), and the workspace is migrated to a new location, the stale `.venv` paths cause Node.js `child_process.spawn` to fail with `EBADF` error on macOS.
This is a known issue affecting multiple Node.js projects on macOS:
- [Bug]: Exec tool fails with spawn EBADF on macOS #5341
- Similar issues in Claude Code, Nuxt/Vite, and other projects
## Root Cause
When chokidar watches a directory containing `.venv`:
1. The `.venv` directory contains symlinks and binary files
2. After workspace migration, these paths become stale
3. Watching these directories triggers file descriptor issues
4. This causes `spawn EBADF` errors in any child process spawn
## Solution
Expand `DEFAULT_SKILLS_WATCH_IGNORED` to exclude:
- Python virtual environments
- Python tool caches
- Build outputs
- Temp directories
These directories should not trigger skill reload anyway, as they don't contain `SKILL.md` files.
## Test Plan
- [x] Updated `refresh.test.ts` to verify new ignored patterns
- [x] Verified regex patterns match expected paths
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR expands the default chokidar ignore list used by the skills watcher (`ensureSkillsWatcher`) to exclude common non-skill directories (Python virtualenvs and caches, build outputs, temp/cache dirs) to avoid noisy reloads and reduce macOS file descriptor issues when watching large trees. A corresponding unit test was updated to assert that these new patterns are included and that normal skill files (e.g. `SKILL.md`) are not ignored.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are limited to broadening a watcher ignore list and updating a unit test; the added regexes are standard path-segment matches and the change does not affect core logic beyond excluding more directories from watch events.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8291: Fix: Add Python virtual environment ignore patterns to skills watcher
by vishaltandale00 · 2026-02-03
89.8%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
85.9%
#14023: fix: filter skills watcher to relevant file types to prevent FD exh...
by funmerlin · 2026-02-11
85.6%
#9595: fix(skills): ignore .venv, __pycache__, and .openclaw to prevent FD...
by amoghacloud · 2026-02-05
85.2%
#12076: fix(skills): recursive directory filtering to actually exclude venv...
by xiaoyaner0201 · 2026-02-08
82.4%
#11250: fix: expand skills watcher ignore list and improve session repair l...
by zhangzhefang-github · 2026-02-07
78.7%
#9925: docs: warn about Python venv placement in skill directories
by kj9kj9qv4m-bit · 2026-02-05
77.8%
#23183: fix(skill-creator): exclude .git and VCS internals from .skill arch...
by aldoeliacim · 2026-02-22
77.5%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
76.6%
#8150: fix(skills): block dangerous environment variables from skill config
by yubrew · 2026-02-03
76.2%