Skip to content

feat(images): turn on the Hermes browser tools in the tools image - #76

Merged
derekhsu merged 1 commit into
feat/image-only-clifrom
issue/74-hermes-browser
Nov 18, 2026
Merged

derekhsu merged 1 commit into
feat/image-only-clifrom
issue/74-hermes-browser

Conversation

@derekhsu

Copy link
Copy Markdown
Owner

Summary

讓 Hermes tools 映像的 browser 工具在 OpenShell 0.1.x 可用。tools.1 有 uvx 且 browser.backend 未設定,Hermes 因此走 Browser Use CLI:模型拿到 browser_exec,第一次使用時以 uvx browser-use 從 PyPI 下載套件;改用內建 browser 工具時,Chromium 在 OpenShell 裡又會啟動即結束。本 PR 讓 Hermes 改用內建的 browser 工具(映像內鎖版本的 agent-browser 與 Chromium),並加上 OpenShell 需要的 Chromium 參數。

Related Issue

Refs #74(Slice 2。合併後發布 tools.2 並實機驗收,再回報 #74。)

Changes

  • agents/hermes-01x/Dockerfile.tools:
    • 新增 /etc/chromium.d/nemoclaw-openshell(root、644),讓 Debian 的 /usr/bin/chromium 包裝腳本加上 --no-sandbox --no-zygote --disable-gpu。OpenShell 的 seccomp 不允許 Chromium 自己的 sandbox 與 zygote 建立 user namespace;Hermes 只在 root 或 Docker 下才會自己加 --no-sandbox。放在 /etc/chromium.d 而不是 Hermes 的 .env:不改映像 Env、不受 ClawShell 改寫設定影響。
    • 以 agents/hermes-01x/configure-tools-browser.py 在 config.yaml 加入 browser.backend: "off",再依 agents/hermes-01x/Dockerfile 的方式重算 /etc/nemoclaw/hermes.config-hash 與 /sandbox/.hermes/.config-hash;MCP digest 由 base 的 build-hermes-mcp-digest.py 重新計算並要求與原值相同。建置時也以 Hermes 自己的 get_browser_backend()/is_browser_use_cli_mode() 確認結果。仍是 3 個 RUN,不新增 layer。
  • agents/hermes-01x/configure-tools-browser.py:只在唯一的頂層 browser: 區塊後插入一行,保留註解與順序;已設定 backend、沒有或重複的 browser: 區塊、空區塊都拒絕且不改檔案。由 test/hermes-tools-browser-config.test.ts 保護。
  • Fixture:
    • phase 3 agent_browser:不帶任何 agent-browser 設定開頁,並確認 Chromium process 帶著 --no-sandbox --no-zygote、參數檔為 root:root 644。
    • phase 2 新增 hermes_browser_backend(Hermes 才執行):backend: "off"、設定 hash 相符、兩份 hash 相同、Hermes 提供內建 browser 工具而非 Browser Use CLI。
  • 文件:docs/modification/2026-11-17-hermes-tools-image.md 第 3.3 節(設定、network policy 規則寫法與 tls: skip、Hermes 本機模式不需 SSRF 例外、關閉 Chromium sandbox 的代價、tools.1 的限制)與實機驗收結果;agents/hermes-01x/README.md。

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: docs/modification/2026-11-17-hermes-tools-image.md, agents/hermes-01x/README.md
  • Agent: Claude Code

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run test/hermes-tools-browser-config.test.ts test/hermes-tools-image-release.test.ts → 36 passed。OpenShell 0.1.7 實機(Podman、arm64,tools.1 加上本 PR 相同的建置步驟):phase 2/3 fixture 0 failed;sandbox 到 running(啟動時設定完整性檢查通過);ClawShell 寫入模型設定後 browser.backend 仍為 off;Hermes browser_navigate 開放行的網站得到 Example Domain,未放行的網站得到 net::ERR_NETWORK_ACCESS_DENIED
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

安全考量:關閉 Chromium 自己的 sandbox 後,renderer 被攻破時取得的是 sandbox 使用者(uid 998)在 sandbox 內的權限;外層仍由 OpenShell 的 seccomp、Landlock、no_new_privs(實測 NoNewPrivs: 1)與 network policy 隔離,每個網站都要明確放行,API profile 一律拒絕 browser 工具。本 PR 不新增 network policy;規則由 ClawShell 管理。


Signed-off-by: Derek Hsu derekhsu@hotmail.com

🤖 Generated with Claude Code

In tools.1, uvx is on PATH and browser.backend is unset, so Hermes uses
the Browser Use CLI: the model gets browser_exec, which first fetches
browser-use from PyPI with `uvx browser-use`. Hermes' built-in browser
tools would not work either, because Chromium exits in an OpenShell
sandbox without extra flags.

The tools layer now sets browser.backend to "off" so Hermes runs its
built-in browser tools on the pinned agent-browser and the image's
Chromium, and seals config.yaml again the way the base image does.
/etc/chromium.d/nemoclaw-openshell adds --no-sandbox, --no-zygote, and
--disable-gpu, which OpenShell's seccomp requires. Network access still
needs a policy rule for /usr/lib/chromium/chromium.

The agent_browser fixture now runs agent-browser with no settings of its
own, and a new hermes_browser_backend fixture checks the backend, the
config seal, and that Hermes offers the built-in tools.

Refs #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant