From 8fcff618557d00067fbb43c17fe4b4017a503ba6 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Fri, 26 Jun 2026 10:42:06 +0800 Subject: [PATCH] fix(ai_agent_runtime): resolver must verify browser actually runs, skip disabled stub The Chromium resolver accepted any candidate that merely existed (command -v / -x), so it selected xfce's intentionally-disabled /usr/local/bin/chromium stub (exits 126 "Chromium is disabled, use google-chrome") over the working google-chrome. The later "Check chromium version" verify then failed rc=126. Latent on fresh hosts (depends on role ordering vs the stub install) and deterministic on any re-run. Now require ` --version` to succeed before accepting, so the stub is skipped and google-chrome is resolved. Co-Authored-By: Claude Sonnet 4.6 --- roles/ai_agent_runtime/tasks/browser.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/roles/ai_agent_runtime/tasks/browser.yml b/roles/ai_agent_runtime/tasks/browser.yml index 1d81194..6b42b0f 100644 --- a/roles/ai_agent_runtime/tasks/browser.yml +++ b/roles/ai_agent_runtime/tasks/browser.yml @@ -14,12 +14,16 @@ google-chrome-stable \ /usr/bin/chromium \ /snap/bin/chromium; do + resolved="" if command -v "$candidate" >/dev/null 2>&1; then - command -v "$candidate" - exit 0 + resolved="$(command -v "$candidate")" + elif [ -x "$candidate" ]; then + resolved="$candidate" fi - if [ -x "$candidate" ]; then - printf '%s\n' "$candidate" + # 必须真正可执行:跳过 xfce 安装的 disabled chromium stub(退出码 126), + # 否则 resolver 会选中它,后续 --version 校验必失败。 + if [ -n "$resolved" ] && "$resolved" --version >/dev/null 2>&1; then + printf '%s\n' "$resolved" exit 0 fi done @@ -62,12 +66,16 @@ /usr/bin/chromium \ /snap/bin/chromium \ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; do + resolved="" if command -v "$candidate" >/dev/null 2>&1; then - command -v "$candidate" - exit 0 + resolved="$(command -v "$candidate")" + elif [ -x "$candidate" ]; then + resolved="$candidate" fi - if [ -x "$candidate" ]; then - printf '%s\n' "$candidate" + # 必须真正可执行:跳过 xfce 安装的 disabled chromium stub(退出码 126), + # 否则 resolver 会选中它,后续 --version 校验必失败。 + if [ -n "$resolved" ] && "$resolved" --version >/dev/null 2>&1; then + printf '%s\n' "$resolved" exit 0 fi done