# Implementation Plan: GUI Decoupling & Controller Architecture (gui_decoupling_controller_20260302)

## Status: COMPLETE [checkpoint: 45b716f]

## Phase 1: Controller Skeleton & State Migration
- [x] Task: Initialize MMA Environment `activate_skill mma-orchestrator` [d0009bb]
- [x] Task: Create `app_controller.py` Skeleton [d0009bb]
- [x] Task: Migrate Data State from GUI [d0009bb]

## Phase 2: Logic & Background Thread Migration
- [x] Task: Extract Background Threads & Event Queue [9260c7d]
- [x] Task: Extract I/O and AI Methods [9260c7d]

## Phase 3: Test Suite Refactoring
- [x] Task: Update `conftest.py` Fixtures [f2b2575]
- [x] Task: Resolve Broken GUI Tests [f2b2575]

## Phase 4: Final Validation
- [x] Task: Full Suite Validation & Warning Cleanup [45b716f]
    - [x] WHERE: Project root
    - [x] WHAT: `uv run pytest`
    - [x] HOW: 345 passed, 0 skipped, 2 warnings
    - [x] SAFETY: All tests pass

## Phase 5: Stabilization & Cleanup (RECOVERY)
- [x] Task: Task 5.1: AST Synchronization Audit [16d337e]
- [x] Task: Task 5.2: Restore Controller Properties (Restore `current_provider`) [2d041ee]
- [ ] Task: Task 5.3: Replace magic `__getattr__` with Explicit Delegation (DEFERRED - requires 80+ property definitions, separate track recommended)
- [x] Task: Task 5.4: Fix Sandbox Isolation logic in `conftest.py` [88aefc2]
- [x] Task: Task 5.5: Event Loop Consolidation & Single-Writer Sync [1b46534]
- [x] Task: Task 5.6: Fix `test_gui_provider_list_via_hooks` workspace creation [45b716f]
- [x] Task: Task 5.7: Fix `test_live_gui_integration` event loop issue [45b716f]
- [x] Task: Task 5.8: Fix `test_gui2_performance` key mismatch [45b716f]
    - [x] WHERE: tests/test_gui2_performance.py:57-65
    - [x] WHAT: Fix key mismatch - looked for "gui_2.py" but stored as full sloppy.py path
    - [x] HOW: Use `next((k for k in _shared_metrics if "sloppy.py" in k), None)` to find key
    - [x] SAFETY: Test-only change
