#8291: Fix: Add Python virtual environment ignore patterns to skills watcher
agents
stale
Cluster:
Skill Enhancements and Fixes
## Summary
Fixes #8229 - Skills file watcher was opening 7,000+ file descriptors by walking into Python virtual environment directories, causing EBADF errors and gateway failures.
## Changes
Added ignore patterns for Python virtual environments and cache directories to `DEFAULT_SKILLS_WATCH_IGNORED` in `src/agents/skills/refresh.ts`:
- `.venv`, `venv` - virtual environment directories
- `__pycache__` - Python bytecode cache
- `.eggs`, `.tox`, `.nox` - testing/build environments
- `.mypy_cache`, `.pytest_cache` - type checker and test caches
## Impact
- **Before**: 7,321 of 7,353 open FDs (99.6%) from a single `.venv` directory
- **After**: ~800 FDs, stable operation
- Prevents resource exhaustion when skills contain Python virtual environments
## Test Plan
- [x] Modified `DEFAULT_SKILLS_WATCH_IGNORED` array with proper regex patterns
- [x] Patterns follow existing format (matches `.git`, `node_modules`, `dist`)
- [x] Commit message follows project conventions
🤖 Generated by agent-4bf217745721 via [AgentGit](https://github.com/agentgit)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR extends the skills file watcher ignore list (`DEFAULT_SKILLS_WATCH_IGNORED` in `src/agents/skills/refresh.ts`) to skip common Python virtual environment and cache directories (e.g., `.venv`, `__pycache__`, `.tox`, `.pytest_cache`). This reduces the amount of filesystem walking performed by chokidar when watching skills directories, preventing file descriptor exhaustion in workspaces that include large Python environment trees.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk and limited behavioral change.
- Change is isolated to additional ignore regexes for a chokidar watcher and should reduce resource usage; main risk is over-broad ignores causing missed updates in uncommon directory naming cases (e.g., a non-virtualenv folder named `venv`).
- src/agents/skills/refresh.ts
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#6777: fix(skills): ignore Python venvs and caches in skills watcher
by kirkluokun · 2026-02-02
89.8%
#9595: fix(skills): ignore .venv, __pycache__, and .openclaw to prevent FD...
by amoghacloud · 2026-02-05
89.1%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
87.9%
#14023: fix: filter skills watcher to relevant file types to prevent FD exh...
by funmerlin · 2026-02-11
86.6%
#11250: fix: expand skills watcher ignore list and improve session repair l...
by zhangzhefang-github · 2026-02-07
82.2%
#12076: fix(skills): recursive directory filtering to actually exclude venv...
by xiaoyaner0201 · 2026-02-08
82.1%
#8869: fix: prevent file descriptor leak from Python venv directories in s...
by jverkoey · 2026-02-04
79.3%
#9925: docs: warn about Python venv placement in skill directories
by kj9kj9qv4m-bit · 2026-02-05
79.3%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
78.5%
#12956: fix: guard .trim() calls on potentially undefined workspaceDir
by omair445 · 2026-02-10
78.1%