Private
Public Access
0
0

refactor(ai_client): rename send_result to send in 5 src/ call sites

Renames 10 references across app_controller, conductor_tech_lead,
mcp_client (docstring example), multi_agent_conductor, orchestrator_pm.

5 call sites in ai_client.send_result(...) -> ai_client.send(...)
3 print strings mentioning send_result
1 docstring comment (conductor_tech_lead)
1 docstring example (mcp_client) 'src.ai_client.send_result' -> 'src.ai_client.send'

Test suite state: still red, but all src/-level call sites are now
renamed. Remaining failures are in test files (mocks and patches
that still reference send_result).

Refs: conductor/tracks/send_result_to_send_20260616/
This commit is contained in:
2026-06-17 00:27:47 -04:00
parent 4a59567939
commit d87d909f7b
6 changed files with 79 additions and 10 deletions
+69
View File
@@ -0,0 +1,69 @@
"""Apply the 10 send_result -> send edits in the 5 other src/ files (Phase 2)."""
from __future__ import annotations
import sys
from pathlib import Path
FILES = [
"src/app_controller.py",
"src/conductor_tech_lead.py",
"src/mcp_client.py",
"src/multi_agent_conductor.py",
"src/orchestrator_pm.py",
]
EDITS: dict[str, list[tuple[str, str]]] = {
"src/app_controller.py": [
("result = ai_client.send_result(context_to_send,", "result = ai_client.send(context_to_send,"),
("result = ai_client.send_result(\n", "result = ai_client.send(\n"),
],
"src/conductor_tech_lead.py": [
(" - Uses ai_client.send_result() for LLM communication", " - Uses ai_client.send() for LLM communication"),
("result = ai_client.send_result(\n", "result = ai_client.send(\n"),
("print(f\"[conductor_tech_lead] send_result failed: {_msg}\")", "print(f\"[conductor_tech_lead] send failed: {_msg}\")"),
],
"src/mcp_client.py": [
("'src.ai_client.send_result'", "'src.ai_client.send'"),
],
"src/multi_agent_conductor.py": [
("result = ai_client.send_result(\n", "result = ai_client.send(\n"),
("print(f\"[MMA] Worker send_result failed for {ticket.id}: {err_msg}\")", "print(f\"[MMA] Worker send failed for {ticket.id}: {err_msg}\")"),
],
"src/orchestrator_pm.py": [
("result = ai_client.send_result(\n", "result = ai_client.send(\n"),
("print(f\"[orchestrator_pm] send_result failed: {_msg}\")", "print(f\"[orchestrator_pm] send failed: {_msg}\")"),
],
}
def main() -> int:
total = 0
for rel in FILES:
p = Path(rel)
with p.open("r", encoding="utf-8", newline="") as f:
content = f.read()
has_crlf = "\r\n" in content
nl = "\r\n" if has_crlf else "\n"
edits = [(o.replace("\n", nl), n.replace("\n", nl)) for o, n in EDITS[rel]]
new_content = content
applied = 0
for old, new in edits:
if old in new_content:
new_content = new_content.replace(old, new, 1)
applied += 1
else:
print(f"NOT FOUND in {rel}: {old[:80]!r}", file=sys.stderr)
if applied != len(edits):
print(f"Only applied {applied}/{len(edits)} edits in {rel}. ABORTING.", file=sys.stderr)
return 1
with p.open("w", encoding="utf-8", newline="") as f:
f.write(new_content)
remaining = new_content.count("send_result")
print(f"{rel}: applied {applied}/{len(edits)}, remaining={remaining}")
total += applied
print(f"Total: {total} edits applied")
return 0
if __name__ == "__main__":
raise SystemExit(main())
+2 -2
View File
@@ -279,7 +279,7 @@ def _api_generate(controller: 'AppController', req: GenerateRequest) -> dict[str
has_ai_response = any(e.get("role") == "AI" for e in controller.disc_entries) has_ai_response = any(e.get("role") == "AI" for e in controller.disc_entries)
context_to_send = stable_md if not has_ai_response else "" context_to_send = stable_md if not has_ai_response else ""
result = ai_client.send_result(context_to_send, user_msg, base_dir, controller.last_file_items, disc_text, rag_engine=None) result = ai_client.send(context_to_send, user_msg, base_dir, controller.last_file_items, disc_text, rag_engine=None)
if not result.ok: if not result.ok:
err = result.errors[0] err = result.errors[0]
raise HTTPException(status_code=502, detail=err.ui_message()) raise HTTPException(status_code=502, detail=err.ui_message())
@@ -3671,7 +3671,7 @@ class AppController:
self._update_gcli_adapter(self.ui_gemini_cli_path) self._update_gcli_adapter(self.ui_gemini_cli_path)
# FR2 / Bug #1: per conductor/code_styleguides/error_handling.md section 3.1 (AND over OR), # FR2 / Bug #1: per conductor/code_styleguides/error_handling.md section 3.1 (AND over OR),
# we check result.ok instead of catching a ProviderError exception. # we check result.ok instead of catching a ProviderError exception.
result = ai_client.send_result( result = ai_client.send(
event.stable_md, event.stable_md,
user_msg, user_msg,
event.base_dir, event.base_dir,
+3 -3
View File
@@ -5,7 +5,7 @@ This module implements the Tier 2 (Tech Lead) function for generating implementa
It uses the LLM to analyze the track requirements and produce structured ticket definitions. It uses the LLM to analyze the track requirements and produce structured ticket definitions.
Architecture: Architecture:
- Uses ai_client.send_result() for LLM communication - Uses ai_client.send() for LLM communication
- Uses mma_prompts.PROMPTS["tier2_sprint_planning"] for system prompt - Uses mma_prompts.PROMPTS["tier2_sprint_planning"] for system prompt
- Returns JSON array of ticket definitions - Returns JSON array of ticket definitions
@@ -65,14 +65,14 @@ def generate_tickets(track_brief: str, module_skeletons: str) -> list[dict[str,
for _ in range(3): for _ in range(3):
try: try:
# 3. Call Tier 2 Model # 3. Call Tier 2 Model
result = ai_client.send_result( result = ai_client.send(
md_content = "", md_content = "",
user_message = user_message user_message = user_message
) )
if not result.ok: if not result.ok:
_err = result.errors[0] if result.errors else None _err = result.errors[0] if result.errors else None
_msg = _err.ui_message() if _err else "unknown error" _msg = _err.ui_message() if _err else "unknown error"
print(f"[conductor_tech_lead] send_result failed: {_msg}") print(f"[conductor_tech_lead] send failed: {_msg}")
return None return None
response = result.data response = result.data
# 4. Parse JSON Output # 4. Parse JSON Output
+1 -1
View File
@@ -2370,7 +2370,7 @@ MCP_TOOL_SPECS: list[dict[str, Any]] = [
"properties": { "properties": {
"target": { "target": {
"type": "string", "type": "string",
"description": "Fully qualified name of the target (e.g., 'src.ai_client.send_result') or class.method.", "description": "Fully qualified name of the target (e.g., 'src.ai_client.send') or class.method.",
}, },
"max_depth": { "max_depth": {
"type": "integer", "type": "integer",
+2 -2
View File
@@ -588,7 +588,7 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
ai_client.set_current_tier(f"Tier 3 (Worker): {ticket.id}") ai_client.set_current_tier(f"Tier 3 (Worker): {ticket.id}")
try: try:
comms_baseline = len(ai_client.get_comms_log()) comms_baseline = len(ai_client.get_comms_log())
result = ai_client.send_result( result = ai_client.send(
md_content=md_content, md_content=md_content,
user_message=user_message, user_message=user_message,
base_dir=".", base_dir=".",
@@ -600,7 +600,7 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
if not result.ok: if not result.ok:
err = result.errors[0] if result.errors else None err = result.errors[0] if result.errors else None
err_msg = err.ui_message() if err else "unknown error" err_msg = err.ui_message() if err else "unknown error"
print(f"[MMA] Worker send_result failed for {ticket.id}: {err_msg}") print(f"[MMA] Worker send failed for {ticket.id}: {err_msg}")
if event_queue: if event_queue:
_queue_put(event_queue, "response", {"text": f"\n\n[ERROR] {err_msg}", "stream_id": f"Tier 3 (Worker): {ticket.id}", "status": "error", "role": "Vendor API"}) _queue_put(event_queue, "response", {"text": f"\n\n[ERROR] {err_msg}", "stream_id": f"Tier 3 (Worker): {ticket.id}", "status": "error", "role": "Vendor API"})
_queue_put(event_queue, "ticket_completed", {"ticket_id": ticket.id, "timestamp": time.time()}) _queue_put(event_queue, "ticket_completed", {"ticket_id": ticket.id, "timestamp": time.time()})
+2 -2
View File
@@ -83,7 +83,7 @@ def generate_tracks(user_request: str, project_config: dict[str, Any], file_item
try: try:
# 3. Call Tier 1 Model (Strategic - Pro) # 3. Call Tier 1 Model (Strategic - Pro)
# Note: We use gemini-1.5-pro or similar high-reasoning model for Tier 1 # Note: We use gemini-1.5-pro or similar high-reasoning model for Tier 1
result = ai_client.send_result( result = ai_client.send(
md_content="", # We pass everything in user_message for clarity md_content="", # We pass everything in user_message for clarity
user_message=user_message, user_message=user_message,
enable_tools=False, enable_tools=False,
@@ -91,7 +91,7 @@ def generate_tracks(user_request: str, project_config: dict[str, Any], file_item
if not result.ok: if not result.ok:
_err = result.errors[0] if result.errors else None _err = result.errors[0] if result.errors else None
_msg = _err.ui_message() if _err else "unknown error" _msg = _err.ui_message() if _err else "unknown error"
print(f"[orchestrator_pm] send_result failed: {_msg}") print(f"[orchestrator_pm] send failed: {_msg}")
return [] return []
response = result.data response = result.data
# 4. Parse JSON Output # 4. Parse JSON Output