diff --git a/conductor/tracks/asyncio_decoupling_refactor_20260306/plan.md b/conductor/tracks/asyncio_decoupling_refactor_20260306/plan.md index 787af44..1f36fa0 100644 --- a/conductor/tracks/asyncio_decoupling_refactor_20260306/plan.md +++ b/conductor/tracks/asyncio_decoupling_refactor_20260306/plan.md @@ -3,31 +3,31 @@ > **TEST DEBT FIX:** This track is responsible for permanently eliminating the `RuntimeError: Event loop is closed` test suite crashes by ripping out the conflict-prone asyncio loops from the AppController. ## Phase 1: Event System Migration -- [ ] Task: Initialize MMA Environment `activate_skill mma-orchestrator` -- [ ] Task: Refactor `events.py` - - [ ] WHERE: `src/events.py` - - [ ] WHAT: Replace `AsyncEventQueue` with `SyncEventQueue` using `import queue`. - - [ ] HOW: Change `async def get()` to a blocking `def get()`. Remove `asyncio` imports. - - [ ] SAFETY: Ensure thread-safety. -- [ ] Task: Conductor - User Manual Verification 'Phase 1: Event System' +- [x] Task: Initialize MMA Environment `activate_skill mma-orchestrator` +- [x] Task: Refactor `events.py` + - [x] WHERE: `src/events.py` + - [x] WHAT: Replace `AsyncEventQueue` with `SyncEventQueue` using `import queue`. + - [x] HOW: Change `async def get()` to a blocking `def get()`. Remove `asyncio` imports. + - [x] SAFETY: Ensure thread-safety. +- [x] Task: Conductor - User Manual Verification 'Phase 1: Event System' ## Phase 2: AppController Decoupling -- [ ] Task: Refactor `AppController` Event Loop - - [ ] WHERE: `src/app_controller.py` - - [ ] WHAT: Remove `self._loop` and `asyncio.new_event_loop()`. - - [ ] HOW: Change `_run_event_loop` to just call `_process_event_queue` directly (which will now block on queue gets). - - [ ] SAFETY: Ensure `shutdown()` properly signals the queue to unblock and join the thread. -- [ ] Task: Thread Task Dispatching - - [ ] WHERE: `src/app_controller.py` - - [ ] WHAT: Replace `asyncio.run_coroutine_threadsafe(self.event_queue.put(...))` with direct synchronous `.put()`. Replace `self._loop.run_in_executor` with `threading.Thread(target=self._handle_request_event)`. - - [ ] HOW: Mechanical replacement of async primitives. - - [ ] SAFETY: None. -- [ ] Task: Conductor - User Manual Verification 'Phase 2: Decoupling' +- [x] Task: Refactor `AppController` Event Loop + - [x] WHERE: `src/app_controller.py` + - [x] WHAT: Remove `self._loop` and `asyncio.new_event_loop()`. + - [x] HOW: Change `_run_event_loop` to just call `_process_event_queue` directly (which will now block on queue gets). + - [x] SAFETY: Ensure `shutdown()` properly signals the queue to unblock and join the thread. +- [x] Task: Thread Task Dispatching + - [x] WHERE: `src/app_controller.py` + - [x] WHAT: Replace `asyncio.run_coroutine_threadsafe(self.event_queue.put(...))` with direct synchronous `.put()`. Replace `self._loop.run_in_executor` with `threading.Thread(target=self._handle_request_event)`. + - [x] HOW: Mechanical replacement of async primitives. + - [x] SAFETY: None. +- [x] Task: Conductor - User Manual Verification 'Phase 2: Decoupling' ## Phase 3: Final Validation -- [ ] Task: Full Suite Validation - - [ ] WHERE: Project root - - [ ] WHAT: `uv run pytest` - - [ ] HOW: Ensure 100% pass rate with no hanging threads or event loop errors. - - [ ] SAFETY: None. -- [ ] Task: Conductor - User Manual Verification 'Phase 3: Final Validation' \ No newline at end of file +- [x] Task: Full Suite Validation + - [x] WHERE: Project root + - [x] WHAT: `uv run pytest` + - [x] HOW: Ensure 100% pass rate with no hanging threads or event loop errors. + - [x] SAFETY: None. +- [x] Task: Conductor - User Manual Verification 'Phase 3: Final Validation'