with open("tests/test_visual_orchestration.py", "r", encoding="utf-8", newline="") as f: content = f.read() # Add more explicit debug - check ai_status for errors content = content.replace( '''# 3. Verify that Tier 1 generates tracks print("[Test] Polling for Tier 1 tracks...") tracks_generated = False for i in range(120): # Check both proposed_tracks AND comms log for tracks mma_status = client.get_mma_status() proposed = mma_status.get("proposed_tracks", []) tier_usage = mma_status.get("mma_tier_usage", {}) # Also check the comms log directly session = client.get_session() entries = session.get("session", {}).get("entries", []) # Check for track generation evidence if proposed and len(proposed) > 0: tracks_generated = True print(f"[Test] Tracks found in proposed_tracks after {i}s: {proposed}") break elif tier_usage.get("Tier 1", {}).get("input", 0) > 0: # AI was called, check comms log for track JSON for entry in entries: content = str(entry.get("content", "")) if "track" in content.lower() and ("id" in content or "goal" in content): tracks_generated = True print(f"[Test] Tracks found in comms log after {i}s") break if i % 10 == 0: print(f"[Test] Debug: tier_usage={tier_usage}, proposed={proposed}, entries_count={len(entries)}") time.sleep(1) assert tracks_generated, f"Tier 1 failed to generate tracks within 120 seconds."''', '''# 3. Verify that Tier 1 generates tracks print("[Test] Polling for Tier 1 tracks...") tracks_generated = False for i in range(120): # Check both proposed_tracks AND comms log for tracks mma_status = client.get_mma_status() proposed = mma_status.get("proposed_tracks", []) tier_usage = mma_status.get("mma_tier_usage", {}) ai_status = mma_status.get("mma_status", "unknown") # Also check the comms log directly session = client.get_session() entries = session.get("session", {}).get("entries", []) # Check for track generation evidence if proposed and len(proposed) > 0: tracks_generated = True print(f"[Test] Tracks found in proposed_tracks after {i}s: {proposed}") break elif tier_usage.get("Tier 1", {}).get("input", 0) > 0: # AI was called, check comms log for track JSON for entry in entries: content = str(entry.get("content", "")) if "track" in content.lower() and ("id" in content or "goal" in content): tracks_generated = True print(f"[Test] Tracks found in comms log after {i}s: {content[:100]}") break if i % 10 == 0: print(f"[Test] Debug: ai_status={ai_status}, tier_usage={tier_usage}, proposed={proposed}, entries={len(entries)}") time.sleep(1) assert tracks_generated, f"Tier 1 failed to generate tracks within 120 seconds. Status: {ai_status}"''', ) with open("tests/test_visual_orchestration.py", "w", encoding="utf-8", newline="") as f: f.write(content) print("Added ai_status debug")