Fix iterator/generator FD leak in _report_all_kernel_commit_status_map
Open
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
## What
Fix file descriptor leaks in `_report_all_kernel_commit_status_map()` (`agent.py:1209-1238`).
## Why
`Path.iterdir()` and `Path.glob()` generators are not explicitly closed on exception, leaking 1-2 FDs per invocation (called every 7 seconds).
## How
- Wrap `iterdir()` and `glob()` calls with proper resource management (e.g., `list()` conversion or explicit generator closing)
- Add `base_commit_path.exists()` check before iteration
- Add try/except around the `run_in_executor` call to prevent unhandled exceptions from propagating
JIRA Issue: BA-4391
Contributor guide
Assessment
This issue has not been assessed yet.