From 8034fc67e98967b8398ae7e39ecc5afc92c6093b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Jul 2026 09:01:47 -0500 Subject: [PATCH] Fix field-name mismatches between PHP dispatcher and Python reactor: compose_email (recipient/subject/auto_send -> to_email/subject_hint/send) and send_reply (content -> body) were silently dropping the actual recipient, subject, and user-edited content on every dispatch --- public_html/admin/index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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);