Files
manual_slop/fix_epic_debug.py

52 lines
1.9 KiB
Python

with open("src/app_controller.py", "r", encoding="utf-8", newline="") as f:
content = f.read()
# Fix _cb_plan_epic to catch and print exceptions properly
old = """def _cb_plan_epic(self) -> None:
def _bg_task() -> None:
sys.stderr.write("[DEBUG] _cb_plan_epic _bg_task started\\n")
sys.stderr.flush()
try:
self._set_status("Planning Epic (Tier 1)...")
# DEBUG: Check provider
import src.ai_client as ai_client
sys.stderr.write(f"[DEBUG] _cb_plan_epic: ai_client._provider={ai_client._provider}, _model={ai_client._model}\\n")
sys.stderr.flush()
history = orchestrator_pm.get_track_history_summary()"""
new = """def _cb_plan_epic(self) -> None:
def _bg_task() -> None:
import traceback
sys.stderr.write("[DEBUG] _cb_plan_epic _bg_task started\\n")
sys.stderr.flush()
try:
self._set_status("Planning Epic (Tier 1)...")
# DEBUG: Check provider
import src.ai_client as ai_client
sys.stderr.write(f"[DEBUG] _cb_plan_epic: ai_client._provider={ai_client._provider}, _model={ai_client._model}\\n")
sys.stderr.flush()
history = orchestrator_pm.get_track_history_summary()
sys.stderr.write(f"[DEBUG] _cb_plan_epic: calling generate_tracks with epic_input={self.ui_epic_input[:50]}\\n")
sys.stderr.flush()"""
content = content.replace(old, new)
# Also catch the exception and print traceback
old2 = """except Exception as e:
self._set_status(f"Epic plan error: {e}")
print(f"ERROR in _cb_plan_epic background task: {e}")"""
new2 = """except Exception as e:
self._set_status(f"Epic plan error: {e}")
tb = traceback.format_exc()
sys.stderr.write(f"ERROR in _cb_plan_epic background task: {e}\\n{tb}\\n")
sys.stderr.flush()
print(f"ERROR in _cb_plan_epic background task: {e}")"""
content = content.replace(old2, new2)
with open("src/app_controller.py", "w", encoding="utf-8", newline="") as f:
f.write(content)
print("Added more debug to _cb_plan_epic")