fix(controller): Add stop_services() and dialog imports for GUI decoupling

- Add AppController.stop_services() to clean up AI client and event loop
- Add ConfirmDialog, MMAApprovalDialog, MMASpawnApprovalDialog imports to gui_2.py
- Fix test mocks for MMA dashboard and approval indicators
- Add retry logic to conftest.py for Windows file lock cleanup
This commit is contained in:
2026-03-04 20:16:16 -05:00
parent bc7408fbe7
commit 2d92674aa0
5 changed files with 92 additions and 59 deletions

View File

@@ -181,8 +181,12 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
# 1. Create a isolated workspace for the live GUI
temp_workspace = Path("tests/artifacts/live_gui_workspace")
if temp_workspace.exists():
shutil.rmtree(temp_workspace)
temp_workspace.mkdir(parents=True, exist_ok=True)
for _ in range(5):
try:
shutil.rmtree(temp_workspace)
break
except PermissionError:
time.sleep(0.5)
# Create minimal project files to avoid cluttering root
# NOTE: Do NOT create config.toml here - we use SLOP_CONFIG env var
@@ -276,8 +280,14 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
time.sleep(0.5)
except: pass
kill_process_tree(process.pid)
time.sleep(1.0)
log_file.close()
# Cleanup temp workspace
try:
shutil.rmtree(temp_workspace)
except: pass
# Cleanup temp workspace with retry for Windows file locks
for _ in range(5):
try:
shutil.rmtree(temp_workspace)
break
except PermissionError:
time.sleep(0.5)
except:
break