From f1e172caec63934f0059a50191c4ff5f1fbd8be2 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 30 Jun 2026 18:33:59 -0400 Subject: [PATCH] Shorten hwmonDaemon auto-comments (drop embedded ASCII description) The priority-escalation and recurrence comments embedded the full ASCII alert description in a code block, producing a wall-of-text comment every time. Since the ticket DESCRIPTION is already refreshed with the current sensor data on each update, the comment only needs to record the event: - Escalation: short note with from/to priority labels + a brief reason ("more severe condition reported, needs faster attention; see description"). - Recurrence: short reopened note pointing at the refreshed description. Co-Authored-By: Claude Opus 4.8 --- create_ticket_api.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/create_ticket_api.php b/create_ticket_api.php index f49f939..99eab78 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -312,9 +312,18 @@ if ($existing) { $updStmt->close(); // Only post a comment on priority escalation — title and description updates - // are silent (title changes like rising counters would spam a comment every run) + // are silent (title changes like rising counters would spam a comment every run). + // Keep it short: the full sensor data is refreshed in the ticket description, + // so the comment just records the bump + a brief reason (no ASCII dump). if (isset($changes['priority'])) { - $commentText = "**hwmonDaemon escalated this ticket from P{$changes['priority']['from']} to P{$changes['priority']['to']}.**\n\n```\n" . $description . "\n```"; + $pLabels = [1 => 'P1 (Critical)', 2 => 'P2 (High)', 3 => 'P3 (Medium)', 4 => 'P4 (Low)', 5 => 'P5 (Minimal)']; + $fromP = (int)$changes['priority']['from']; + $toP = (int)$changes['priority']['to']; + $fromL = $pLabels[$fromP] ?? "P{$fromP}"; + $toL = $pLabels[$toP] ?? "P{$toP}"; + $commentText = "**hwmonDaemon raised priority {$fromL} → {$toL}.**\n\n" + . "The latest monitoring scan reported a more severe condition for this issue, " + . "so it now needs faster attention. Current sensor data is in the ticket description above."; $commentStmt = $conn->prepare( "INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)" ); @@ -362,7 +371,7 @@ if ($existing) { $reopenStmt->close(); $commentText = "**Issue recurred — ticket reopened automatically.**\n\n" . - "New report received from hwmonDaemon:\n\n```\n" . $description . "\n```"; + "hwmonDaemon detected this condition again. Current sensor data is in the ticket description above."; $commentStmt = $conn->prepare( "INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)" );