perf(entropy): Fix nested imports in hot paths

Hoisted imports from inside frequently-called functions to module level:

app_controller.py:
- Added traceback and inspect at module level
- Removed 3 nested traceback imports from exception handlers

gui_2.py:
- Added traceback at module level
- Removed nested traceback import from _gui_func exception handler
- Kept uvicorn lazy-loaded (only for --headless mode)

multi_agent_conductor.py:
- Removed unused 'import sys' from run()
- Removed redundant nested imports (already at module level)

Also adds audit scripts and entropy findings documentation.
This commit is contained in:
2026-05-06 20:18:30 -04:00
parent 54afbb9365
commit 2b5185a78f
8 changed files with 598 additions and 57 deletions
-4
View File
@@ -218,7 +218,6 @@ class ConductorEngine:
md_content: The full markdown context (history + files) for AI workers.
max_ticks: Optional limit on number of iterations (for testing).
"""
import sys
tick_count = 0
while True:
if self._pause_event.is_set():
@@ -282,10 +281,7 @@ class ConductorEngine:
else:
# Check if ticket has a persona with preferred_models
if ticket.persona_id:
# Try to load preferred_models from persona
try:
from src.personas import PersonaManager
from src import paths
pm = PersonaManager(Path(paths.get_project_personas_path(Path.cwd())) if paths.get_project_personas_path(Path.cwd()).exists() else None)
personas = pm.load_all()
if ticket.persona_id in personas: