Skip to content

Commit d8baf10

Browse files
committed
fix: agent-browser ARM64 Linux support, dynamic devcontainer naming
- Installer: on Linux ARM64, install system chromium via apt instead of agent-browser install --with-deps (Chrome for Testing has no ARM64 builds) - Devcontainer: add chromium to Dockerfile apt packages - Devcontainer: use ${localWorkspaceFolderBasename} for name, runArgs, and workspaceFolder so it works in any project folder - Unmark devcontainer files from assume-unchanged/skip-worktree
1 parent 262e480 commit d8baf10

4 files changed

Lines changed: 35 additions & 12 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ RUN rm -rf /var/lib/apt/lists/* && \
2121
jq \
2222
vim \
2323
netcat-openbsd \
24-
socat && \
24+
socat \
25+
chromium && \
2526
apt-get clean && \
2627
rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "pilot-shell",
2+
"name": "${localWorkspaceFolderBasename}",
33
"build": {
44
"dockerfile": "Dockerfile"
55
},
66
"runArgs": [
77
"--name",
8-
"pilot-shell"
8+
"${localWorkspaceFolderBasename}"
99
],
10-
"workspaceFolder": "/workspaces/pilot-shell",
10+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
1111
"customizations": {
1212
"vscode": {
1313
"extensions": [

installer/steps/dependencies.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import Any
1212

1313
from installer.context import InstallContext
14-
from installer.platform_utils import command_exists, npm_global_cmd
14+
from installer.platform_utils import command_exists, is_linux_arm64, npm_global_cmd
1515
from installer.steps.base import BaseStep
1616

1717
MAX_RETRIES = 3
@@ -385,17 +385,24 @@ def _is_agent_browser_ready() -> bool:
385385
def install_agent_browser() -> bool:
386386
"""Install agent-browser for headless browser automation.
387387
388-
On Linux, installs with --with-deps for system dependencies.
388+
On Linux ARM64, Chrome for Testing has no builds — install system chromium
389+
via apt instead. On other Linux, use --with-deps. On macOS, plain install.
389390
"""
390-
import platform
391-
392391
if _is_agent_browser_ready():
393-
_run_bash_with_retry("agent-browser upgrade", timeout=120) # best-effort; failure is non-fatal — existing version still works
392+
_run_bash_with_retry("agent-browser upgrade", timeout=120) # best-effort
394393
return True
395394

396395
if not _run_bash_with_retry(npm_global_cmd("npm install -g agent-browser")):
397396
return False
398397

398+
if is_linux_arm64():
399+
# Chrome for Testing doesn't provide ARM64 Linux builds.
400+
# Install system chromium instead — agent-browser auto-detects it.
401+
_run_bash_with_retry("apt-get update -qq && apt-get install -y -qq chromium", timeout=180)
402+
return True
403+
404+
import platform
405+
399406
install_cmd = "agent-browser install --with-deps" if platform.system() == "Linux" else "agent-browser install"
400407
return _run_bash_with_retry(install_cmd, timeout=300)
401408

installer/tests/unit/steps/test_dependencies_playwright.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ def test_upgrades_when_already_ready(self, mock_ready, mock_run):
6868
mock_run.assert_called_once_with("agent-browser upgrade", timeout=120)
6969

7070
@patch("platform.system", return_value="Darwin")
71+
@patch("installer.steps.dependencies.is_linux_arm64", return_value=False)
7172
@patch("installer.steps.dependencies.npm_global_cmd", side_effect=lambda x: x)
7273
@patch("installer.steps.dependencies._run_bash_with_retry")
7374
@patch("installer.steps.dependencies._is_agent_browser_ready")
74-
def test_installs_npm_package_and_chrome_macos(self, mock_ready, mock_run, _mock_npm, _mock_system):
75+
def test_installs_npm_package_and_chrome_macos(self, mock_ready, mock_run, _mock_npm, _mock_arm, _mock_system):
7576
"""Installs agent-browser via npm then runs install on macOS."""
7677
from installer.steps.dependencies import install_agent_browser
7778

@@ -83,18 +84,32 @@ def test_installs_npm_package_and_chrome_macos(self, mock_ready, mock_run, _mock
8384
mock_run.assert_any_call("agent-browser install", timeout=300)
8485

8586
@patch("platform.system", return_value="Linux")
87+
@patch("installer.steps.dependencies.is_linux_arm64", return_value=False)
8688
@patch("installer.steps.dependencies.npm_global_cmd", side_effect=lambda x: x)
8789
@patch("installer.steps.dependencies._run_bash_with_retry")
8890
@patch("installer.steps.dependencies._is_agent_browser_ready")
89-
def test_installs_with_deps_on_linux(self, mock_ready, mock_run, _mock_npm, _mock_system):
90-
"""Installs with --with-deps on Linux for system dependencies."""
91+
def test_installs_with_deps_on_linux_x86(self, mock_ready, mock_run, _mock_npm, _mock_arm, _mock_system):
92+
"""Installs with --with-deps on Linux x86_64."""
9193
from installer.steps.dependencies import install_agent_browser
9294

9395
mock_ready.return_value = False
9496
mock_run.return_value = True
9597
assert install_agent_browser() is True
9698
mock_run.assert_any_call("agent-browser install --with-deps", timeout=300)
9799

100+
@patch("installer.steps.dependencies.is_linux_arm64", return_value=True)
101+
@patch("installer.steps.dependencies.npm_global_cmd", side_effect=lambda x: x)
102+
@patch("installer.steps.dependencies._run_bash_with_retry")
103+
@patch("installer.steps.dependencies._is_agent_browser_ready")
104+
def test_installs_chromium_apt_on_linux_arm64(self, mock_ready, mock_run, _mock_npm, _mock_arm):
105+
"""Installs system chromium via apt on Linux ARM64."""
106+
from installer.steps.dependencies import install_agent_browser
107+
108+
mock_ready.return_value = False
109+
mock_run.return_value = True
110+
assert install_agent_browser() is True
111+
mock_run.assert_any_call("apt-get update -qq && apt-get install -y -qq chromium", timeout=180)
112+
98113
@patch("installer.steps.dependencies._is_agent_browser_ready")
99114
@patch("installer.steps.dependencies._run_bash_with_retry")
100115
def test_returns_false_when_npm_fails(self, mock_run, mock_ready):

0 commit comments

Comments
 (0)