Ask about a run from the row it is on, and stop spending context on health checks when the run was clean

This commit is contained in:
Gmer4Lfe
2026-08-06 21:51:55 -04:00
parent 4347fc5f07
commit f2d0e18f2c
5 changed files with 105 additions and 19 deletions
+11 -2
View File
@@ -855,10 +855,19 @@ function vv_ai_resolve_run_target(string $question): string {
}
// Anything with a log but no alias — named outright, either as an id or a bare script name.
//
// Whole words only. A substring test matched the `ai` log inside the word "f-ai-l", so
// "why did this run fail" resolved to ai.log and would have attached it to a question about
// something else entirely. Short ids make that failure common rather than exotic: mail, again,
// available, maintenance all contain it.
$hits = [];
foreach (vv_ai_log_ids() as $id) {
$bare = basename($id);
if (str_contains($q, strtolower($id)) || str_contains($q, strtolower($bare))) $hits[] = $id;
foreach ([strtolower($id), strtolower(basename($id))] as $needle) {
if ($needle !== '' && preg_match('/\b' . preg_quote($needle, '/') . '\b/', $q)) {
$hits[] = $id;
break;
}
}
}
$hits = array_unique($hits);
if (count($hits) === 1) return reset($hits);