From 2c1fd4c8bfe463a3cc6121d9e1c3ac3df0b8714c Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Thu, 13 Aug 2026 16:08:23 -0400 Subject: [PATCH] Keep the assistant's reading apart from the log it read A guess printed beside a quote is remembered as a second quote, and the next reader inherits it as a finding. --- Plugin/unraid/Tools/ai_chat_worker.php | 26 ++++++++++++++++++++++++-- Plugin/unraid/include/ai.php | 10 ++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Plugin/unraid/Tools/ai_chat_worker.php b/Plugin/unraid/Tools/ai_chat_worker.php index df5231e..da713d7 100644 --- a/Plugin/unraid/Tools/ai_chat_worker.php +++ b/Plugin/unraid/Tools/ai_chat_worker.php @@ -636,8 +636,16 @@ if ($profile === 'chat') { . "[VARAVERK-BUG]\n" . "component: \n" . "summary: \n" + . "diagnosis: \n" . "evidence: \n" . "[/VARAVERK-BUG]\n\n" + // evidence is read as everything after its label, because a quote runs to several + // lines and guessing where it ends would truncate it. Any field added later must + // therefore be listed above it, or it is swallowed into the quote. + . "Keep diagnosis and evidence apart. Evidence is what the log says; diagnosis is " + . "what you make of it. They are labelled differently in the report because whoever " + . "reads it next — a person or another model — has to be able to tell which is which, " + . "and a guess printed beside a quote gets read back as a second quote.\n\n" . "Leave the block out entirely for anything explained by configuration, by a host " . "being offline, or by a job simply not having run. The evidence field is not " . "optional and must be a line you actually saw — a report nobody can check is worse " @@ -1108,8 +1116,18 @@ if ($can('file_bugs') $field = function (string $k) use ($bm): string { return preg_match('/^\s*' . $k . '\s*:\s*(.+?)\s*$/mi', $bm[1], $m) ? trim($m[1]) : ''; }; - // evidence may run to several lines; take everything after the label. - $ev = preg_match('/^\s*evidence\s*:\s*(.*)$/mis', $bm[1], $em) ? trim($em[1]) : ''; + // Both of these run to several lines, so neither can stop at a line break the way $field() + // does — a two-sentence diagnosis would silently lose its second half. Each runs until the + // next known label instead, which also means the order the model writes them in stops + // mattering. That matters more than it sounds: evidence used to take everything after its own + // label, so a diagnosis written after it was absorbed into the quote, and a guess sitting + // inside a verbatim block is exactly the confusion this report is shaped to prevent. + $until = fn(string $k, string $others) => + preg_match('/^\s*' . $k . '\s*:\s*(.*?)(?=^\s*(?:' . $others . ')\s*:|\z)/mis', $bm[1], $m) + ? trim($m[1]) : ''; + + $ev = $until('evidence', 'diagnosis|component|summary'); + $diag = $until('diagnosis', 'evidence|component|summary'); $component = $field('component'); @@ -1138,6 +1156,10 @@ if ($can('file_bugs') $res = ['ok' => false]; } else { $res = vv_ai_bug_write($component, $field('summary'), $ev, [ + // The model's reading, kept apart from the quote it is a reading of. Stored under its + // own key so the report can label it as inference — mixed into the evidence it would + // be indistinguishable from something the log actually said. + 'diagnosis' => $diag, 'asked' => mb_substr($question, 0, 300), 'scope' => $scope, 'log' => $scopedLog['path'] ?? null, diff --git a/Plugin/unraid/include/ai.php b/Plugin/unraid/include/ai.php index dea4354..c6e6b80 100644 --- a/Plugin/unraid/include/ai.php +++ b/Plugin/unraid/include/ai.php @@ -1334,6 +1334,16 @@ function vv_ai_bug_report(array $b): string { $out .= "### Evidence — verbatim, " . $vLabel . "\n\n```\n" . rtrim((string) $g('evidence')) . "\n```\n\n"; + // Deliberately after the evidence and deliberately labelled. This is the assistant's reading, + // and the heading has to survive being skim-read: a diagnosis printed next to a log quote + // gets remembered as a second log quote, and the next reader inherits a guess as a finding. + if (!empty($ctx['diagnosis'])) { + $out .= "### The assistant's reading — INFERENCE, not established\n\n" + . "> " . str_replace("\n", "\n> ", trim((string) $ctx['diagnosis'])) . "\n\n" + . "_Written by a 14B model from the evidence above. Worth checking, not worth " + . "trusting._\n\n"; + } + if (!empty($ctx['asked'])) { $out .= "### What was being asked when it was noticed\n\n> " . str_replace("\n", "\n> ", trim((string) $ctx['asked'])) . "\n\n";