diff --git a/scripts/tasks/task_2_3_and_3_2.toml b/scripts/tasks/task_2_3_and_3_2.toml new file mode 100644 index 0000000..0e8f3eb --- /dev/null +++ b/scripts/tasks/task_2_3_and_3_2.toml @@ -0,0 +1,31 @@ +role = "tier3-worker" +docs = ["conductor/workflow.md", "tests/visual_sim_mma_v2.py"] +prompt = """ +Make two additions to tests/visual_sim_mma_v2.py: + +CHANGE 1 — Task 2.3: Add pytest timeout to prevent infinite CI hangs. +Add @pytest.mark.timeout(300) decorator to the test_mma_complete_lifecycle function. +Also add 'timeout' to the existing pytest.mark.integration decorator line (keep both marks). + +CHANGE 2 — Task 3.2: Add tier_usage assertion after the existing Stage 8 check. +After the existing assertion on tier3_content, add a new polling stage: + +Stage 9: Wait for mma_status == 'done' and mma_tier_usage Tier 3 non-zero. + +def _tier3_usage_nonzero(s): + usage = s.get('mma_tier_usage', {}) + t3 = usage.get('Tier 3', {}) + return t3.get('input', 0) > 0 or t3.get('output', 0) > 0 + +ok, status = _poll(client, timeout=30, label="wait-tier3-usage", + condition=_tier3_usage_nonzero) +# Non-blocking: if tier_usage isn't wired yet, just log and continue +tier_usage = status.get('mma_tier_usage', {}) +print(f"[SIM] Tier usage: {tier_usage}") +if not ok: + print("[SIM] WARNING: mma_tier_usage Tier 3 still zero after 30s — may not be wired to hook API yet") + +Add this before the final print("[SIM] MMA complete lifecycle simulation PASSED.") line. + +Use exactly 1-space indentation for Python code. +""" diff --git a/tests/visual_sim_mma_v2.py b/tests/visual_sim_mma_v2.py index 28b3b38..b19634c 100644 --- a/tests/visual_sim_mma_v2.py +++ b/tests/visual_sim_mma_v2.py @@ -47,6 +47,7 @@ def _poll(client: ApiHookClient, timeout: int, condition, label: str) -> tuple[b # --------------------------------------------------------------------------- @pytest.mark.integration +@pytest.mark.timeout(300) def test_mma_complete_lifecycle(live_gui) -> None: """ End-to-end MMA lifecycle using real Gemini API (gemini-2.5-flash-lite). @@ -168,4 +169,21 @@ def test_mma_complete_lifecycle(live_gui) -> None: tier3_content = streams[tier3_keys[0]] print(f"[SIM] Tier 3 output ({len(tier3_content)} chars): {tier3_content[:100]}...") + + # ------------------------------------------------------------------ + # Stage 9: Wait for mma_status == 'done' and mma_tier_usage Tier 3 non-zero + # ------------------------------------------------------------------ + def _tier3_usage_nonzero(s): + usage = s.get('mma_tier_usage', {}) + t3 = usage.get('Tier 3', {}) + return t3.get('input', 0) > 0 or t3.get('output', 0) > 0 + + ok, status = _poll(client, timeout=30, label="wait-tier3-usage", + condition=_tier3_usage_nonzero) + # Non-blocking: if tier_usage isn't wired yet, just log and continue + tier_usage = status.get('mma_tier_usage', {}) + print(f"[SIM] Tier usage: {tier_usage}") + if not ok: + print("[SIM] WARNING: mma_tier_usage Tier 3 still zero after 30s — may not be wired to hook API yet") + print("[SIM] MMA complete lifecycle simulation PASSED.")