From b4f467e712f95f8b8b1a660bd13215e17152ab1e Mon Sep 17 00:00:00 2001 From: Derek Hsu Date: Thu, 19 Nov 2026 15:26:30 +0800 Subject: [PATCH 1/2] fix(images): manage the Hermes tools browser backend in the policy The Hermes tools image set browser.backend "off" only in config.yaml. The dashboard config seeder copies the gateway config only when each managed section equals the managed policy, so tools.2 Dashboards got no model. configure-tools-browser.py now also sets browser.backend "off" in the managed policy and adds it to the managed paths, and writes neither file when either is invalid. Dockerfile.tools reruns the base image's dashboard policy probe as the sandbox user, and the Hermes fixtures add a dashboard seed check. Closes #79 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Derek Hsu --- agents/hermes-01x/Dockerfile.tools | 30 +++++-- agents/hermes-01x/README.md | 6 +- agents/hermes-01x/configure-tools-browser.py | 57 +++++++++---- .../2026-11-17-hermes-tools-image.md | 15 ++-- test/hermes-tools-browser-config.test.ts | 83 +++++++++++++++++-- .../fixtures/run-phase2.sh | 19 +++++ 6 files changed, 176 insertions(+), 34 deletions(-) diff --git a/agents/hermes-01x/Dockerfile.tools b/agents/hermes-01x/Dockerfile.tools index 92bf4f79e1d..9e3278abe4c 100644 --- a/agents/hermes-01x/Dockerfile.tools +++ b/agents/hermes-01x/Dockerfile.tools @@ -13,9 +13,9 @@ # The image PATH puts the Hermes virtual environment first, so a plain # python3 is Hermes' own interpreter, which these packages must not change. # - No OpenClaw skill or openclaw.json change. The Hermes browser tools use -# the base image's agent-browser: config.yaml sets browser.backend "off", -# and /etc/chromium.d/nemoclaw-openshell adds the Chromium flags that an -# OpenShell sandbox requires. +# the base image's agent-browser: config.yaml and the managed policy set +# browser.backend "off", and /etc/chromium.d/nemoclaw-openshell adds the +# Chromium flags that an OpenShell sandbox requires. # # The final image keeps the base image's user, entrypoint, command, working # directory, environment, healthcheck, and controlled package versions. It @@ -107,7 +107,7 @@ USER root COPY --from=perl-modules /out/libtext-charwidth-perl.deb /tmp/nemoclaw-tools/ COPY tools/openclaw-tools-image/apt-packages.txt tools/openclaw-tools-image/apt-packages-browser.txt \ tools/openclaw-tools-image/python/requirements.lock \ - agents/hermes-01x/configure-tools-browser.py \ + agents/hermes-01x/configure-tools-browser.py agents/hermes-01x/image-build-probes.py \ /tmp/nemoclaw-tools/ COPY --from=yq-build --chmod=0755 /out/yq /usr/local/bin/yq COPY tools/openclaw-tools-image/node/package.json tools/openclaw-tools-image/node/package-lock.json \ @@ -229,15 +229,20 @@ RUN set -eu; \ chmod 0644 /etc/chromium.d/nemoclaw-openshell; \ # Keep Hermes on its built-in browser tools instead of the Browser Use CLI # that `uvx browser-use` fetches from PyPI (configure-tools-browser.py - # explains why). Then seal config.yaml again exactly as the base image - # does; only the config.yaml hash line changes. + # explains why). The managed policy gets the same value, or the dashboard + # config seeder refuses the gateway config (#79). Then seal config.yaml + # again exactly as the base image does; only the config.yaml hash line + # changes. config=/sandbox/.hermes/config.yaml; \ + policy=/usr/local/share/nemoclaw/hermes-managed-policy.json; \ seal=/etc/nemoclaw/hermes.config-hash; \ test "$(stat -c '%U:%G %a' "$config")" = "sandbox:sandbox 640"; \ + test "$(stat -c '%U:%G %a' "$policy")" = "root:root 444"; \ test "$(stat -c '%U:%G %a' "$seal")" = "root:root 444"; \ sha256sum -c --quiet "$seal"; \ mcp_line=$(grep '^# nemoclaw-hermes-mcp-state-v1 ' "$seal"); \ - /usr/bin/python3 -I /tmp/nemoclaw-tools/configure-tools-browser.py "$config"; \ + /usr/bin/python3 -I /tmp/nemoclaw-tools/configure-tools-browser.py "$config" "$policy"; \ + test "$(stat -c '%U:%G %a' "$policy")" = "root:root 444"; \ ( cd /opt/hermes && HERMES_HOME=/sandbox/.hermes /opt/hermes/.venv/bin/python -I -c \ 'import sys; sys.path.insert(0, "/opt/hermes"); from tools.browser_use_cli import get_browser_backend, is_browser_use_cli_mode; assert get_browser_backend() == "off" and not is_browser_use_cli_mode()' ); \ mcp_digest="$(/opt/hermes/.venv/bin/python -I /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py --guard /usr/local/lib/nemoclaw/hermes-runtime-config-guard.py --config "$config")"; \ @@ -250,6 +255,17 @@ RUN set -eu; \ chown sandbox:sandbox /sandbox/.hermes/.config-hash; \ chmod 0640 /sandbox/.hermes/.config-hash; \ sha256sum -c --quiet "$seal"; \ + # Repeat the base image's dashboard policy probe on the changed files, as + # the sandbox user: the seeder must accept the gateway config and copy the + # model and every managed path, browser.backend included. + probe=/tmp/nemoclaw-dashboard-policy-probe.yaml; \ + setpriv --reuid=sandbox --regid=sandbox --init-groups \ + /opt/hermes/.venv/bin/python -I /usr/local/lib/nemoclaw/seed-hermes-dashboard-config.py \ + "$policy" "$config" "$probe"; \ + grep -q '^model:' "$probe"; \ + setpriv --reuid=sandbox --regid=sandbox --init-groups \ + /opt/hermes/.venv/bin/python -I /tmp/nemoclaw-tools/image-build-probes.py dashboard-policy "$probe"; \ + test ! -e "$probe"; \ rm -rf /tmp/nemoclaw-tools /root/.npm /root/.cache /root/.local/share/pnpm # Same user name as the base image configuration. diff --git a/agents/hermes-01x/README.md b/agents/hermes-01x/README.md index c58ad053010..e9eb5cb73dc 100644 --- a/agents/hermes-01x/README.md +++ b/agents/hermes-01x/README.md @@ -33,7 +33,11 @@ model. agent-browser on the image's Chromium: `config.yaml` sets `browser.backend: "off"` (no Browser Use CLI fetched by `uvx`) and `/etc/chromium.d/nemoclaw-openshell` adds the flags OpenShell's seccomp - needs. See `docs/modification/2026-11-17-hermes-tools-image.md`. + needs. The dashboard config seeder copies the gateway config only when + every managed section matches the managed policy + (`/usr/local/share/nemoclaw/hermes-managed-policy.json`). `tools.2` changed + only `config.yaml`, so the Dashboard got no model (#79). From `tools.3`, + the policy also sets and manages `browser.backend`. See `docs/modification/2026-11-17-hermes-tools-image.md`. - There is no `manifest.yaml` here on purpose: the NemoClaw CLI discovers agents from `agents/*/manifest.yaml`, and the CLI's Hermes agent remains `agents/hermes/`. This image is consumed by ClawShell only. diff --git a/agents/hermes-01x/configure-tools-browser.py b/agents/hermes-01x/configure-tools-browser.py index e0d8845277a..25a60d0f31d 100644 --- a/agents/hermes-01x/configure-tools-browser.py +++ b/agents/hermes-01x/configure-tools-browser.py @@ -1,8 +1,8 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Keep the Hermes tools image on Hermes' built-in browser tools (derekhsu/NemoClaw#74). +"""Keep the Hermes tools image on Hermes' built-in browser tools (derekhsu/NemoClaw#74, #79). -Usage: configure-tools-browser.py +Usage: configure-tools-browser.py With browser.backend unset, Hermes replaces its browser tools with the Browser Use CLI whenever uvx is on PATH, and that CLI is fetched from PyPI with @@ -14,12 +14,21 @@ line after it and changes nothing else, so comments and key order stay as the base image wrote them. Quoting "off" keeps it a string; YAML 1.1 reads a bare off as false, which Hermes also accepts. + +The same value goes into the managed policy, and browser.backend becomes a +managed path. The dashboard config seeder copies the gateway config only when +each managed section equals the policy, and it copies the managed paths into +the dashboard profile, so the dashboard also gets browser.backend "off" (#79). """ +import json import sys BROWSER_BLOCK = "browser:" BACKEND_LINE = ' backend: "off"' +BACKEND_PATH = "browser.backend" +# Keep the browser paths together in the policy's managed_paths list. +BACKEND_PATH_AFTER = "browser.restrict_evaluate" def configure(text: str) -> str: @@ -40,21 +49,41 @@ def configure(text: str) -> str: return "\n".join(lines) +def configure_policy(text: str) -> str: + """Return the policy ``text`` with browser.backend "off" managed; raise ValueError otherwise.""" + policy = json.loads(text) + browser = policy.get("config", {}).get("browser") + paths = policy.get("managed_paths") + if not isinstance(browser, dict) or not isinstance(paths, list): + raise ValueError("the policy has no config.browser mapping or managed_paths list") + if "backend" in browser or BACKEND_PATH in paths: + raise ValueError("the policy already sets browser.backend") + if BACKEND_PATH_AFTER not in paths: + raise ValueError(f"the policy does not manage {BACKEND_PATH_AFTER}") + browser["backend"] = "off" + paths.insert(paths.index(BACKEND_PATH_AFTER) + 1, BACKEND_PATH) + # Same layout as the generator: JSON.stringify(policy, null, 2) plus a newline. + return json.dumps(policy, indent=2, ensure_ascii=False) + "\n" + + def main() -> int: - if len(sys.argv) != 2: + if len(sys.argv) != 3: print(__doc__.strip().splitlines()[2], file=sys.stderr) return 2 - path = sys.argv[1] - with open(path, encoding="utf-8") as handle: - text = handle.read() - try: - updated = configure(text) - except ValueError as error: - print(f"{path}: {error}", file=sys.stderr) - return 1 - # Write in place so the base image's owner and mode stay unchanged. - with open(path, "w", encoding="utf-8") as handle: - handle.write(updated) + updates = [] + for path, change in ((sys.argv[1], configure), (sys.argv[2], configure_policy)): + with open(path, encoding="utf-8") as handle: + text = handle.read() + try: + updates.append((path, change(text))) + except ValueError as error: + print(f"{path}: {error}", file=sys.stderr) + return 1 + # Check both files before writing either. Write in place so the base + # image's owner and mode stay unchanged. + for path, updated in updates: + with open(path, "w", encoding="utf-8") as handle: + handle.write(updated) return 0 diff --git a/docs/modification/2026-11-17-hermes-tools-image.md b/docs/modification/2026-11-17-hermes-tools-image.md index 473f1033631..5988c4cbbd5 100644 --- a/docs/modification/2026-11-17-hermes-tools-image.md +++ b/docs/modification/2026-11-17-hermes-tools-image.md @@ -5,8 +5,8 @@ > **日期**: 2026-11-17 > **Fork**: `derekhsu/NemoClaw` -> **Issue**: [#74](https://github.com/derekhsu/NemoClaw/issues/74) -> **狀態**: `tools.1` 已發布並在 OpenShell 0.1.7 sandbox 驗收。第二階段(`tools.2` 起)開啟 Hermes browser 工具。 +> **Issue**: [#74](https://github.com/derekhsu/NemoClaw/issues/74)、[#79](https://github.com/derekhsu/NemoClaw/issues/79) +> **狀態**: `tools.1` 已發布並在 OpenShell 0.1.7 sandbox 驗收。第二階段(`tools.2` 起)開啟 Hermes browser 工具。`tools.2` 的 Dashboard 拿不到模型設定,`tools.3` 修正(#79)。 ## 1. 摘要 @@ -75,10 +75,12 @@ Node.js 套件、LibreOffice、officecli、OCR、pandoc、ImageMagick、ffmpeg | 設定 | 位置 | 原因 | |------|------|------| -| `browser.backend: "off"` | `/sandbox/.hermes/config.yaml` | 沒有設定時,只要 `PATH` 上有 `uvx`,Hermes 就改用 Browser Use CLI:模型只拿到 `browser_exec`,第一次使用時以 `uvx browser-use` 從 PyPI 下載未鎖版本的套件。`off` 讓 Hermes 使用內建的 browser 工具 | +| `browser.backend: "off"` | `/sandbox/.hermes/config.yaml`;`tools.3` 起也寫進 managed policy `/usr/local/share/nemoclaw/hermes-managed-policy.json`,並列入受管路徑 | 沒有設定時,只要 `PATH` 上有 `uvx`,Hermes 就改用 Browser Use CLI:模型只拿到 `browser_exec`,第一次使用時以 `uvx browser-use` 從 PyPI 下載未鎖版本的套件。`off` 讓 Hermes 使用內建的 browser 工具 | | `--no-sandbox --no-zygote --disable-gpu` | `/etc/chromium.d/nemoclaw-openshell` | agent-browser 啟動 `/usr/bin/chromium`,這個 Debian 包裝腳本會讀 `/etc/chromium.d` 的參數再執行 `/usr/lib/chromium/chromium`。OpenShell 的 seccomp 不允許 Chromium 自己的 sandbox 與 zygote 建立 user namespace,沒有這些參數時 Chromium 會立刻結束(`CDP response channel closed`)。Hermes Agent v0.21.3 只在 root 或 Docker 下才會自己加 `--no-sandbox`(`tools/browser_tool_session.py`) | -修改 `config.yaml` 後,建置步驟以 base 映像相同的方式重算 `/etc/nemoclaw/hermes.config-hash`(與 `/sandbox/.hermes/.config-hash`),Hermes 啟動時的設定完整性檢查因此仍會通過。MCP 設定沒有改變,MCP digest 維持原值。 +Dashboard 使用自己的 profile `dashboard-home`。sandbox 每次啟動時,`start.sh` 會以 `seed-hermes-dashboard-config.py` 把 gateway `config.yaml` 的模型設定與受管路徑複製到這個 profile;gateway 設定中每個受管區段必須與 managed policy 完全相同,否則整份不複製。`tools.2` 只改了 `config.yaml`,`browser` 區段因此與 policy 不同,Dashboard 的 CHAT 與 Models 頁沒有模型(`No inference provider configured`)。`tools.3` 同時更新 policy,Dashboard 也拿到模型與 `browser.backend: "off"`。 + +修改 `config.yaml` 後,建置步驟以 base 映像相同的方式重算 `/etc/nemoclaw/hermes.config-hash`(與 `/sandbox/.hermes/.config-hash`),Hermes 啟動時的設定完整性檢查因此仍會通過。MCP 設定沒有改變,MCP digest 維持原值。接著以 sandbox 使用者重跑 base 映像建置時的 dashboard policy 檢查:同步腳本必須接受 gateway 設定,產生的 Dashboard 設定要有 `model:`,每個受管路徑(包含 `browser.backend`)都要與 policy 相同。 Hermes Agent v0.21.3 以本機 Chromium 執行時不做私有位址檢查(`tools/browser_tool.py` 的 `_url_policy_error`),所以 OpenShell policy DNS 回傳的 `198.18.0.0/15` 合成 IP 不會被擋;雲端 metadata 位址(例如 `169.254.169.254`)仍一律拒絕。這點與 OpenClaw 不同,不需要設定 SSRF 例外。 @@ -101,7 +103,7 @@ Hermes Agent v0.21.3 以本機 Chromium 執行時不做私有位址檢查(`tools |------|------| | `check-image.sh ... hermes` | 執行設定、`hermes --version` 與 base 相同;新增的 setuid、setgid 或 file capability 檔案必須列在 `tools/openclaw-tools-image/privileged-files-added.txt` | | `check-tools-start.sh` | base 與 tools 映像以相同限制啟動(無網路、`--cap-drop ALL`、`no-new-privileges`),容器狀態、啟動輸出、`/tmp/nemoclaw-start.log` 與 process 清單必須相同 | -| `run-fixtures.sh ... hermes` | 以 sandbox 使用者、唯讀 root、無 capability、無網路執行共用 fixture;OpenClaw 專屬的 `himalaya_skill_override` 與 `browser_config` 記為 `SKIP`,`himalaya_journey` 略過 skill 檢查。`hermes_browser_backend` 確認 `browser.backend` 為 `off`、設定 hash 相符、Hermes 提供內建 browser 工具;`agent_browser` 不帶任何 agent-browser 設定開頁,並確認 Chromium 帶著 `/etc/chromium.d` 的參數執行 | +| `run-fixtures.sh ... hermes` | 以 sandbox 使用者、唯讀 root、無 capability、無網路執行共用 fixture;OpenClaw 專屬的 `himalaya_skill_override` 與 `browser_config` 記為 `SKIP`,`himalaya_journey` 略過 skill 檢查。`hermes_browser_backend` 確認 `browser.backend` 為 `off`、設定 hash 相符、Hermes 提供內建 browser 工具;`hermes_dashboard_seed` 以映像內的 policy 與 `config.yaml` 執行 Dashboard 設定同步,產生的設定要有模型,`browser.backend` 為 `off`;`agent_browser` 不帶任何 agent-browser 設定開頁,並確認 Chromium 帶著 `/etc/chromium.d` 的參數執行 | | Trivy | tools layer 不得新增可修正的 CRITICAL 或 HIGH 弱點 | `check-tools-start.sh` 用一般 Docker 執行,只涵蓋映像自己的啟動設定。 @@ -131,6 +133,7 @@ gateway 與 API runtime 由 OpenShell 啟動,要在 OpenShell 0.1.7 sandbox 中 ## 6. 安全考量與尚未完成的驗收 - **新增的特權檔案**:LibreOffice 的相依套件帶入 `dbus-daemon-launch-helper`(setuid)與 `gst-ptp-helper`(file capability)。process 設定 `no_new_privs` 時兩者都不會取得額外權限;fixture 與啟動比對都在這個條件下執行,OpenShell sandbox 內的 process 也實測為 `NoNewPrivs: 1`(見下方實機驗收)。其他新增的特權檔案會讓 `check-image.sh` 失敗。 -- **API profile 不受影響**:API profile 的政策拒絕 terminal 與 browser 工具,Landlock 也只開放部分路徑,新工具只在預設 profile 使用。 +- **API profile 不受影響**:API profile 的政策拒絕 terminal 與 browser 工具,Landlock 也只開放部分路徑,新工具只在預設 profile 使用。API profile 的 `config.yaml` 由 managed policy 的受管區段產生,`tools.3` 起 `browser` 區段也帶有 `backend: "off"`,但 browser 工具仍被拒絕。 +- **沒有 `config.yaml` 的具名 profile**:base 映像建置時依 managed policy 修改 Hermes 對沒有 `config.yaml` 的具名 profile 所用的預設值(`patch-profile-policy-defaults.py`),但沒有修改 `browser.backend`。Hermes 直接讀 profile 的 `config.yaml` 取得這個值,所以這類 profile 的 `browser.backend` 仍是未設定,與 `tools.2` 相同;base 映像建置時的 `profile-policy` 檢查若在 tools 映像重跑,會因此不通過。預設 profile、`dashboard-home` 與 API profile 都有 `config.yaml`,不受影響。 - **base 的安全檢查**:Hermes base 沒有 tmux,受控的 expat 版本(`libexpat1=2.8.3-1`)也與 OpenClaw base(2.9.0)不同,所以 `base_security_checks` 只對 OpenClaw 檢查這兩項;Hermes 的 expat 版本由 `controlled_packages` 依 base 的 `security-packages.txt` 檢查。 - **實機驗收**(`tools.1`,OpenShell 0.1.7、Podman、arm64,經 ClawShell 建立):sandbox 到 `running`,API 對話與 `upload_file` 上傳下載正常;`nemoclaw-start`、Hermes gateway、API runtime 與 MCP supervisor 的 `NoNewPrivs` 皆為 1;4 個 LibreOffice 同時轉檔時 sandbox 內 process 峰值 31(#32 的上限 512)。 diff --git a/test/hermes-tools-browser-config.test.ts b/test/hermes-tools-browser-config.test.ts index d0e496e27df..d1e6fd80613 100644 --- a/test/hermes-tools-browser-config.test.ts +++ b/test/hermes-tools-browser-config.test.ts @@ -27,19 +27,48 @@ const BASE_CONFIG = [ "", ].join("\n"); -function configure(text: string) { +// The managed policy layout the generator writes: JSON.stringify(policy, null, 2). +const BASE_POLICY_OBJECT = { + schema_version: 1, + config: { + approvals: { mode: "manual" }, + browser: { allow_unsafe_evaluate: false, restrict_evaluate: true }, + database: { temp_store: 2 }, + model: { default: "nvidia/model", api_key: "sk-OPENSHELL-PROXY-REWRITE" }, + }, + env_lines: ["API_SERVER_HOST=127.0.0.1"], + dashboard: { routing_keys: ["model"], env_keys: ["API_SERVER_HOST"] }, + managed_paths: [ + "approvals.mode", + "browser.allow_unsafe_evaluate", + "browser.restrict_evaluate", + "database.temp_store", + ], +}; +const BASE_POLICY = `${JSON.stringify(BASE_POLICY_OBJECT, null, 2)}\n`; + +function configure(text: string, policyText = BASE_POLICY) { const dir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-hermes-tools-browser-")); try { const file = path.join(dir, "config.yaml"); + const policyFile = path.join(dir, "managed-policy.json"); fs.writeFileSync(file, text); - const result = spawnSync("python3", [SCRIPT, file], { encoding: "utf8", timeout: 10_000 }); - return { result, written: fs.readFileSync(file, "utf8") }; + fs.writeFileSync(policyFile, policyText); + const result = spawnSync("python3", [SCRIPT, file, policyFile], { + encoding: "utf8", + timeout: 10_000, + }); + return { + result, + written: fs.readFileSync(file, "utf8"), + policy: fs.readFileSync(policyFile, "utf8"), + }; } finally { fs.rmSync(dir, { recursive: true, force: true }); } } -describe("Hermes tools image browser backend (#74)", () => { +describe("Hermes tools image browser backend (#74, #79)", () => { it("sets browser.backend to off and changes no other line", () => { const { result, written } = configure(BASE_CONFIG); @@ -64,11 +93,53 @@ describe("Hermes tools image browser backend (#74)", () => { ["no browser block", BASE_CONFIG.replace(/browser:\n( .*\n)+/, ""), "found 0"], ["two browser blocks", `${BASE_CONFIG}browser:\n restrict_evaluate: true\n`, "found 2"], ["an empty browser block", BASE_CONFIG.replace(/browser:\n( .*\n)+/, "browser:\n"), "empty"], - ])("refuses a config with %s and leaves it unchanged", (_name, text, message) => { - const { result, written } = configure(text); + ])("refuses a config with %s and leaves both files unchanged", (_name, text, message) => { + const { result, written, policy } = configure(text); expect(result.status).toBe(1); expect(result.stderr).toContain(message); expect(written).toBe(text); + expect(policy).toBe(BASE_POLICY); + }); + + it("manages browser.backend off in the policy and changes nothing else (#79)", () => { + const { result, policy } = configure(BASE_CONFIG); + + expect(result.status, result.stderr).toBe(0); + const expected = structuredClone(BASE_POLICY_OBJECT); + Object.assign(expected.config.browser, { backend: "off" }); + expected.managed_paths.splice(3, 0, "browser.backend"); + expect(policy).toBe(`${JSON.stringify(expected, null, 2)}\n`); + }); + + const withBackend = structuredClone(BASE_POLICY_OBJECT); + Object.assign(withBackend.config.browser, { backend: "browser-use" }); + const withPath = structuredClone(BASE_POLICY_OBJECT); + withPath.managed_paths.push("browser.backend"); + const withoutBrowserPath = structuredClone(BASE_POLICY_OBJECT); + withoutBrowserPath.managed_paths = ["approvals.mode"]; + + it.each([ + ["a browser backend", JSON.stringify(withBackend), "already sets"], + ["a managed browser.backend path", JSON.stringify(withPath), "already sets"], + ["no browser.restrict_evaluate path", JSON.stringify(withoutBrowserPath), "does not manage"], + ["malformed JSON", "{", "Expecting"], + ])("refuses a policy with %s and leaves both files unchanged", (_name, policyText, message) => { + const { result, written, policy } = configure(BASE_CONFIG, policyText); + + expect(result.status).toBe(1); + expect(result.stderr).toContain(message); + expect(written).toBe(BASE_CONFIG); + expect(policy).toBe(policyText); + }); + + it("requires both the config and the policy path", () => { + const result = spawnSync("python3", [SCRIPT, "config.yaml"], { + encoding: "utf8", + timeout: 10_000, + }); + + expect(result.status).toBe(2); + expect(result.stderr).toContain(""); }); }); diff --git a/tools/openclaw-tools-image/fixtures/run-phase2.sh b/tools/openclaw-tools-image/fixtures/run-phase2.sh index ced81cfb699..a93d01d7e9e 100755 --- a/tools/openclaw-tools-image/fixtures/run-phase2.sh +++ b/tools/openclaw-tools-image/fixtures/run-phase2.sh @@ -456,6 +456,24 @@ print("built-in browser tools") ') } +hermes_dashboard_seed() { + # The dashboard profile gets the gateway model and the managed browser + # backend: the seeder accepts config.yaml only when every managed section + # equals the image's managed policy (#79). + local dashboard=$WORK/dashboard-config.yaml + /opt/hermes/.venv/bin/python -I /usr/local/lib/nemoclaw/seed-hermes-dashboard-config.py \ + /usr/local/share/nemoclaw/hermes-managed-policy.json /sandbox/.hermes/config.yaml "$dashboard" + /opt/hermes/.venv/bin/python -I - "$dashboard" <<'PY' +import sys +import yaml +with open(sys.argv[1], encoding="utf-8") as handle: + config = yaml.safe_load(handle) +assert isinstance(config.get("model"), dict) and config["model"].get("default"), "no model" +assert config["browser"]["backend"] == "off", config["browser"] +print("dashboard model", config["model"]["default"], "browser.backend off") +PY +} + python_libraries() { "$PY" - <<'PY' import importlib @@ -503,6 +521,7 @@ else skip browser_config "OpenClaw browser tool config" check hermes_python hermes_python check hermes_browser_backend hermes_browser_backend + check hermes_dashboard_seed hermes_dashboard_seed fi check python_libraries python_libraries check node_resolution node_resolution From 81e0de5097ec5f79aeebc833f37b6f5c09ad494a Mon Sep 17 00:00:00 2001 From: Derek Hsu Date: Thu, 19 Nov 2026 16:57:15 +0800 Subject: [PATCH 2/2] fix(images): pin LibreOffice to the current Debian security release Debian removed LibreOffice 4:25.2.3-2+deb13u9 from trixie-security, so the tools image builds fail with "Version '4:25.2.3-2+deb13u9' for 'libreoffice-core' was not found". Pin libreoffice-calc, -core, -impress and -writer to 4:25.2.3-2+deb13u12, which trixie-security has on amd64 and arm64, and update the OpenClaw tools image doc. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Derek Hsu --- docs/modification/2026-10-31-openclaw-tools-image.md | 2 +- tools/openclaw-tools-image/apt-packages.txt | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/modification/2026-10-31-openclaw-tools-image.md b/docs/modification/2026-10-31-openclaw-tools-image.md index 44886ee8cab..0ff2029abc2 100644 --- a/docs/modification/2026-10-31-openclaw-tools-image.md +++ b/docs/modification/2026-10-31-openclaw-tools-image.md @@ -63,7 +63,7 @@ Debian 套件在 amd64 與 arm64 上的版本相同。 | 類別 | 套件與版本 | |------|------------| -| Office | `libreoffice-core`、`libreoffice-writer`、`libreoffice-calc`、`libreoffice-impress` `4:25.2.3-2+deb13u9` | +| Office | `libreoffice-core`、`libreoffice-writer`、`libreoffice-calc`、`libreoffice-impress` `4:25.2.3-2+deb13u12` | | PDF 與轉檔 | `pandoc 3.1.11.1+ds-2`、`poppler-utils 25.03.0-5+deb13u4`、`qpdf 12.2.0-1`、`ghostscript 10.05.1~dfsg-1+deb13u3` | | OCR | `tesseract-ocr 5.5.0-1+b1`;語言資料 `eng`、`chi-tra`、`chi-sim` `1:4.1.0-2` | | 圖片與影音 | `imagemagick 8:7.1.1.43+dfsg1-1+deb13u14`(提供 `magick`)、`ffmpeg 7:7.1.5-0+deb13u1`(含 `ffprobe`)、`libimage-exiftool-perl 13.25+dfsg-1` | diff --git a/tools/openclaw-tools-image/apt-packages.txt b/tools/openclaw-tools-image/apt-packages.txt index 70f971e1929..5eade774a08 100644 --- a/tools/openclaw-tools-image/apt-packages.txt +++ b/tools/openclaw-tools-image/apt-packages.txt @@ -6,6 +6,8 @@ # docker.io/derekhsu/openshell-openclaw@sha256:e654a0695522944ec43c7eeabb6aca9472f385c117a206e5000f8a61b1b96056 # (2026.9.2-r4): each version is still the newest in trixie or # trixie-security on amd64 and arm64. +# 2026-11-19: Debian removed LibreOffice 4:25.2.3-2+deb13u9 from +# trixie-security; the LibreOffice packages now use deb13u12. # Install with --no-install-recommends. jq and libsqlite3-0 come from the base. ffmpeg=7:7.1.5-0+deb13u1 fontconfig=2.15.0-2.3 @@ -16,10 +18,10 @@ ghostscript=10.05.1~dfsg-1+deb13u3 imagemagick=8:7.1.1.43+dfsg1-1+deb13u14 libicu76=76.1-4 libimage-exiftool-perl=13.25+dfsg-1 -libreoffice-calc=4:25.2.3-2+deb13u9 -libreoffice-core=4:25.2.3-2+deb13u9 -libreoffice-impress=4:25.2.3-2+deb13u9 -libreoffice-writer=4:25.2.3-2+deb13u9 +libreoffice-calc=4:25.2.3-2+deb13u12 +libreoffice-core=4:25.2.3-2+deb13u12 +libreoffice-impress=4:25.2.3-2+deb13u12 +libreoffice-writer=4:25.2.3-2+deb13u12 pandoc=3.1.11.1+ds-2 poppler-utils=25.03.0-5+deb13u4 qpdf=12.2.0-1