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

This commit is contained in:
root
2026-07-07 09:01:47 -05:00
parent 48b2a8523a
commit 8034fc67e9
+9 -2
View File
@@ -856,18 +856,25 @@ if ($action) {
j(json_decode($raw, true) ?: ['error'=>'failed']); j(json_decode($raw, true) ?: ['error'=>'failed']);
case 'send_reply': 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'); $id = (int)($_GET['id'] ?? 0); if (!$id) bad('Missing triage id');
$content = $_GET['content'] ?? ''; $content = $_GET['content'] ?? '';
$ch = curl_init('http://127.0.0.1:7474/job'); $ch = curl_init('http://127.0.0.1:7474/job');
curl_setopt_array($ch, [ curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_POST => true, 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'], CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
]); ]);
$raw = curl_exec($ch); curl_close($ch); $raw = curl_exec($ch); curl_close($ch);
j(json_decode($raw, true) ?: ['error' => 'Arc Reactor unreachable']); j(json_decode($raw, true) ?: ['error' => 'Arc Reactor unreachable']);
case 'compose_email': 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'); $to = $_GET['to'] ?? ''; if (!$to) bad('Missing recipient');
$subject = $_GET['subject'] ?? ''; $subject = $_GET['subject'] ?? '';
$body = $_GET['body'] ?? ''; $body = $_GET['body'] ?? '';
@@ -875,7 +882,7 @@ if ($action) {
$ch = curl_init('http://127.0.0.1:7474/job'); $ch = curl_init('http://127.0.0.1:7474/job');
curl_setopt_array($ch, [ curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_POST => true, 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'], CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
]); ]);
$raw = curl_exec($ch); curl_close($ch); $raw = curl_exec($ch); curl_close($ch);