From 7ea802ab8031efcc7367182be8fa061263af703c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 15:57:00 -0400 Subject: [PATCH] refactor(orchestrator_pm): migrate to send_result() (G2, public_api_migration_and_ui_polish_20260615 Phase 1.2) Replaces deprecated ai_client.send(md_content='', user_message=user_message, enable_tools=False) with ai_client.send_result(...) and branches on result.ok. On error, logs the ui_message() and returns [] (the function returns a list of track definitions or [] on failure). The 3 tests in test_orchestrator_pm.py + 1 in test_orchestrator_pm_history.py now fail because they mock src.ai_client.send. These will be fixed in Phase 2.14-2.15 by mocking send_result instead. --- src/orchestrator_pm.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/orchestrator_pm.py b/src/orchestrator_pm.py index 8d9a1253..6bec3e1b 100644 --- a/src/orchestrator_pm.py +++ b/src/orchestrator_pm.py @@ -83,11 +83,17 @@ def generate_tracks(user_request: str, project_config: dict[str, Any], file_item try: # 3. Call Tier 1 Model (Strategic - Pro) # Note: We use gemini-1.5-pro or similar high-reasoning model for Tier 1 - response = ai_client.send( + result = ai_client.send_result( md_content="", # We pass everything in user_message for clarity user_message=user_message, enable_tools=False, ) + if not result.ok: + _err = result.errors[0] if result.errors else None + _msg = _err.ui_message() if _err else "unknown error" + print(f"[orchestrator_pm] send_result failed: {_msg}") + return [] + response = result.data # 4. Parse JSON Output try: # The prompt asks for a JSON array. We need to extract it if the AI added markdown blocks.