You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes based on Copilot AI review (5 issues):
1. Simplified _cleanup_stdio_async():
- Used try/finally pattern for cleaner reference clearing
- References cleared in finally block (always executed)
2. Removed deprecated asyncio.get_event_loop():
- Removed complex temp loop pattern entirely
- Simplified fallback to just log warning and clear refs
3. Simplified fallback path (Issue #4):
- When loop exists but not running, resources are in undefined state
- Complex event loop manipulation removed
- Just log warning and proceed with reference clearing
- OS will reclaim resources on process exit
4. Handled race condition (Issue #5):
- Added comment documenting the inherent race condition
- Added try/except around loop.call_soon_threadsafe()
- Track cleanup_attempted flag for proper fallback handling
5. Added explanatory comments:
- Documented why redundant None assignments exist (safety)
- Explained race condition handling approach
Note: Test coverage suggestion (#3) acknowledged but deferred
to separate PR to keep this fix focused.
0 commit comments