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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user