Private
Public Access
0
0

refactor(conductor_tech_lead): migrate to send_result() (G1, public_api_migration_and_ui_polish_20260615 Phase 1.1)

Replaces deprecated ai_client.send(md_content='', user_message=user_message)
with ai_client.send_result(...) and branches on result.ok. On error, logs
the ui_message() and returns None (the function returns a list of ticket
definitions or None on failure).

The previous code called the @deprecated send() shim which silently
returns '' on error. The empty string would then be passed to json.loads,
causing JSONDecodeError and 3 retry attempts. The new code short-circuits
on the first error and returns None immediately.

This is the easiest of the 3 production migrations (2-arg call with no
callbacks). See plan.md Phase 1.1. Test fixes for the production-affected
mocks in test_conductor_tech_lead.py and test_orchestration_logic.py are
in Phase 2.12 and Phase 2.13.

NOTE: 4 tests now fail (3 in test_conductor_tech_lead.py + 1 in
test_orchestration_logic.py) because they mock src.ai_client.send.
These will be fixed in Phase 2.12/2.13 by mocking send_result instead.
This commit is contained in:
2026-06-15 15:53:08 -04:00
parent bb3b3056b4
commit bbb3d59712
+8 -2
View File
@@ -65,10 +65,16 @@ def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict[str,
for _ in range(3):
try:
# 3. Call Tier 2 Model
response = ai_client.send(
md_content = "",
result = ai_client.send_result(
md_content = "",
user_message = user_message
)
if not result.ok:
_err = result.errors[0] if result.errors else None
_msg = _err.ui_message() if _err else "unknown error"
print(f"[conductor_tech_lead] send_result failed: {_msg}")
return None
response = result.data
# 4. Parse JSON Output
# Extract JSON array from markdown code blocks if present
json_match = response.strip()