# Implementation Plan: Robust JSON Parsing for Tech Lead (robust_json_parsing_tech_lead_20260302)

> **TEST DEBT FIX:** Due to ongoing test architecture instability (documented in `test_architecture_integrity_audit_20260304`), do NOT write new `live_gui` integration tests for this track. Rely strictly on in-process `unittest.mock` for the `ai_client` to verify the retry logic.

## Phase 1: Implementation of Retry Logic
- [x] Task: Initialize MMA Environment `activate_skill mma-orchestrator`
- [x] Task: Implement Retry Loop in `generate_tickets`
    - [ ] WHERE: `conductor_tech_lead.py:generate_tickets`
    - [ ] WHAT: Wrap the `send` and `json.loads` calls in a `for _ in range(max_retries)` loop.
    - [ ] HOW: If `JSONDecodeError` is caught, append an error message to the context and loop. If it succeeds, `break` and return.
    - [ ] SAFETY: Ensure token limits aren't massively breached by appending huge error states. Truncate raw output if necessary.
- [x] Task: Conductor - User Manual Verification 'Phase 1: Implementation' (Protocol in workflow.md)

## Phase 2: Unit Testing
- [x] Task: Write Simulation Tests for JSON Parsing
    - [x] WHERE: `tests/test_conductor_tech_lead.py`
    - [x] WHAT: Add tests `test_generate_tickets_retry_success` and `test_generate_tickets_retry_failure`.
    - [x] HOW: Mock `ai_client.send` side_effect to return invalid JSON first, then valid JSON. Assert call counts.
    - [x] SAFETY: Standard pytest mocking.
- [x] Task: Conductor - User Manual Verification 'Phase 2: Unit Testing' (Protocol in workflow.md)

## Phase 3: Final Validation
- [x] Task: Full Suite Validation & Warning Cleanup
    - [x] WHERE: Project root
    - [x] WHAT: `uv run pytest tests/test_conductor_tech_lead.py`
    - [x] HOW: Ensure 100% pass rate.
    - [x] SAFETY: None.
- [x] Task: Conductor - User Manual Verification 'Phase 3: Final Validation' (Protocol in workflow.md)