diff --git a/public_html/admin/index.php b/public_html/admin/index.php index 297fa65..b340fb6 100644 --- a/public_html/admin/index.php +++ b/public_html/admin/index.php @@ -856,18 +856,25 @@ if ($action) { j(json_decode($raw, true) ?: ['error'=>'failed']); case 'send_reply': + // Fixed 2026-07-07: sent 'content', but handle_send_email() reads 'body' — + // any edits made to the reply text in the UI were silently discarded and it + // always sent the original AI-drafted reply from email_triage instead. $id = (int)($_GET['id'] ?? 0); if (!$id) bad('Missing triage id'); $content = $_GET['content'] ?? ''; $ch = curl_init('http://127.0.0.1:7474/job'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_POST => true, - CURLOPT_POSTFIELDS => json_encode(['type'=>'send_email','payload'=>['triage_id'=>$id,'content'=>$content],'priority'=>8,'created_by'=>'admin']), + CURLOPT_POSTFIELDS => json_encode(['type'=>'send_email','payload'=>['triage_id'=>$id,'body'=>$content],'priority'=>8,'created_by'=>'admin']), CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); $raw = curl_exec($ch); curl_close($ch); j(json_decode($raw, true) ?: ['error' => 'Arc Reactor unreachable']); case 'compose_email': + // Fixed 2026-07-07: this was sending 'recipient'/'subject'/'auto_send', but + // reactor.py's handle_compose_email() reads 'to_email'/'subject_hint'/'send' — + // every compose dispatch silently produced a draft with blank recipient and + // subject, regardless of whether the LLM drafting step itself succeeded. $to = $_GET['to'] ?? ''; if (!$to) bad('Missing recipient'); $subject = $_GET['subject'] ?? ''; $body = $_GET['body'] ?? ''; @@ -875,7 +882,7 @@ if ($action) { $ch = curl_init('http://127.0.0.1:7474/job'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_POST => true, - CURLOPT_POSTFIELDS => json_encode(['type'=>'compose_email','payload'=>['recipient'=>$to,'subject'=>$subject,'instructions'=>$body,'account'=>$account,'auto_send'=>false],'priority'=>7,'created_by'=>'admin']), + CURLOPT_POSTFIELDS => json_encode(['type'=>'compose_email','payload'=>['to_email'=>$to,'subject_hint'=>$subject,'instructions'=>$body,'account'=>$account,'send'=>false],'priority'=>7,'created_by'=>'admin']), CURLOPT_HTTPHEADER => ['Content-Type: application/json'], ]); $raw = curl_exec($ch); curl_close($ch);