fix: prevent wrapper from detecting itself as remaining process

- Add PID and script name checks in post-test verification
- Avoid false positive detection of wrapper process as 'remaining'
- This prevents unnecessary cleanup calls that could cause hangs
- Root cause: wrapper was trying to clean up itself in verification phase

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andy Lee
2025-08-13 01:12:10 -07:00
parent 8496828a90
commit 2530939c0f

View File

@@ -149,11 +149,19 @@ def run_pytest_with_monitoring(pytest_args):
try:
result = subprocess.run(["ps", "aux"], capture_output=True, text=True, timeout=5)
remaining = [
line
for line in result.stdout.split("\n")
if "python" in line and ("pytest" in line or "embedding" in line)
]
lines = result.stdout.split("\n")
current_pid = str(os.getpid())
remaining = []
for line in lines:
# Skip our own wrapper process
if current_pid in line or "ci_pytest_wrapper.py" in line:
continue
# Only check for actual problematic processes
if "python" in line and ("pytest" in line or "embedding" in line):
# Skip debug script too
if "ci_debug_pytest.py" not in line:
remaining.append(line)
if remaining:
print(f"⚠️ [WRAPPER] Found {len(remaining)} remaining processes:")