Private
Public Access
0
0

chore(fix): Resolve regressions in history logic, track startup, and GUI performance

This commit is contained in:
2026-05-11 20:03:01 -04:00
parent 2ba427f827
commit 26ef81a30e
7 changed files with 133 additions and 82 deletions
+18 -4
View File
@@ -2840,6 +2840,9 @@ class AppController:
self._tool_stats.clear()
self._comms_log.clear()
self.disc_entries.clear()
self.files.clear()
self.context_files.clear()
self.tracks.clear()
# Clear history in ALL discussions to be safe
disc_sec = self.project.get("discussion", {})
discussions = disc_sec.get("discussions", {})
@@ -3205,14 +3208,15 @@ class AppController:
try:
# Use a local copy of files to avoid concurrent modification issues
files_to_scan = list(self.files)
for i, file_path in enumerate(files_to_scan):
for i, f_item in enumerate(files_to_scan):
try:
self.ai_status = f"Phase 2: Scanning files ({i+1}/{len(files_to_scan)})..."
abs_path = Path(self.active_project_root) / file_path
f_path = f_item.path if hasattr(f_item, 'path') else str(f_item)
abs_path = Path(self.active_project_root) / f_path
if abs_path.exists() and abs_path.suffix == ".py":
with open(abs_path, "r", encoding="utf-8") as f:
code = f.read()
generated_skeletons += f"\nFile: {file_path}\n{parser.get_skeleton(code)}\n"
generated_skeletons += f"\nFile: {f_path}\n{parser.get_skeleton(code)}\n"
except Exception as e:
pass
except Exception as e:
@@ -3220,10 +3224,12 @@ class AppController:
return # Exit if skeleton generation fails
# Now loop through tracks and call _start_track_logic with generated skeletons
total_tracks = len(self.proposed_tracks)
print(f"[DEBUG] _cb_accept_tracks: Starting {total_tracks} tracks...")
for i, track_data in enumerate(self.proposed_tracks):
title = track_data.get("title") or track_data.get("goal", "Untitled Track")
self.ai_status = f"Processing track {i+1} of {total_tracks}: '{title}'..."
self._start_track_logic(track_data, skeletons_str=generated_skeletons) # Pass skeletons
print(f"[DEBUG] _cb_accept_tracks: All {total_tracks} tracks processed.")
with self._pending_gui_tasks_lock:
self._pending_gui_tasks.append({'action': 'refresh_from_project'}) # Ensure UI refresh after tracks are started
self.ai_status = f"All {total_tracks} tracks accepted and execution started."
@@ -3326,16 +3332,24 @@ class AppController:
self.tracks.append({"id": track_id, "title": title, "status": "todo"})
with self._pending_gui_tasks_lock:
self._pending_gui_tasks.append({'action': 'refresh_from_project'})
# 4. Initialize ConductorEngine and run loop
# 4. Initialize ConductorEngine and run loop
sys.stderr.write(f"[DEBUG] _start_track_logic: Initializing engine for {track_id}...\n")
sys.stderr.flush()
engine = multi_agent_conductor.ConductorEngine(track, self.event_queue, auto_queue=not self.mma_step_mode)
self.engines[track.id] = engine
# Use current full markdown context for the track execution
track_id_param = track.id
flat = project_manager.flat_config(self.project, self.active_discussion, track_id=track_id_param)
flat.setdefault("files", {})["paths"] = self.context_files
sys.stderr.write(f"[DEBUG] _start_track_logic: Aggregating context for {track_id}...\n")
sys.stderr.flush()
full_md, _, _ = aggregate.run(flat)
sys.stderr.write(f"[DEBUG] _start_track_logic: Starting engine thread for {track_id}...\n")
sys.stderr.flush()
# Start the engine in a separate thread
threading.Thread(target=engine.run, kwargs={"md_content": full_md}, daemon=True).start()
sys.stderr.write(f"[DEBUG] _start_track_logic: Engine thread spawned for {track_id}.\n")
sys.stderr.flush()
except Exception as e:
self.ai_status = f"Track start error: {e}"
print(f"ERROR in _start_track_logic: {e}")