conductor(state): fix_mma_concurrent_tracks_sim_20260627 SHIPPED

Track complete. All 7 VCs pass:
- VC1: test_mma_concurrent_tracks_execution passes in isolation
- VC2: Tier 3 of the batched test suite shows 0 failures
  (verified 5 consecutive PASS runs at 7.49-8.45s)
- VC3: No diagnostic stderr lines remain in src/app_controller.py
- VC4: OUTSTANDING_MMA_TEST_FAILURES_20260627.md updated to RESOLVED
- VC5: TRACK_COMPLETION_fix_mma_concurrent_tracks_sim_20260627.md written
- VC6: No git restore/checkout/reset/stash used
- VC7: All atomic commits have git notes (per workflow.md)

Two fixes shipped in this track:
- e9919059: TrackMetadata import (production bug, NameError on
  models.Metadata call site at app_controller.py:4830)
- 913aa48c: Mock sprint routing (session_id-based was fragile;
  replaced with prompt-content-based)

Parent branch tier2/post_module_taxonomy_de_cruft_20260627 is now
ready for merge after this fix track is reviewed.
This commit is contained in:
ed
2026-06-27 14:26:07 -04:00
parent 913aa48ca9
commit 7c98a2dcc0
3 changed files with 234 additions and 35 deletions
@@ -52,26 +52,37 @@ So all resume calls fell to the default case, which returns a generic mock respo
**Status:****PARTIALLY FIXED** in commit `635ca552` (mock now parses `--resume` from sys.argv and uses a persistent call counter to route to per-track responses).
### 4. ⚠️ **UNRESOLVED** — Second track's `_start_track_logic` never fires
### 4. **RESOLVED** — Production bug: NameError on `models.Metadata` call site
Even with the mock fix, only 1 sprint-ticket call is observed (for track-a). The for loop in `_cb_accept_tracks._bg_task` is:
After all 3 prior fixes in commit `635ca552`, only 1 sprint-ticket call was observed (for track-a). The for loop in `_cb_accept_tracks._bg_task` was reached but track-a's `_start_track_logic` raised a `NameError` that was NOT caught by the EXCEPT block (which only catches 7 specific exception types). The io_pool worker died, the for loop never reached track-b.
**Root cause:** The de-cruft migration in commit `ee763eea` removed `from src import models` from `src/app_controller.py` but did not update the call site `models.Metadata(...)` at line 4830. The line is:
```python
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)
meta = models.Metadata(id=track_id, name=title, status="todo", created_at=datetime.now(), updated_at=datetime.now())
```
The first iteration should:
- Call `_start_track_logic(track_a, ...)` → mock returns sprint-A → track created
- Then continue to track_b
`models` is no longer in scope, so this raises `NameError: name 'models' is not defined`.
But the second iteration's mock call is never observed. Possible causes:
- `_start_track_logic` for track-a hangs (e.g., `project_manager.save_track_state` blocks)
- The IO pool is saturated
- The `submit_io(engine.run, ...)` for track-a blocks the bg_task
- The `aggregate.run(flat)` call hangs
- The new `flat.to_dict()` conversion is missing the `screenshots` field that `aggregate.run` requires
**Status:****FIXED** in commit `e9919059` (added `TrackMetadata` to the `from src.mma import` line; changed `models.Metadata(...)` to `TrackMetadata(...)`).
**Verification:** 5 consecutive PASS runs of `test_mma_concurrent_tracks_execution` (7.49s, 7.54s, 7.97s, 8.02s, 8.45s). The full diag log shows both tracks are created:
```
[DIAG] _start_track_logic_result self.tracks.append OK title='Track A' track_id=track_ef3ff66ba50c
[DIAG] _start_track_logic_result ENTER title='Track B' goal='Track B Goal' skeletons_len=0
[DIAG] _start_track_logic_result AFTER generate_tickets title='Track B' raw_tickets_count=1
...
[DIAG] _start_track_logic_result self.tracks.append OK title='Track B' track_id=track_52e6741b0748
```
### 5. ✅ **RESOLVED** — Mock bug: session_id-based routing for sprints is fragile
The session_id-based routing added in commit `635ca552` had two sub-bugs:
- `call_n` literal matching (`== 2`, `== 3`) is fragile to test ordering: the file-based counter persists across tests in the same session, so `call_n != 2` for the 1st sprint if a prior test ran.
- `session_id="mock-sprint-A"` means "this is a follow-up call after the 1st sprint returned mock-sprint-A", so the response should be sprint-B (2nd track tickets), not sprint-A. The prior code routed this to sprint-A, causing track-b's worker to have stream id `ticket-A-1` (not `ticket-B-1`).
**Status:****FIXED** in commit `913aa48c` (replaced session_id-based sprint routing with prompt-content-based routing; the original pre-`635ca552` design).
**Verification:** 3 consecutive PASS runs after the fix.
The test counter is at 2 after the test runs (one epic + one sprint). This proves the mock was called twice. The third call (sprint-B) never happens.