Private
Public Access
0
0

fix(mma_concurrent_tracks): partial fix for production+mock regression

This test was failing for multiple stacked reasons. Fixed the ones I
could identify but the test still does not pass (the bg_task for the
second track does not run, suggesting a deeper integration issue).

Fixes:

1. src/app_controller.py: _start_track_logic_result and _cb_plan_epic both
   mutated the frozen ProjectContext dataclass returned by flat_config()
   via flat.setdefault('files', {})['paths'] = .... The flat_config()
   return type was changed from dict[str, Any] to a frozen @dataclass
   ProjectContext by cruft_elimination Phase 2 (in 0d2a9b5e), but the
   consumers were never updated. Fix: call flat.to_dict() to get a
   mutable dict before mutation.

2. src/app_controller.py: _start_track_logic_result iterated over
   sorted_tickets_data expecting dicts but conductor_tech_lead.topological_sort()
   returns list[Ticket]. So t_data['id'] raised 'Ticket' object is not
   subscriptable. Fix: use Ticket attribute access (t_data.id, etc.).

3. tests/mock_concurrent_mma.py: The mock was not handling the
   --resume session-id case that the gemini_cli_adapter uses for
   subsequent calls. The mock's first call returns the epic, but
   the second call (--resume mock-epic) fell to the default case.
   Fix: parse --resume arg from sys.argv and route to per-track
   sprint-ticket response based on a persistent call counter.

Known remaining issue: only one sprint-ticket mock call is observed in
the test log; the second track's _start_track_logic does not appear to
call the mock. Could be a deeper integration issue in the test sandbox
or in the _cb_accept_tracks._bg_task loop. Test still fails at line 66.
This commit is contained in:
2026-06-27 13:35:05 -04:00
parent 595b19aa8b
commit 635ca5523d
2 changed files with 91 additions and 25 deletions
+13 -7
View File
@@ -4588,6 +4588,8 @@ class AppController:
history = orchestrator_pm.get_track_history_summary()
proj = project_manager.load_project(self.active_project_path)
flat = project_manager.flat_config(self.project)
# flat_config returns a frozen ProjectContext; convert to dict for mutation.
flat = flat.to_dict() if hasattr(flat, "to_dict") else dict(flat)
flat.setdefault("files", {})["paths"] = self.context_files
file_items = aggregate.build_file_items(Path(self.active_project_root), flat.get("files", {}).get("paths", []))
@@ -4778,16 +4780,18 @@ class AppController:
self.ai_status = "Phase 2: Sorting tickets..."
sort_result = self._topological_sort_tickets_result(raw_tickets, title)
sorted_tickets_data = sort_result.data
# 3. Create Track and Ticket objects
# 3. Create Track and Ticket objects (sorted_tickets_data is list[Ticket])
tickets = []
for t_data in sorted_tickets_data:
# Use Ticket attribute access; topological_sort returns Ticket objects,
# not dicts. Re-wrap to ensure all expected fields are populated.
ticket = Ticket(
id=t_data["id"],
description=t_data.get("description") or t_data.get("goal", "No description"),
status=t_data.get("status", "todo"),
assigned_to=t_data.get("assigned_to", "unassigned"),
depends_on=t_data.get("depends_on", []),
step_mode=t_data.get("step_mode", False)
id=t_data.id,
description=t_data.description or "No description",
status=t_data.status,
assigned_to=t_data.assigned_to,
depends_on=list(t_data.depends_on),
step_mode=t_data.step_mode,
)
tickets.append(ticket)
track_id = f"track_{uuid.uuid5(uuid.NAMESPACE_DNS, f'{self.active_project_path}_{title}').hex[:12]}"
@@ -4810,6 +4814,8 @@ class AppController:
# 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_config returns a frozen ProjectContext; convert to dict for mutation.
flat = flat.to_dict() if hasattr(flat, "to_dict") else dict(flat)
flat.setdefault("files", {})["paths"] = self.context_files
sys.stderr.write(f"[DEBUG] _start_track_logic: Aggregating context for {track_id}...\n")
sys.stderr.flush()