Skip to content

The agent that grows with you

refactor(pm): drop the agent-browser package; Chromium is a default package in its own right

Teknium1ac18d2b1294
diff --git a/Dockerfile b/Dockerfile
index d23df9a55eb..d7fa4f76666 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -195,10 +195,11 @@ WORKDIR /opt/hermes
# here rather than by `npx playwright install`,
# which fetched whatever revision the npm-resolved playwright wanted,
# unverified, and recorded no fact. The resolved browser binary path is
-# baked to /etc/hermes/agent-browser-executable-path for stage2-hook.sh:
-# the layout differs per arch (chrome-linux64/chrome on amd64,
-# chromium-linux-arm64/chromium on arm64), so it is resolved at build time
-# and never hunted at boot.
+# baked to /etc/hermes/chromium-executable-path: the layout differs per
+# arch (chrome-linux64/chrome on amd64, chromium-linux-arm64/chromium on
+# arm64), so it is resolved at build time and never hunted at boot.
+# hermes_cli/browser_runtime.py reads it when a volume over the runtime dir
+# hides pm's facts; stage2-hook.sh checks it still names a binary.
ENV HERMES_RUNTIME_DIR=/opt/hermes/tools
COPY pm/ pm/
# pm's lazy imports resolve get_default_hermes_root()/project_venv_dir()
@@ -219,7 +220,7 @@ RUN set -eu; \
test -n "$browser_bin"; \
"$browser_bin" --version; \
mkdir -p /etc/hermes; \
- printf '%s' "$browser_bin" > /etc/hermes/agent-browser-executable-path
+ printf '%s' "$browser_bin" > /etc/hermes/chromium-executable-path
# PM is resident too: never borrow application libraries or create its worker
# environment under /root (unreachable to the runtime UID).
diff --git a/docker/sandbox-desktop-smoke.sh b/docker/sandbox-desktop-smoke.sh
index df2011e1eb5..0ea211584c9 100755
--- a/docker/sandbox-desktop-smoke.sh
+++ b/docker/sandbox-desktop-smoke.sh
@@ -8,7 +8,7 @@
# 2. the real launcher.sh brings up Xvnc + Xfce and publishes its env file
# 3. the RFB socket answers the protocol handshake when relayed over `docker exec -i`
# stdio, which is exactly how the gateway bridge will reach it
-# 4. headed Chromium starts on that display (cua-driver and agent-browser both need it)
+# 4. headed Chromium starts on that display (cua-driver and the agent's browser both need it)
set -euo pipefail
IMAGE="${1:?usage: sandbox-desktop-smoke.sh <image>}"
@@ -23,11 +23,10 @@ echo "== 1. binaries (as pn)"
docker exec -u pn "$NAME" bash -c '
set -e
for b in Xvnc xfwm4 xfce4-panel xfdesktop xfsettingsd dbus-run-session xauth xdpyinfo xprop \
- xfce4-terminal cua-driver agent-browser jq rg fd tmux rsync sudo python3 node; do
+ xfce4-terminal cua-driver jq rg fd tmux rsync sudo python3 node; do
command -v "$b" >/dev/null || { echo "missing: $b"; exit 1; }
done
cua-driver --version
- agent-browser --version
ls /opt/playwright/chromium-*/chrome-linux*/chrome >/dev/null || { echo "missing headed chromium"; exit 1; }
python3 -c "from PIL import ImageGrab" # the Screen pane thumbnail is grabbed inside the sandbox
# an ssh login session (pam_env) must find the browser the way docker exec does
@@ -81,7 +80,7 @@ EOF
echo "== 4. headed Chromium opens on the display"
# Docker's default seccomp profile denies unprivileged user namespaces, so Chromium's own
# layer-2 sandbox cannot start in any container; the container is the sandbox. The gateway's
-# spawn sites already inject this (browser_tool_session._needs_chromium_sandbox_bypass).
+# launcher already injects this (tools/browser_launcher.needs_chromium_sandbox_bypass).
docker exec -u pn "$NAME" bash -c '
set -e; set -a; . /tmp/bd/env; set +a
chrome=$(ls /opt/playwright/chromium-*/chrome-linux*/chrome | head -1)
diff --git a/docker/sandbox-desktop.Dockerfile b/docker/sandbox-desktop.Dockerfile
index b8225b1c827..f55421bdb44 100644
--- a/docker/sandbox-desktop.Dockerfile
+++ b/docker/sandbox-desktop.Dockerfile
@@ -44,17 +44,13 @@ RUN apt-get -o Acquire::Retries=3 update && \
rm -rf /var/lib/apt/lists/*
# Headed Chromium through Playwright (the same build the Hermes -desktop image
-# uses), so agent-browser and the dock's Browser icon share one binary and one
-# --user-data-dir. --with-deps pulls the Chromium runtime libraries. agent-browser
-# itself is baked (the CLI the browser tools drive), pinned to the same range the
-# gateway resolves (tools/browser_tool.py AGENT_BROWSER_NPX_SPEC), scripts off:
-# the first browser_navigate in a fresh sandbox must not wait on an npm fetch.
+# uses), so the agent's browser and the dock's Browser icon share one binary and
+# one --user-data-dir: tools/bot_desktop/sandbox_host.py finds it under
+# /opt/playwright. --with-deps pulls the Chromium runtime libraries.
RUN for i in 1 2 3; do \
npx --yes playwright@1 install --with-deps chromium && break || \
{ [ "$i" = 3 ] && exit 1; echo "playwright chromium install failed (attempt $i); retrying in 10s"; sleep 10; }; \
- done && chmod -R a+rX /opt/playwright && \
- npm install -g --ignore-scripts --no-audit --fetch-retries=5 "agent-browser@^0.26.0" && \
- agent-browser --version
+ done && chmod -R a+rX /opt/playwright
# cua-driver: computer_use's MCP driver. Pinned release tarball from the
# cua-driver-rs-v* tags (never releases/latest: prereleases publish 0 assets).
@@ -88,7 +84,9 @@ RUN echo "pn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/pn && chmod 0440 /etc/sudo
ENV XDG_RUNTIME_DIR=/tmp/hermes-runtime
# Dockerfile ENV reaches `docker exec` only. When this image is the target of the
# ssh backend (sshd added on top), a login session gets its environment from PAM,
-# so the browser location must also live where pam_env reads it or agent-browser
-# reports "Chrome not found" over ssh while working under docker exec.
+# so the browser location must also live where pam_env reads it, or Playwright
+# launched over ssh without an explicit executable path (agent or user scripts)
+# looks in ~/.cache/ms-playwright and finds no browser while working under
+# docker exec.
RUN printf 'PLAYWRIGHT_BROWSERS_PATH=/opt/playwright\nXDG_RUNTIME_DIR=/tmp/hermes-runtime\n' >> /etc/environment
CMD ["sleep", "infinity"]
diff --git a/docker/stage2-hook.sh b/docker/stage2-hook.sh
index 48eb36f5a9e..c3404961bca 100755
--- a/docker/stage2-hook.sh
+++ b/docker/stage2-hook.sh
@@ -752,40 +752,22 @@ if [ -d "$INSTALL_DIR/skills" ]; then
|| echo "[stage2] Warning: skills_sync.py failed; continuing"
fi
-# --- Point agent-browser at the pinned Chromium binary ---
+# --- Check the pinned Chromium binary ---
# The image's Dockerfile pm-provisions pinned full Chromium into
# $HERMES_RUNTIME_DIR (/opt/hermes/tools) at BUILD time and bakes the
-# resolved browser binary path into /etc/hermes/agent-browser-executable-path
-# (the layout differs per arch — chrome-linux64/chrome on amd64,
-# chromium-linux-arm64/chromium on arm64 — so it is resolved at build time,
-# not hard-coded). agent-browser (the runtime CLI Hermes spawns for the
-# browser tool) doesn't recognise Playwright's directory layout in its own
-# cache scan and fails with "Auto-launch failed: Chrome not found" — even
-# though the binary is right there (#15697).
-#
-# Fix: read the baked path and export ``AGENT_BROWSER_EXECUTABLE_PATH``
-# via /run/s6/container_environment so the `with-contenv` shebang on
-# main-wrapper.sh propagates it into the supervised ``hermes`` process
-# and thence to agent-browser subprocesses.
-#
-# - Skipped when the user has already set ``AGENT_BROWSER_EXECUTABLE_PATH``
-# (lets users override with a system Chrome install).
-# - Quietly skipped when the baked path file is absent (e.g. custom builds
-# that strip the pm tool store).
-if [ -z "${AGENT_BROWSER_EXECUTABLE_PATH:-}" ] && \
- [ -f /etc/hermes/agent-browser-executable-path ]; then
- browser_bin="$(cat /etc/hermes/agent-browser-executable-path)"
+# resolved binary path into /etc/hermes/chromium-executable-path (the layout
+# differs per arch, so it is resolved at build time, not hard-coded). Hermes
+# reads that file itself (hermes_cli/browser_runtime.py) when pm's facts are
+# hidden, so nothing is exported here: the hook only says, once per boot,
+# when the baked path no longer names a runnable binary (a custom build that
+# stripped the tool store), instead of leaving the first browser_exec call to
+# discover it. No file at all is quiet: such builds never baked one.
+if [ -f /etc/hermes/chromium-executable-path ]; then
+ browser_bin="$(cat /etc/hermes/chromium-executable-path)"
if [ -n "$browser_bin" ] && [ -x "$browser_bin" ]; then
- echo "[stage2] Using pinned agent-browser Chromium binary: $browser_bin"
- # Write to s6's container_environment so with-contenv picks it
- # up for all supervised services (main-hermes, dashboard, etc.).
- # Idempotent: each boot overwrites with the current path.
- # Some container runtimes / s6-overlay versions do not create the
- # envdir before cont-init hooks run, so create it defensively.
- mkdir -p /run/s6/container_environment
- printf '%s' "$browser_bin" > /run/s6/container_environment/AGENT_BROWSER_EXECUTABLE_PATH
+ echo "[stage2] Using pinned Chromium binary: $browser_bin"
else
- echo "[stage2] Warning: baked Chromium binary is missing (${browser_bin:-<empty>}); browser tool may fail"
+ echo "[stage2] Warning: baked Chromium binary is missing (${browser_bin:-<empty>}); browser_exec cannot launch the pinned browser"
fi
fi
diff --git a/pm/cli.py b/pm/cli.py
index c913003387a..08829547760 100644
--- a/pm/cli.py
+++ b/pm/cli.py
@@ -285,10 +285,10 @@ def _install_flag_error(args, *, extras: list[str], cross_target, tools_only: bo
if without and (extras or cross_target or args.names):
return "--without shapes the default closure; it does not take names, --extra, or --target"
if without:
- from pm.defaults import default_package_names
+ from pm.defaults import canonical_default_name, default_package_names
allowed = default_package_names()
- unknown = [name for name in without if name not in allowed]
+ unknown = [name for name in without if canonical_default_name(name) not in allowed]
if unknown:
return (f"--without accepts only optional default packages ({', '.join(allowed)}); "
f"not {', '.join(unknown)}")
@@ -342,6 +342,10 @@ def _install_python_environments(extras: list[str], *, sync: bool, test_environm
def cmd_install(args) -> int:
+ from pm.defaults import canonical_default_name
+
+ # Old install logs print `hermes pm install agent-browser` as the browser opt-back-in.
+ args.names = [canonical_default_name(name) for name in args.names or ()]
cross_target = getattr(args, "target", None)
# Source-install launchers require the store interpreter, even though
# Python remains optional when provisioning individual tools.
@@ -397,7 +401,7 @@ def cmd_install(args) -> int:
return 0
failed = _install_python_environments(extras, sync=bool(extras or not args.names),
test_environment=test_environment)
- # Defaults are optional and large (agent-browser + Chromium, cua-driver): fetch them
+ # Defaults are optional and large (Chromium, cua-driver): fetch them
# only once the venv, and on Windows ARM64 its build tools, succeeded.
if not failed:
_install_defaults(defaults, verify=not trust_recorded)
@@ -488,6 +492,9 @@ def _gc_store(store, facts) -> tuple[int, int]:
return (0, 0)
removed = 0
with store.install_lock():
+ from pm.defaults import RETIRED_DEFAULTS
+
+ facts.forget(RETIRED_DEFAULTS)
facts.reload()
keep = facts.entries_in_use()
collect_partials(partials_dir)
@@ -847,7 +854,7 @@ def main(argv=None) -> int:
p.add_argument("--extra", action="append", default=[], metavar="NAME",
help="enable a declared dependency extra in the venv (repeatable)")
p.add_argument("--without", action="append", default=[], metavar="NAME",
- help="leave an optional default package (agent-browser, cua-driver) out of this and every later "
+ help="leave an optional default package (chromium, cua-driver) out of this and every later "
"default install and update; `hermes pm install NAME` opts back in (repeatable)")
p.add_argument("--tools-only", action="store_true",
help="install the tool closure, put it on PATH, and stop before the venv sync")
diff --git a/pm/defaults.py b/pm/defaults.py
index f3f358a5370..800da77d315 100644
--- a/pm/defaults.py
+++ b/pm/defaults.py
@@ -21,6 +21,16 @@ from pathlib import Path
DECLINED_FILENAME = "declined-packages.json"
+# A retired default whose opt-out carries over to the package that took its
+# place: `--without agent-browser` declined the browser, which is Chromium now.
+# Read through on every load, so a record written by an older installer (or an
+# old installer script passing the old name) keeps skipping the browser.
+RETIRED_DEFAULTS = {"agent-browser": "chromium"}
+
+
+def canonical_default_name(name: str) -> str:
+ return RETIRED_DEFAULTS.get(name, name)
+
def declined_path(project_root: Path | None = None) -> Path:
from pm.environments import install_state_dir
@@ -42,7 +52,7 @@ def declined(project_root: Path | None = None) -> frozenset[str]:
raise InstallError("defaults", f"cannot read {declined_path(project_root)}: {exc}",
"fix or delete the file, then retry") from exc
names = data.get("declined") if isinstance(data, dict) else None
- return frozenset(name for name in names or () if isinstance(name, str))
+ return frozenset(canonical_default_name(name) for name in names or () if isinstance(name, str))
def record_declined(*, add: Iterable[str] = (), remove: Iterable[str] = (),
@@ -51,7 +61,7 @@ def record_declined(*, add: Iterable[str] = (), remove: Iterable[str] = (),
from pm.filesystem import durable_write_bytes
current = declined(project_root)
- updated = (current | set(add)) - set(remove)
+ updated = (current | {canonical_default_name(name) for name in add}) - set(remove)
if updated != current:
body = json.dumps({"schema": 1, "declined": sorted(updated)}, indent=2) + "\n"
durable_write_bytes(declined_path(project_root), body.encode("utf-8"))
diff --git a/pm/install.py b/pm/install.py
index c32b5ccd92c..e1ec0e0be78 100644
--- a/pm/install.py
+++ b/pm/install.py
@@ -69,7 +69,7 @@ def _store() -> Store:
def _heal_exec_bit(binary: Path) -> bool:
- """agent-browser entries staged before stage() set the exec bit sit at 0644 and fail every
+ """Store entries staged from archives that drop the exec bit sit at 0644 and fail every
launch with PermissionError. Modes are not part of the pinned digest, so restore it in place;
an entry we cannot chmod (sealed store) is treated as not installed."""
if os.name == "nt" or os.access(binary, os.X_OK):
diff --git a/pm/lock.json b/pm/lock.json
index ab636495d0e..39707e9494c 100644
--- a/pm/lock.json
+++ b/pm/lock.json
@@ -1,14 +1,5 @@
{
"packages": {
- "agent-browser": {
- "artifacts": {
- "any": {
- "sha256": "8a48cf4110d7dc2c12c1c4d6d25e0babdfa31604b537f05df0dc835fe2f854bf",
- "url": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.26.0.tgz"
- }
- },
- "version": "0.26.0"
- },
"bws": {
"artifacts": {
"darwin-arm64": {
diff --git a/pm/lock.py b/pm/lock.py
index 4dce1e5f82d..95892a9600e 100644
--- a/pm/lock.py
+++ b/pm/lock.py
@@ -286,6 +286,11 @@ class Facts:
_write(self.path, {"schema": SCHEMA, "packages": retained})
self._packages = retained
+ def forget(self, names) -> None:
+ """Drop the facts of packages pm no longer defines, so gc reclaims their entries."""
+ packages = _read(self.path, strict=True)["packages"]
+ self.retain(set(packages) - set(names))
+
def entries_in_use(self) -> set[str]:
return {f["entry"] for f in self._packages.values() if "entry" in f}
diff --git a/pm/package.py b/pm/package.py
index e0a3073d39e..537761f099f 100644
--- a/pm/package.py
+++ b/pm/package.py
@@ -96,8 +96,8 @@ class Package:
def latest_versions(self, target: str, locked: Optional[str] = None) -> list[str]:
"""Newest-first candidate versions for `target` — the "how do I find
latest" hook for `hermes pm update`. Empty list = this package has
- no auto-update source (chromium follows agent-browser; venv is a
- state; Playwright browsers are revision-pinned by playwright).
+ no auto-update source (chromium is bumped by hand with
+ `hermes pm lock --bump`; venv is a state).
Subclasses resolve their upstream's real release index here; the
update driver intersects across targets (per version_style) and
diff --git a/pm/packages.py b/pm/packages.py
index de302d9de85..2002a6d0684 100644
--- a/pm/packages.py
+++ b/pm/packages.py
@@ -962,65 +962,6 @@ class CuaDriver(BinaryPackage):
return dict(os.environ, CUA_DRIVER_RS_TELEMETRY_ENABLED="0")
-@register
-class AgentBrowser(BinaryPackage):
- name = "agent-browser"
- optional = True
- # Browser tools find agent-browser only in PM's store or on PATH (no npx
- # fallback), and their readiness check never installs it, so an install
- # without it silently loses every browser_* tool.
- # Default-install it; `install.sh --skip-browser` declines it.
- default = True
- deps = ("chromium",)
- # Termux owns its browser stack (`npm install -g agent-browser`; see
- # tools/browser_tool_install.py), and PM has no bionic Chromium to drive.
- gaps = {
- "linux-arm64-bionic": "Termux installs agent-browser through npm",
- **{target: "agent-browser has no musl Chromium runtime" for target in MUSL_TARGETS},
- }
- flatten = True
- probe_version = False
- url = "https://registry.npmjs.org/agent-browser/-/agent-browser-{version}.tgz"
- # No win32-arm64 gap: agent-browser ships only win32-x64, and Windows
- # ARM64 runs it via built-in emulation (its own postinstall falls back
- # to x64 on arm64). chromium is likewise the x64 build on win32-arm64.
- emulated_arch_targets = frozenset({"win32-arm64"})
-
- def latest_versions(self, target: str, locked=None) -> list[str]:
- latest = npm_dist_tags("agent-browser").get("latest")
- return [latest] if latest else []
-
- def _rel(self, target: str) -> Optional[str]:
- ext = ".exe" if target.startswith("win32") else ""
- # Windows ARM64 runs the x64 binary under built-in emulation:
- # agent-browser ships no native arm64 build (its own postinstall
- # falls back to x64 on arm64), so the staged name is win32-x64.
- if target == "win32-arm64":
- target = "win32-x64"
- return f"bin/agent-browser-{target}{ext}"
-
- def binary(self, entry: Path, target: str) -> Optional[Path]:
- # The win32-arm64 payload carries the x64 binary (emulated), so
- # resolve it under the win32-x64 name.
- return super().binary(entry, "win32-x64" if target == "win32-arm64" else target)
-
- def stage(self, store: Store, staged: Path, version: str, target: str) -> None:
- flatten_single_dir(staged)
- bin_dir = staged / "bin"
- if not bin_dir.is_dir():
- raise InstallError(self.name, "staged without a bin/ directory")
- keep = Path(self._rel(target)).name
- if not (bin_dir / keep).is_file():
- raise InstallError(self.name, f"{keep} missing from the staged tarball")
- for item in bin_dir.iterdir():
- if item.is_file() and item.name.startswith("agent-browser-") and item.name != keep:
- item.unlink()
- # The npm tarball ships every native binary as 0644; agent-browser's
- # own postinstall sets the exec bit, and pm runs no postinstall.
- kept = bin_dir / keep
- kept.chmod(kept.stat().st_mode | 0o111)
-
-
@register
class Chromium(Package):
"""Playwright resolves browsers by DIRECTORY NAME under one root:
@@ -1036,6 +977,10 @@ class Chromium(Package):
name = "chromium"
optional = True
+ # browser_exec's launcher drives this build, and its readiness check
+ # installs it only once per process, so default-install it like the
+ # other OS tools; `install.sh --skip-browser` declines it.
+ default = True
on_path = False
# Neither Chrome-for-Testing nor Playwright's mirror builds for Android.
gaps = {
@@ -1049,7 +994,7 @@ class Chromium(Package):
# playwright's dbazure mirror with its own platform names.
# win32-arm64 uses the win64 (x64) build: CfT publishes no native
# win-arm64 chromium, and Windows ARM64 runs x64 binaries via built-in
- # emulation — the same choice agent-browser's own postinstall makes.
+ # emulation.
_CFT = {
"linux-x64": "linux64",
"darwin-x64": "mac-x64",
@@ -1096,10 +1041,11 @@ class Chromium(Package):
binary = self.binary(entry, target)
if binary is None:
raise InstallError(self.name, f"Chromium executable missing under {native(entry)}")
- return {
- "PLAYWRIGHT_BROWSERS_PATH": str(entry.parent),
- "AGENT_BROWSER_EXECUTABLE_PATH": str(binary),
- }
+ # Playwright launches without an executable_path (e.g. the
+ # har-derived-api-client skill's `chromium.launch(channel="chromium")`)
+ # find this build through the root; Hermes's own launcher asks
+ # hermes_cli.browser_runtime.chromium_executable() instead.
+ return {"PLAYWRIGHT_BROWSERS_PATH": str(entry.parent)}
class LlamaCpp(BinaryPackage):
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 7fb6316fb5a..c1a6345502c 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -7,10 +7,9 @@
# -SkipSetup deprecated alias for -NonInteractive
# -IncludeDesktop add the desktop build stage
# -ProtocolVersion print the stage protocol version
-# -SkipBrowser do not install the browser tools (agent-browser +
-# Chromium); remembered by later
-# installs and `hermes update`, undone by
-# `hermes pm install agent-browser`
+# -SkipBrowser do not install the browser (Chromium); remembered by
+# later installs and `hermes update`, undone by
+# `hermes pm install chromium`
# -SkipComputerUse do not install the computer-use driver (cua-driver);
# remembered the same way, undone by
# `hermes pm install cua-driver`
@@ -38,8 +37,8 @@ param(
[switch]$Json,
[switch]$IncludeDesktop,
# Same opt-out as install.sh --skip-browser: PM records it, so later
- # installs and `hermes update` keep the browser tools off until
- # `hermes pm install agent-browser` opts back in.
+ # installs and `hermes update` keep the browser off until
+ # `hermes pm install chromium` opts back in.
[switch]$SkipBrowser,
[switch]$SkipComputerUse,
# Print the paths this install would use, as JSON on stdout, and exit
@@ -1287,7 +1286,7 @@ function Invoke-BootstrapPm {
# Bare $SkipBrowser, like $InstallDir: under iex/scriptblock entry the
# param() binding is not in $script: scope (see Initialize-ResolvedPaths).
$pmArgs = @('install')
- if ($SkipBrowser) { $pmArgs += @('--without', 'agent-browser') }
+ if ($SkipBrowser) { $pmArgs += @('--without', 'chromium') }
if ($SkipComputerUse) { $pmArgs += @('--without', 'cua-driver') }
Invoke-Logged "Installing dependencies (hash-verified via uv.lock)" { & $bootPy -m pm.cli @pmArgs }
if ($LASTEXITCODE) { Fail "dependency install failed" deps_install_failed }
diff --git a/scripts/install.sh b/scripts/install.sh
index 0477b981b8d..002c20d7e32 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -78,9 +78,9 @@ while [ $# -gt 0 ]; do
echo " --channel stable (default): the latest published release, then release"
echo " to release. main: every commit. Also HERMES_INSTALL_CHANNEL;"
echo " an explicit choice is saved like 'hermes update --set-channel'."
- echo " --skip-browser Do not install the browser tools (agent-browser + Chromium)."
- echo " Alias: --no-playwright. Remembered by later"
- echo " installs and 'hermes update'; undo with 'hermes pm install agent-browser'."
+ echo " --skip-browser Do not install the browser (Chromium). Alias: --no-playwright."
+ echo " Remembered by later installs and 'hermes update';"
+ echo " undo with 'hermes pm install chromium'."
echo " --skip-computer-use"
echo " Do not install the computer-use driver (cua-driver). Remembered"
echo " the same way; undo with 'hermes pm install cua-driver'."
@@ -1024,7 +1024,7 @@ bootstrap_pm() {
local pm_args=(install)
# PM records the opt-outs, so later installs and `hermes update` keep the
# tools off until `hermes pm install <name>` opts back in.
- [ "$SKIP_BROWSER" = true ] && pm_args+=(--without agent-browser)
+ [ "$SKIP_BROWSER" = true ] && pm_args+=(--without chromium)
[ "$SKIP_COMPUTER_USE" = true ] && pm_args+=(--without cua-driver)
bootstrap_python
# Refresh the sudo ticket cached in prerequisites (never prompts): the
diff --git a/tests-js/package-json-lazy-deps.test.ts b/tests-js/package-json-lazy-deps.test.ts
index 989b73f32da..d305d89c4bb 100644
--- a/tests-js/package-json-lazy-deps.test.ts
+++ b/tests-js/package-json-lazy-deps.test.ts
@@ -11,32 +11,20 @@
*
* The contract:
*
- * - ``agent-browser`` is NOT a root dependency. It used to be eager (see
- * #27055, which reasoned its postinstall was small enough to keep eager
- * unlike Camofox's) but #43564 found that keeping ANY dependency in root
- * ``package.json`` — however small its postinstall — entangles it with
- * the ui-tui/web workspace install and risks it being pruned. It now
- * resolves at runtime via ``npx agent-browser`` (see
- * ``tools/browser_tool.py::_find_agent_browser``), which sidesteps the
- * workspace graph entirely. ``hermes update`` and ``hermes doctor --fix``
- * both fire-and-forget ``warm_agent_browser_npx_cache()`` to keep npx's
- * own cache warm, preserving the "available before any session starts"
- * property #27055 cared about without re-entangling the dependency.
- *
- * - ``@streamdown/math`` is NOT a root dependency either. It's imported only
+ * - ``@streamdown/math`` is NOT a root dependency. It's imported only
* by desktop's own TS code (``apps/desktop/src/...``), so it belongs in
* ``apps/desktop/package.json`` (alongside its sibling ``@streamdown/code``)
* — not root, where it was subject to the exact same pruning risk.
*
- * - ``@askjo/camofox-browser`` is NOT eager. It is an explicit opt-in
- * alternative browser backend, selected by the user via
- * ``hermes tools`` → Browser Automation → Camofox, and only used at
- * runtime when ``CAMOFOX_URL`` is set. Its postinstall fetches a ~300MB
- * Firefox-fork binary, which silently blocked ``hermes update`` for
- * multi-minute stretches on slow / network-restricted connections
- * (notably users in China running through a VPN). The package is
- * installed on demand by ``tools_config.py`` ``post_setup_key ==
- * "camofox"`` when the user actually selects Camofox.
+ * - ``@askjo/camofox-browser`` is NOT eager. Camofox is an opt-in browser
+ * backend that ships as the ``camofox`` catalog plugin (Hermes core carries
+ * no Camofox code). Its postinstall fetches a ~300MB Firefox-fork binary,
+ * which silently blocked ``hermes update`` for multi-minute stretches on
+ * slow / network-restricted connections (notably users in China running
+ * through a VPN), so it installs only when the user sets the plugin up.
+ *
+ * (agent-browser, once listed here, is no longer used by Hermes in any form:
+ * browser_exec launches the pm-pinned Chromium itself.)
*
* If a future PR re-adds any of these to root ``dependencies``, this test
* fails — read the lazy-install guidance in the ``hermes-agent-dev`` skill
@@ -61,22 +49,8 @@ test('camofox is not in root dependencies (must stay opt-in)', () => {
assert.ok(
!('@askjo/camofox-browser' in deps),
'Camofox is a ~300MB binary-postinstall backend that must stay ' +
- 'out of root package.json dependencies. It belongs in the ' +
- 'Camofox post_setup handler in hermes_cli/tools_config.py so it ' +
- 'only installs when the user explicitly selects Camofox via ' +
- '`hermes tools` → Browser Automation → Camofox.'
- )
-})
-
-test('agent-browser is not in root dependencies (resolves via npx, #43564)', () => {
- const deps = (rootPackageJson().dependencies ?? {}) as Record<string, string>
- assert.ok(
- !('agent-browser' in deps),
- 'agent-browser must not be a root package.json dependency — it ' +
- 'resolves lazily via `npx agent-browser` instead (see ' +
- 'tools/browser_tool.py::_find_agent_browser and ' +
- 'warm_agent_browser_npx_cache). Putting it back in root ' +
- 'dependencies re-entangles it with the ui-tui/web workspace ' +
- 'install graph and reintroduces #43564.'
+ 'out of root package.json dependencies. It ships as the camofox ' +
+ 'catalog plugin, which installs it only when the user sets that ' +
+ 'plugin up.'
)
})
diff --git a/tests/docker/test_stage2_browser_discovery.py b/tests/docker/test_stage2_browser_discovery.py
index 8468cbc99a0..18134a9d2b9 100644
--- a/tests/docker/test_stage2_browser_discovery.py
+++ b/tests/docker/test_stage2_browser_discovery.py
@@ -1,4 +1,4 @@
-"""Verify Docker exports a runnable full Chromium executable.
+"""Verify the Docker image bakes a runnable full Chromium executable.
The image must ship no separate headless-shell package or store entry.
"""
@@ -12,24 +12,32 @@ from tests.docker.conftest import docker_exec, docker_exec_sh, start_container
def test_stage2_discovers_chromium_binary(
built_image: str, container_name: str,
) -> None:
- """Stage2 must export the baked full-browser path, not a shell or .so.
+ """The build bakes the full-browser path, not a shell or .so, and Hermes resolves it.
Exercise it as the runtime user: an executable bit alone does not prove
Chromium can load its shared libraries.
"""
start_container(built_image, container_name)
- # AGENT_BROWSER_EXECUTABLE_PATH must be set via s6 container_environment.
r = docker_exec_sh(
container_name,
- "cat /run/s6/container_environment/AGENT_BROWSER_EXECUTABLE_PATH",
+ "cat /etc/hermes/chromium-executable-path",
timeout=10,
)
- assert r.returncode == 0, (
- f"AGENT_BROWSER_EXECUTABLE_PATH not set by stage2 hook: {r.stderr}"
- )
+ assert r.returncode == 0, f"no baked Chromium path: {r.stderr}"
browser_path = r.stdout.strip()
- assert browser_path, "AGENT_BROWSER_EXECUTABLE_PATH is empty"
+ assert browser_path, "/etc/hermes/chromium-executable-path is empty"
+
+ # Hermes's own resolver (the launcher's binary) lands on the same build.
+ r = docker_exec(
+ container_name,
+ "/opt/hermes/.venv/bin/python", "-c",
+ "from hermes_cli.browser_runtime import chromium_executable; "
+ "print(chromium_executable(allow_override=False))",
+ timeout=30,
+ )
+ assert r.returncode == 0, f"chromium_executable() failed: {r.stderr}"
+ assert r.stdout.strip() == browser_path, r.stdout
# Must be a real file and executable.
r = docker_exec_sh(
diff --git a/tests/install/e2e-assets/installer-common.sh b/tests/install/e2e-assets/installer-common.sh
index 3fa8a749c60..cd5fb189c12 100644
--- a/tests/install/e2e-assets/installer-common.sh
+++ b/tests/install/e2e-assets/installer-common.sh
@@ -80,7 +80,7 @@ run_source_installer() {
# Historical (pre-PM) installers ran their own Playwright/npm browser
# install, which is slow and can prompt for sudo; skip it there. A PM
# installer (it enters `pm.cli`) gets no flag: its default install carries
- # agent-browser + Chromium, which is what users get, so the leg exercises it.
+ # the browser (Chromium), which is what users get, so the leg exercises it.
# Rejection messages also mention --skip-browser, so trust only the help.
help_text="$(bash "$script" --help < /dev/null 2>/dev/null)" || help_text=""
if grep -qF -- --skip-browser <<< "$help_text" && ! grep -qF 'pm.cli' <<< "$text"; then
diff --git a/tests/pm/test_agent_browser_package.py b/tests/pm/test_agent_browser_package.py
deleted file mode 100644
index 45d2a0a1670..00000000000
--- a/tests/pm/test_agent_browser_package.py
+++ /dev/null
@@ -1,48 +0,0 @@
-"""agent-browser staging leaves the kept native binary executable.
-
-The npm tarball stores every ``bin/agent-browser-*`` as 0644; agent-browser's own
-postinstall sets the exec bit, and pm runs no postinstall.
-"""
-
-import io
-import os
-import stat
-import tarfile
-
-import pytest
-
-from pm import Store, get_package
-
-
-def _npm_tarball(path, names):
- with tarfile.open(path, "w:gz") as tar:
- for name in names:
- data = f"{name} fixture".encode()
- info = tarfile.TarInfo(f"package/{name}")
- info.size = len(data)
- info.mode = 0o755 if name.endswith(".js") else 0o644
- tar.addfile(info, io.BytesIO(data))
-
-
[email protected](os.name == "nt", reason="POSIX exec bit")
[email protected]("target", ["linux-arm64", "linux-x64", "darwin-arm64"])
-def test_staged_native_binary_is_executable(tmp_path, target):
- package = get_package("agent-browser")
- archive = tmp_path / "agent-browser.tgz"
- _npm_tarball(archive, [
- "package.json",
- "bin/agent-browser.js",
- "bin/agent-browser-linux-arm64",
- "bin/agent-browser-linux-x64",
- "bin/agent-browser-darwin-arm64",
- ])
- staged = tmp_path / "staged"
- package.unpack(archive, staged, target)
- package.stage(Store(tmp_path / "store"), staged, "fixture", target)
-
- binary = package.binary(staged, target)
- assert binary == staged / "bin" / f"agent-browser-{target}"
- mode = binary.stat().st_mode
- assert mode & stat.S_IXUSR and mode & stat.S_IXGRP and mode & stat.S_IXOTH
- assert sorted(p.name for p in (staged / "bin").iterdir()) == sorted(
- ["agent-browser.js", f"agent-browser-{target}"])
diff --git a/tests/pm/test_chromium.py b/tests/pm/test_chromium.py
index 9a397fcf527..90e7bf1b3f4 100644
--- a/tests/pm/test_chromium.py
+++ b/tests/pm/test_chromium.py
@@ -5,14 +5,15 @@ import pytest
from pm.lock import Facts
from pm.packages import Chromium
+from pm.defaults import default_package_names
from pm.registry import walk
from scripts.bundles.native import _bundle_package_names
-def test_browser_closure_and_bundle_ship_full_chromium_only():
- closure = {package.name for package in walk(["agent-browser"])}
+def test_browser_default_and_bundle_ship_full_chromium_only():
+ closure = {package.name for package in walk(["chromium"])}
bundled = set(_bundle_package_names())
- assert "chromium" in closure & bundled
+ assert "chromium" in set(default_package_names()) & bundled
assert "chromium-headless-shell" not in closure | bundled
@@ -37,5 +38,5 @@ def test_chromium_binary_and_env_survive_store_relocation(tmp_path, target, rela
moved = tmp_path / "relocated"
store.rename(moved)
env = Facts(moved / "facts.json").env_for("chromium", moved)
- assert Path(env["AGENT_BROWSER_EXECUTABLE_PATH"]) == moved / entry.name / relative
- assert env["PLAYWRIGHT_BROWSERS_PATH"] == str(moved)
+ assert package.binary(moved / entry.name, target) == moved / entry.name / relative
+ assert env == {"PLAYWRIGHT_BROWSERS_PATH": str(moved)}
diff --git a/tests/pm/test_install_default_closure.py b/tests/pm/test_install_default_closure.py
index 9a3955bb0d0..26b8a3bfa86 100644
--- a/tests/pm/test_install_default_closure.py
+++ b/tests/pm/test_install_default_closure.py
@@ -110,27 +110,27 @@ def _bare_install(install_spy, **kwargs) -> list[str]:
def test_browser_tools_are_a_default_the_user_can_decline_and_restore(install_spy):
- assert "agent-browser" in _bare_install(install_spy)
- assert "agent-browser" not in _bare_install(install_spy, without=["agent-browser"])
+ assert "chromium" in _bare_install(install_spy)
+ assert "chromium" not in _bare_install(install_spy, without=["chromium"])
# The opt-out is recorded: a later bare install (the updater's shape) keeps it.
- assert "agent-browser" not in _bare_install(install_spy)
+ assert "chromium" not in _bare_install(install_spy)
install_spy["names"] = None
- assert pm.cli.cmd_install(argparse.Namespace(names=["agent-browser"], tools_only=False)) == 0
- assert "agent-browser" in _bare_install(install_spy)
+ assert pm.cli.cmd_install(argparse.Namespace(names=["chromium"], tools_only=False)) == 0
+ assert "chromium" in _bare_install(install_spy)
def test_a_failed_default_download_does_not_fail_the_install(install_spy, capsys):
- install_spy["fail"] = {"agent-browser"}
- assert "agent-browser" in _bare_install(install_spy)
+ install_spy["fail"] = {"chromium"}
+ assert "chromium" in _bare_install(install_spy)
assert install_spy["sync_extras"] == ["all"]
- assert "hermes pm install agent-browser" in capsys.readouterr().out
+ assert "hermes pm install chromium" in capsys.readouterr().out
def test_termux_has_no_pm_browser_default():
from pm.defaults import default_packages
names = pm.cli._lockfile().names()
- assert "agent-browser" in default_packages(names, target="linux-x64", declined_names=frozenset())
+ assert "chromium" in default_packages(names, target="linux-x64", declined_names=frozenset())
assert default_packages(names, target="linux-arm64-bionic", declined_names=frozenset()) == []
diff --git a/tests/pm/test_installed_package.py b/tests/pm/test_installed_package.py
index 18bc48b6a1a..0921f3ff865 100644
--- a/tests/pm/test_installed_package.py
+++ b/tests/pm/test_installed_package.py
@@ -55,7 +55,7 @@ def test_state_fact_in_shared_facts_file_is_not_a_store_install(pm_env):
@pytest.mark.skipif(os.name == "nt", reason="POSIX exec bit")
def test_entry_staged_without_exec_bit_is_usable_again(pm_env):
- """agent-browser entries staged before stage() set the exec bit raised PermissionError on every launch."""
+ """Entries staged from archives that drop the exec bit raised PermissionError on every launch."""
ensure("faketool", explicit=True)
binary = pm.installed_package("faketool").binary
binary.chmod(0o644)
diff --git a/tests/pm/test_long_path_exits.py b/tests/pm/test_long_path_exits.py
index e5a80c960e3..2afac759a22 100644
--- a/tests/pm/test_long_path_exits.py
+++ b/tests/pm/test_long_path_exits.py
@@ -31,8 +31,7 @@ def test_no_verbatim_spelling_leaves_through_records_environment_or_uv(tmp_path,
store = Store(ROOT)
facts = Facts(tmp_path / "facts.json")
facts.record("git", "1", "git-1", {"PATH": [str(store.entry("git-1") / "cmd")]}, store.root)
- facts.record("chromium", "1", "chromium-1",
- {"AGENT_BROWSER_EXECUTABLE_PATH": str(store.entry("chromium-1") / "chrome.exe")}, store.root)
+ facts.record("chromium", "1", "chromium-1", {"PLAYWRIGHT_BROWSERS_PATH": str(store.root)}, store.root)
record = (tmp_path / "facts.json").read_text(encoding="utf-8")
env = compose_env([facts.env_for("git", store.root), facts.env_for("chromium", store.root)], base={})
@@ -51,4 +50,4 @@ def test_no_verbatim_spelling_leaves_through_records_environment_or_uv(tmp_path,
leaving = [record, *env.values(), *command, kwargs["cwd"], *kwargs["env"].values()]
assert [text for text in leaving if VERBATIM in text] == []
- assert env["AGENT_BROWSER_EXECUTABLE_PATH"].endswith("chrome.exe")
+ assert env["PLAYWRIGHT_BROWSERS_PATH"].endswith("tools")
diff --git a/tests/pm/test_npm_dist_tags.py b/tests/pm/test_npm_dist_tags.py
index 8ac18f1f7e2..105707c5e14 100644
--- a/tests/pm/test_npm_dist_tags.py
+++ b/tests/pm/test_npm_dist_tags.py
@@ -1,6 +1,6 @@
"""npm metadata keeps escaped names, caller headers and retry policy."""
import json
-from pm.packages import AgentBrowser, Npm
+from pm.packages import Npm
from pm.update import npm_dist_tags, resolve_package
from tests.pm.test_update_request_reuse import upstream
from tests.pm._range_server import RangeHandler, dl_server
@@ -11,7 +11,6 @@ def test_tag_endpoint_drives_package_updates_and_preserves_escaped_names(upstrea
calls, failures = upstream
tags = {
"/-/package/npm/dist-tags": {"latest": "2.3.4", "next": "3.0.0-beta.1"},
- "/-/package/agent-browser/dist-tags": {"latest": "4.5.6"},
"/-/package/@scope%2Ftool/dist-tags": {},
}
RangeHandler.payloads.update({path: json.dumps(value).encode() for path, value in tags.items()})
@@ -24,9 +23,8 @@ def test_tag_endpoint_drives_package_updates_and_preserves_escaped_names(upstrea
monkeypatch.setattr(urllib_security, "open_credentialed_url", open_registry)
monkeypatch.setenv("GH_TOKEN", "not-for-npm")
monkeypatch.setenv("HF_TOKEN", "not-for-npm-either")
- for package, version in [(Npm(), "2.3.4"), (AgentBrowser(), "4.5.6")]:
- decision = resolve_package(package, ["linux-x64"], locked="1.0.0")
- assert decision.version == version and decision.changed
+ decision = resolve_package(Npm(), ["linux-x64"], locked="1.0.0")
+ assert decision.version == "2.3.4" and decision.changed
assert npm_dist_tags("@scope%2Ftool") == {}
assert calls == [("/-/package/npm/dist-tags", None), ("/-/package/npm/dist-tags", None),
- ("/-/package/agent-browser/dist-tags", None), ("/-/package/@scope%2Ftool/dist-tags", None)]
+ ("/-/package/@scope%2Ftool/dist-tags", None)]
diff --git a/tests/pm/test_pm_core.py b/tests/pm/test_pm_core.py
index 9644250fb3d..8115ab64a31 100644
--- a/tests/pm/test_pm_core.py
+++ b/tests/pm/test_pm_core.py
@@ -729,36 +729,36 @@ def test_bundle_closure_uv_stays_internal_node_npm_ship(monkeypatch, tmp_path):
def test_arch_guard_allows_emulated_x64_on_win32_arm64(monkeypatch, tmp_path):
- """agent-browser on win32-arm64 ships the x64 PE (emulated). The guard
+ """chromium on win32-arm64 ships the x64 PE (emulated). The guard
must not reject it when the package declares the target emulated."""
from scripts.bundles import native as cli
from pm.lock import Facts, Lockfile
from pm.registry import get_package
store = tmp_path / "store"
- entry = store / "agent-browser-0.35.1"
- bin_dir = entry / "bin"
+ entry = store / "chromium-1234"
+ bin_dir = entry / "chrome-win64"
bin_dir.mkdir(parents=True)
# A real x64 PE header (MZ + PE sig + machine 0x8664).
x64_pe = (
b"MZ" + b"\0" * 58 + (0x80).to_bytes(4, "little") + b"\0" * 64
+ b"PE\0\0" + (0x8664).to_bytes(2, "little") + b"\0" * 54
)
- binary = bin_dir / "agent-browser-win32-x64.exe"
+ binary = bin_dir / "chrome.exe"
binary.write_bytes(x64_pe)
from pm.package import machine_matches_binary
assert machine_matches_binary(binary, "win32-arm64") is False
lock = Lockfile(tmp_path / "lock.json")
- lock.set_pin("agent-browser", "0.35.1", {"any": {"url": "x", "sha256": "0" * 64}})
+ lock.set_pin("chromium", "1234+145.0.0.0", {"any": {"url": "x", "sha256": "0" * 64}})
lock.save()
monkeypatch.setattr("scripts.bundles.native._lockfile", lambda: lock)
monkeypatch.setattr("scripts.bundles.native.current_target", lambda: "win32-arm64")
monkeypatch.setattr("scripts.bundles.native.get_package", lambda name: get_package(name))
facts = Facts(store / "facts.json")
- facts.record("agent-browser", "0.35.1", entry.name, {}, store)
+ facts.record("chromium", "1234+145.0.0.0", entry.name, {}, store)
problems = cli._arch_guard(store)
assert problems == []
diff --git a/tests/pm/test_retired_agent_browser.py b/tests/pm/test_retired_agent_browser.py
new file mode 100644
index 00000000000..c14edd5ef2b
--- /dev/null
+++ b/tests/pm/test_retired_agent_browser.py
@@ -0,0 +1,114 @@
+"""An install made while agent-browser was a pm package keeps working after it left.
+
+The store, its facts and the recorded opt-outs of such an install still name
+agent-browser. Every reader must skip that fact, `pm gc` reclaims its entry, and
+an opt-out recorded as `--without agent-browser` (the installers' old
+`--skip-browser`) keeps skipping the browser, which is Chromium alone now.
+
+Real pm code paths over a fixture store under a scratch HERMES_HOME and
+HERMES_RUNTIME_DIR; the real registry and pm/lock.json.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+from pathlib import Path
+
+import pytest
+
+import pm
+import pm.cli
+from pm import paths
+from pm.lock import Facts, Lockfile
+from pm.store import Store, current_target, tree_digest
+from tests.pm.test_install_default_closure import _bare_install, install_spy as install_spy # noqa: PLC0414 -- the self-alias is load-bearing: it suppresses F811 for the pytest fixture parameter shadowing this import
+
+
+def _record(facts: Facts, store: Path, name: str, version: str, entry: Path, env: dict,
+ artifacts: list[str]) -> None:
+ facts.record(name, version, entry.name, env, store, target=current_target(),
+ artifacts=artifacts, digest=tree_digest(entry))
+
+
+def upgraded_store(tmp_path, monkeypatch):
+ """A store as the agent-browser era left it: both entries, the old chromium env, the opt-out."""
+ monkeypatch.setattr(Path, "home", lambda: tmp_path)
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
+ monkeypatch.setenv("HERMES_RUNTIME_DIR", str(tmp_path / "runtime"))
+ target = current_target()
+ chromium = pm.get_package("chromium")
+ if chromium.missing_reason(target) is not None:
+ pytest.skip(f"pm builds no Chromium for {target}")
+ store = paths.store_root()
+ lock = Lockfile(paths.lockfile_path())
+ version = lock.version("chromium")
+ assert version is not None
+ entry = store / chromium.store_entry(version, target)
+ binary = entry / "chrome-fixture" / ("chrome.exe" if target.startswith("win32") else "chrome")
+ binary.parent.mkdir(parents=True)
+ binary.write_text("inert browser fixture", encoding="utf-8")
+ binary.chmod(0o755)
+ (entry / "INSTALLATION_COMPLETE").touch()
+ facts = Facts(paths.facts_path())
+ _record(facts, store, "chromium", version, entry,
+ {"PLAYWRIGHT_BROWSERS_PATH": str(store), "AGENT_BROWSER_EXECUTABLE_PATH": str(binary)},
+ [row["sha256"] for row in lock.artifacts("chromium", target)])
+ retired = store / "agent-browser-0.26.0"
+ retired_bin = retired / "bin"
+ retired_bin.mkdir(parents=True)
+ (retired_bin / f"agent-browser-{target}").write_text("retired", encoding="utf-8")
+ _record(facts, store, "agent-browser", "0.26.0", retired, {"PATH": [str(retired_bin)]}, ["0" * 64])
+ from pm.defaults import declined_path
+
+ declined_path().parent.mkdir(parents=True, exist_ok=True)
+ declined_path().write_text(json.dumps({"schema": 1, "declined": ["agent-browser"]}), encoding="utf-8")
+ return {"store": store, "binary": binary, "retired": retired, "retired_bin": retired_bin}
+
+
+def test_every_reader_skips_the_retired_fact(upgraded_store, monkeypatch):
+ from pm.install import activate, drift, env_for
+ from pm.registry import all_packages
+
+ assert pm.installed_package("chromium").binary == upgraded_store["binary"]
+ assert "agent-browser" not in drift(include_venv=False)
+ env = env_for(*all_packages(), base_env={})
+ assert str(upgraded_store["retired_bin"]) not in env.get("PATH", "").split(os.pathsep)
+ assert env["PLAYWRIGHT_BROWSERS_PATH"] == str(upgraded_store["store"])
+ monkeypatch.setenv("PATH", "")
+ activate(allow_incomplete=True)
+ assert str(upgraded_store["retired_bin"]) not in os.environ["PATH"].split(os.pathsep)
+
+
+def test_gc_reclaims_the_retired_entry_and_keeps_chromium(upgraded_store):
+ store = Store(paths.store_root())
+ pm.cli._gc_store(store, Facts(paths.facts_path()))
+ facts = Facts(paths.facts_path())
+ assert facts.get("agent-browser") is None
+ assert not upgraded_store["retired"].exists()
+ assert facts.get("chromium") is not None
+ assert pm.installed_package("chromium").binary == upgraded_store["binary"]
+
+
+def test_a_recorded_agent_browser_opt_out_still_skips_the_browser(upgraded_store, install_spy):
+ from pm.defaults import declined
+
+ assert declined() == frozenset({"chromium"})
+ assert "chromium" not in _bare_install(install_spy)
+ # The opt-back-in old install logs print restores Chromium.
+ install_spy["names"] = None
+ assert pm.cli.cmd_install(argparse.Namespace(names=["agent-browser"], tools_only=False)) == 0
+ assert install_spy["names"] == ["chromium"]
+ assert declined() == frozenset()
+ assert "chromium" in _bare_install(install_spy)
+
+
+def test_an_old_installer_without_agent_browser_declines_chromium(upgraded_store, install_spy):
+ from pm.defaults import declined, declined_path
+
+ declined_path().unlink()
+ assert "chromium" not in _bare_install(install_spy, without=["agent-browser"])
+ assert declined() == frozenset({"chromium"})
+ assert json.loads(declined_path().read_text(encoding="utf-8"))["declined"] == ["chromium"]
diff --git a/tests/scripts/install/test_install_ps1_managed_python_provenance.py b/tests/scripts/install/test_install_ps1_managed_python_provenance.py
index c0233f74596..a8d3f572d3a 100644
--- a/tests/scripts/install/test_install_ps1_managed_python_provenance.py
+++ b/tests/scripts/install/test_install_ps1_managed_python_provenance.py
@@ -83,7 +83,7 @@ exit $LASTEXITCODE
]
if stage == "python-deps":
assert json.loads(pm_log.read_text(encoding="utf-8-sig")) == (
- ["install", "--without", "agent-browser"] if skip_browser else ["install"])
+ ["install", "--without", "chromium"] if skip_browser else ["install"])
else:
assert not pm_log.exists()
assert existing.read_text(encoding="utf-8-sig") == "previous generation"
diff --git a/tests/scripts/install/test_install_sh_reuse_supported_python.py b/tests/scripts/install/test_install_sh_reuse_supported_python.py
index 6db8b373612..36392c944bc 100644
--- a/tests/scripts/install/test_install_sh_reuse_supported_python.py
+++ b/tests/scripts/install/test_install_sh_reuse_supported_python.py
@@ -33,8 +33,8 @@ def test_missing_value_fails_before_any_install_work(option: str, suffix: list[s
@pytest.mark.parametrize("flags, expected", [
([], ["-m", "pm.cli", "install"]),
- (["--skip-browser"], ["-m", "pm.cli", "install", "--without", "agent-browser"]),
- (["--no-playwright"], ["-m", "pm.cli", "install", "--without", "agent-browser"]),
+ (["--skip-browser"], ["-m", "pm.cli", "install", "--without", "chromium"]),
+ (["--no-playwright"], ["-m", "pm.cli", "install", "--without", "chromium"]),
])
def test_browser_skip_becomes_the_pm_opt_out(tmp_path: Path, flags: list[str], expected: list[str]) -> None:
"""The skip flag is PM's persisted opt-out, not a no-op and not --non-interactive."""
diff --git a/tests/scripts/test_bundle_native.py b/tests/scripts/test_bundle_native.py
index 1f70735b5ae..4674f12716a 100644
--- a/tests/scripts/test_bundle_native.py
+++ b/tests/scripts/test_bundle_native.py
@@ -71,8 +71,9 @@ def test_bundle_stages_git_tree_and_runs_native_children_before_manifest(tmp_pat
'[project]\nname="fixture"\nversion="1.0.0"\nrequires-python=">=3.11"\n'
'[project.scripts]\nprobe="entry:main"\n[project.optional-dependencies]\npayloadtest=["bundle-probe==1.0"]\n'
'[tool.uv]\npackage=false\nno-index=true\nfind-links=["wheels"]\n', encoding="utf-8")
- selected = {"agent-browser", "chromium", "uv", "python"}
- stale = {"chromium-headless-shell", "retired-tool"}
+ selected = {"chromium", "uv", "python"}
+ # agent-browser: a retired package a pre-upgrade store still records.
+ stale = {"agent-browser", "chromium-headless-shell", "retired-tool"}
user_store = tmp_path / "user-tools"
for store in (output / "tools", user_store):
store.mkdir(parents=True, exist_ok=True)
@@ -99,15 +100,12 @@ def test_bundle_stages_git_tree_and_runs_native_children_before_manifest(tmp_pat
shutil.copy2(uv, uv_package.binary(uv_entry, target))
# Browser payloads are inert: this test exercises their real dependency
# closure, admission and pruning, not browser execution or downloads.
- for name in ("agent-browser", "chromium"):
- package = get_package(name)
- entry = canonical / package.store_entry(lock.version(name), target)
- binary = (entry / ("chrome.exe" if os.name == "nt" else "chrome")
- if name == "chromium" else package.binary(entry, target))
- binary.parent.mkdir(parents=True)
- binary.write_text("inert browser fixture", encoding="utf-8")
- if name == "chromium":
- (entry / "INSTALLATION_COMPLETE").touch()
+ chromium = get_package("chromium")
+ entry = canonical / chromium.store_entry(lock.version("chromium"), target)
+ binary = entry / ("chrome.exe" if os.name == "nt" else "chrome")
+ binary.parent.mkdir(parents=True)
+ binary.write_text("inert browser fixture", encoding="utf-8")
+ (entry / "INSTALLATION_COMPLETE").touch()
facts = Facts(canonical / "facts.json")
for name in selected:
package = get_package(name)
@@ -126,7 +124,7 @@ def test_bundle_stages_git_tree_and_runs_native_children_before_manifest(tmp_pat
subprocess.run(["git", "-c", "user.name=Fixture", "-c", "[email protected]", "commit", "-m", "fixture"], cwd=repo, check=True, capture_output=True)
monkeypatch.setattr("pm.paths.repo_root", lambda: repo)
(repo / "untracked").write_text("must not ship", encoding="utf-8")
- monkeypatch.setattr(native, "_bundle_package_names", lambda: ["agent-browser", "uv"])
+ monkeypatch.setattr(native, "_bundle_package_names", lambda: ["chromium", "uv"])
monkeypatch.setattr(importlib.import_module("pm.install"), "_prepare_artifacts",
lambda *args, **kwargs: pytest.fail("prepared tools reached acquisition"))
monkeypatch.setattr("pm.client.is_runtime", lambda: True)