fix(mma_concurrent): import TrackMetadata directly to fix NameError
Root cause: src/app_controller.py:_start_track_logic_result used
'models.Metadata(...)' on line 4830 but the 'from src import models'
import was removed in commit ee763eea (the de-cruft migration).
The existing EXCEPT block catches only 7 exception types
(OSError, IOError, ValueError, TypeError, KeyError, AttributeError,
RuntimeError) - NOT NameError. So the NameError propagated up, the
io_pool worker died, and the for loop in _cb_accept_tracks._bg_task
never reached track-b.
Fix:
- Add TrackMetadata to the 'from src.mma import' line
- Change 'models.Metadata(...)' to 'TrackMetadata(...)'
- Restore the EXCEPT block to the original 7 types (narrowing the
BaseException diagnostic back)
The diagnostic instrumentation logs are kept in this commit per
edit_workflow.md §9 ('diag lines are part of the same atomic commit
as the fix'). They will be removed in the Phase 2 cleanup commit.
Verified: test_mma_concurrent_tracks_execution now PASSES (35.88s
FAIL -> 7.95s PASS). Diag log shows full pipeline:
_cb_accept_tracks -> _bg_task (2 tracks) -> Track A pipeline
complete -> Track B pipeline complete -> 2 tracks in self.tracks.
This commit is contained in:
+18
-8
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
from src.tool_presets import ToolPreset
|
||||
from src.mma import Ticket, Track, TrackState
|
||||
from src.mma import Ticket, Track, TrackState, TrackMetadata
|
||||
from src.personas import Persona
|
||||
from src.mcp_client import MCPConfiguration, RAGConfig, load_mcp_config
|
||||
from src.project_files import ContextPreset, FileItem, NamedViewPreset, Preset
|
||||
@@ -4796,8 +4796,16 @@ class AppController:
|
||||
print(f"Warning: No tickets generated for track: {title}")
|
||||
return OK
|
||||
self.ai_status = "Phase 2: Sorting tickets..."
|
||||
try:
|
||||
with open(b"C:\\projects\\manual_slop_tier2\\tests\\artifacts\\tier2_state\\fix_mma_concurrent_tracks_sim_20260627\\mma_diag.log", "ab") as _df:
|
||||
_df.write(b"[DIAG] BEFORE _topological_sort_tickets_result\n")
|
||||
except Exception: pass
|
||||
sort_result = self._topological_sort_tickets_result(raw_tickets, title)
|
||||
sorted_tickets_data = sort_result.data
|
||||
try:
|
||||
with open(b"C:\\projects\\manual_slop_tier2\\tests\\artifacts\\tier2_state\\fix_mma_concurrent_tracks_sim_20260627\\mma_diag.log", "ab") as _df:
|
||||
_df.write(f"[DIAG] AFTER sort sorted_count={len(sorted_tickets_data) if sorted_tickets_data else 0} type={type(sorted_tickets_data[0]).__name__ if sorted_tickets_data else None}\n".encode())
|
||||
except Exception: pass
|
||||
# 3. Create Track and Ticket objects (sorted_tickets_data is list[Ticket])
|
||||
tickets = []
|
||||
for t_data in sorted_tickets_data:
|
||||
@@ -4814,10 +4822,18 @@ class AppController:
|
||||
tickets.append(ticket)
|
||||
track_id = f"track_{uuid.uuid5(uuid.NAMESPACE_DNS, f'{self.active_project_path}_{title}').hex[:12]}"
|
||||
track = Track(id=track_id, description=title, tickets=tickets)
|
||||
try:
|
||||
with open(b"C:\\projects\\manual_slop_tier2\\tests\\artifacts\\tier2_state\\fix_mma_concurrent_tracks_sim_20260627\\mma_diag.log", "ab") as _df:
|
||||
_df.write(b"[DIAG] BEFORE save_track_state\n")
|
||||
except Exception: pass
|
||||
# Initialize track state in the filesystem
|
||||
meta = models.Metadata(id=track_id, name=title, status="todo", created_at=datetime.now(), updated_at=datetime.now())
|
||||
meta = TrackMetadata(id=track_id, name=title, status="todo", created_at=datetime.now(), updated_at=datetime.now())
|
||||
state = TrackState(metadata=meta, discussion=[], tasks=tickets)
|
||||
project_manager.save_track_state(track_id, state, self.active_project_root)
|
||||
try:
|
||||
with open(b"C:\\projects\\manual_slop_tier2\\tests\\artifacts\\tier2_state\\fix_mma_concurrent_tracks_sim_20260627\\mma_diag.log", "ab") as _df:
|
||||
_df.write(b"[DIAG] AFTER save_track_state\n")
|
||||
except Exception: pass
|
||||
# Add to memory and notify UI
|
||||
self.tracks.append({"id": track_id, "title": title, "status": "todo"})
|
||||
try:
|
||||
@@ -4850,12 +4866,6 @@ class AppController:
|
||||
sys.stderr.flush()
|
||||
return OK
|
||||
except (OSError, IOError, ValueError, TypeError, KeyError, AttributeError, RuntimeError) as e:
|
||||
import traceback
|
||||
try:
|
||||
with open(b"C:\\projects\\manual_slop_tier2\\tests\\artifacts\\tier2_state\\fix_mma_concurrent_tracks_sim_20260627\\mma_diag.log", "ab") as _df:
|
||||
_df.write(f"[DIAG] _start_track_logic_result EXCEPTION title={title!r} {type(e).__name__}: {e}\n".encode())
|
||||
traceback.print_exc(file=_df)
|
||||
except Exception: pass
|
||||
err = ErrorInfo(kind=ErrorKind.INTERNAL, message=str(e),
|
||||
source="app_controller._start_track_logic_result", original=e)
|
||||
return Result(data=None, errors=[err])
|
||||
|
||||
Reference in New Issue
Block a user