Write down the routing every bug so far produced, and check it without asking the model
This commit is contained in:
@@ -129,6 +129,9 @@ if ($explain) {
|
||||
}
|
||||
|
||||
// What got attached and why, recorded as it happens rather than reconstructed afterwards.
|
||||
// Keyed by a stable token with the varying detail — counts, line totals — kept in the value, so a
|
||||
// fixture can assert that the log tail was attached without asserting how many lines it had that
|
||||
// day. An assertion that breaks whenever a log grows is an assertion nobody keeps.
|
||||
$attached = [];
|
||||
|
||||
$profile = in_array($profile, ['varaverk', 'chat', 'code', 'troubleshoot'], true) ? $profile : 'varaverk';
|
||||
@@ -279,7 +282,7 @@ if ($diagnostic) {
|
||||
// asked what was wrong, it reported "AI_ENABLED=false" read from the conf *template*
|
||||
// while the live value was true. Documentation records defaults; only this block records
|
||||
// what is actually set.
|
||||
$attached[] = 'health (' . count(vv_ai_health()) . ' checks)';
|
||||
$attached['health'] = count(vv_ai_health()) . ' checks';
|
||||
$diagBlock .= "LIVE SYSTEM STATE (authoritative — measured just now)\n";
|
||||
foreach (vv_ai_health() as $c) {
|
||||
$mark = ['ok' => 'OK', 'warn' => 'WARNING', 'bad' => 'PROBLEM'][$c['state']] ?? '?';
|
||||
@@ -290,7 +293,7 @@ if ($diagnostic) {
|
||||
|
||||
$logs = vv_ai_recent_logs(40);
|
||||
if ($logs) {
|
||||
$attached[] = 'recent warnings (' . count($logs) . ' lines)';
|
||||
$attached['warnings'] = count($logs) . ' lines';
|
||||
$diagBlock .= "RECENT WARNINGS AND ERRORS (newest last)\n" . implode("\n", $logs) . "\n\n";
|
||||
}
|
||||
}
|
||||
@@ -312,8 +315,7 @@ if ($runTarget !== '' && vv_ai_scope_ok($runTarget)) {
|
||||
// next line, and the difference is the whole answer.
|
||||
$rec = vv_ai_run_record($runTarget);
|
||||
if ($rec['ok']) {
|
||||
$attached[] = 'run record (' . $rec['status']
|
||||
. ', exit ' . var_export($rec['exit'], true) . ')';
|
||||
$attached['run_record'] = $rec['status'] . ', exit ' . var_export($rec['exit'], true);
|
||||
$diagBlock .= 'RUN RECORD for ' . $runTarget . " (authoritative — how the last run ended)\n"
|
||||
. '- status: ' . $rec['status']
|
||||
. ($rec['exit'] !== null ? ' (exit ' . $rec['exit'] . ')' : '') . "\n"
|
||||
@@ -328,13 +330,13 @@ if ($runTarget !== '' && vv_ai_scope_ok($runTarget)) {
|
||||
|
||||
$scopedLog = vv_ai_scoped_log($runTarget, 120);
|
||||
if ($scopedLog['ok']) {
|
||||
$attached[] = 'log tail ' . $scopedLog['path'] . ' (' . count($scopedLog['tail'])
|
||||
. ' of ' . $scopedLog['total'] . ' lines)';
|
||||
$attached['log_tail'] = $scopedLog['path'] . ' (' . count($scopedLog['tail'])
|
||||
. ' of ' . $scopedLog['total'] . ' lines)';
|
||||
$diagBlock .= 'LOG: ' . $scopedLog['path']
|
||||
. ' (' . $scopedLog['total'] . " lines total, newest last)\n"
|
||||
. implode("\n", $scopedLog['tail']) . "\n\n";
|
||||
} else {
|
||||
$attached[] = 'log tail MISSING for ' . $runTarget . ' (' . ($scopedLog['error'] ?? '?') . ')';
|
||||
$attached['log_missing'] = $runTarget . ' — ' . ($scopedLog['error'] ?? '?');
|
||||
$diagBlock .= "LOG: none found for " . $runTarget . " — it may never have run.\n\n";
|
||||
}
|
||||
}
|
||||
@@ -348,7 +350,7 @@ if ($runTarget !== '' && vv_ai_scope_ok($runTarget)) {
|
||||
if ($can('incidents') && $scope !== '') {
|
||||
$past = vv_ai_incidents_for($scope, 4);
|
||||
if ($past) {
|
||||
$attached[] = 'operator incidents (' . count($past) . ')';
|
||||
$attached['incidents'] = (string)count($past);
|
||||
$diagBlock .= "PREVIOUSLY ON THIS, WRITTEN BY THE OPERATOR AFTER IT WAS RESOLVED\n"
|
||||
. "Confirmed outcomes, not guesses. If the current symptom matches one of "
|
||||
. "these, say so and lead with it. If it clearly does not, ignore them "
|
||||
@@ -372,7 +374,7 @@ if ($can('conf_lookup')) {
|
||||
}
|
||||
}
|
||||
if ($seen) {
|
||||
$attached[] = 'conf keys resolved (' . count($seen) . ')';
|
||||
$attached['conf_keys'] = (string)count($seen);
|
||||
$diagBlock .= "WHERE THESE SETTINGS ACTUALLY LIVE (looked up just now, authoritative)\n"
|
||||
. implode("\n", $seen) . "\n"
|
||||
. "If this is a different file from the one they have open, say so plainly.\n\n";
|
||||
@@ -653,7 +655,7 @@ if ($explain) {
|
||||
if (!$attached) {
|
||||
echo ' (nothing', $sources ? " — no evidence beyond the passages)\n" : ")\n";
|
||||
}
|
||||
foreach ($attached as $a) echo ' ', $a, "\n";
|
||||
foreach ($attached as $k => $detail) printf(" %-12s %s\n", $k, $detail);
|
||||
echo "\n";
|
||||
|
||||
echo 'RETRIEVED ', count($sources), " passages\n";
|
||||
|
||||
Reference in New Issue
Block a user