From 3888281baa3d8ae41f2b22262aea65ddbe963e88 Mon Sep 17 00:00:00 2001 From: Ksenia Berezina Date: Thu, 5 Nov 2026 01:23:17 -0500 Subject: [PATCH 1/4] Connect Puppeteer scripts to Android browser endpoints --- .../autowebcompat-repro/repro_reference.mjs | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/agents/autowebcompat-repro/repro_reference.mjs b/agents/autowebcompat-repro/repro_reference.mjs index 9429b6847a8..f0c86480651 100644 --- a/agents/autowebcompat-repro/repro_reference.mjs +++ b/agents/autowebcompat-repro/repro_reference.mjs @@ -44,20 +44,39 @@ if (!BROWSER_BIN) { const TARGET = "https://example.com/"; async function probe() { - const browser = await puppeteer.launch({ - browser: BROWSER, - executablePath: BROWSER_BIN, - headless: process.env.HEADLESS ? true : false, - ...(BROWSER === "chrome" ? { args: ["--no-sandbox"] } : {}), - }); + // Android identifiers connect to real browsers on the emulator; desktop and + // mozregression continue to launch their supplied executable normally. + const android = /^(ws|http):/.test(BROWSER_BIN); + // A hung device browser should fail fast rather than after the 180s default. + const connect = { defaultViewport: null, protocolTimeout: 30_000 }; + const browser = android + ? await puppeteer.connect( + BROWSER === "firefox" + ? { + ...connect, + browserWSEndpoint: BROWSER_BIN, + protocol: "webDriverBiDi", + } + : { ...connect, browserURL: BROWSER_BIN } + ) + : await puppeteer.launch({ + browser: BROWSER, + executablePath: BROWSER_BIN, + headless: process.env.HEADLESS ? true : false, + ...(BROWSER === "chrome" ? { args: ["--no-sandbox"] } : {}), + }); + let page; try { - const page = await browser.newPage(); + page = await browser.newPage(); await page.goto(TARGET, { waitUntil: "networkidle0" }); return await page.evaluate(() => ({})); } catch (error) { return { error: String(error?.message ?? error) }; } finally { - await browser.close(); + if (android) { + await page?.close().catch(() => {}); + await browser.disconnect(); + } else await browser.close(); } } From e60a1fba474f6e7d6f2dd4c771032a2bb66deb86 Mon Sep 17 00:00:00 2001 From: Ksenia Berezina Date: Tue, 10 Nov 2026 16:06:32 -0500 Subject: [PATCH 2/4] Build browser MCP server configs in one place Pick the Firefox and Chrome DevTools MCP configs, and the BROWSER_BIN for repro scripts, in shared helpers instead of in each task. The helpers dispatch on the browser type, and the Firefox one builds the desktop profile itself, so tasks no longer take a profile path. --- .../autowebcompat_repro/agent.py | 102 ++++++++++-------- 1 file changed, 56 insertions(+), 46 deletions(-) diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py index 1919e3de9c6..b5264e37d56 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py @@ -9,16 +9,19 @@ import os import subprocess import tempfile -from collections.abc import Callable +from collections.abc import Callable, Sequence from dataclasses import dataclass from enum import Enum from pathlib import Path from typing import Any +from autowebcompat_tools.android_browser import AndroidBrowser from autowebcompat_tools.browser import ChromeBrowsers, FirefoxBrowsers from autowebcompat_tools.environment import Environment from autowebcompat_tools.inputs import AutoWebcompatInput, BugDataInput, BugIdInput from autowebcompat_tools.mcp_servers import ( + build_android_chrome_devtools_server, + build_android_firefox_devtools_server, build_chrome_devtools_server, build_firefox_devtools_server, ) @@ -26,6 +29,7 @@ from autowebcompat_tools.task import RunTracker, TaskConfig from autowebcompat_tools.task import Task as BaseTask from claude_agent_sdk import McpServerConfig +from claude_agent_sdk.types import McpStdioServerConfig from pydantic import BaseModel from .config import BUGZILLA_READ_TOOLS, CHROME_DEVTOOLS_TOOLS, DEVTOOLS_TOOLS @@ -44,6 +48,40 @@ PublishFile = Callable[[str, Path, str | None], str] +Browser = Path | AndroidBrowser + + +def browser_bin(browser: Browser) -> str: + """BROWSER_BIN for repro scripts: an executable, or an Android debug endpoint.""" + return browser.endpoint if isinstance(browser, AndroidBrowser) else str(browser) + + +def firefox_server( + browser: Browser, + *, + headless: bool, + privileged: bool = False, + extensions: Sequence[str] = (), +) -> McpStdioServerConfig: + """Firefox DevTools MCP for a desktop binary or an Android browser.""" + if isinstance(browser, AndroidBrowser): + return build_android_firefox_devtools_server( + browser, enable_privileged_context=privileged, extensions=extensions + ) + return build_firefox_devtools_server( + browser, + headless=headless, + enable_privileged_context=privileged, + profile_path=setup_profile(browser, extensions), + ) + + +def chrome_server(browser: Browser, *, headless: bool) -> McpStdioServerConfig: + """Chrome DevTools MCP for a desktop binary or an Android browser.""" + if isinstance(browser, AndroidBrowser): + return build_android_chrome_devtools_server(browser) + return build_chrome_devtools_server(browser, headless=headless) + class AutowebcompatReproResult(BaseModel): reproduced: bool @@ -66,14 +104,10 @@ def system_prompt(self) -> str: def run_confirmation_script( - script_path: Path, firefox_path: Path, headless: bool + script_path: Path, firefox: Browser, headless: bool ) -> ReproductionResult | None: script_timeout = 5 * 60 - env = { - **os.environ, - "BROWSER": "firefox", - "BROWSER_BIN": str(firefox_path), - } + env = {**os.environ, "BROWSER": "firefox", "BROWSER_BIN": browser_bin(firefox)} if headless: env["HEADLESS"] = "1" @@ -181,38 +215,28 @@ def __init__( self, task_config: TaskConfig, run_tracker: RunTracker, - firefox_path: Path, - profile_path: Path, + firefox: Browser, input_data: AutoWebcompatInput, bugzilla_mcp_server: McpServerConfig, screenshot_dir: Path, - chrome_path: Path, + chrome: Browser, ): super().__init__(task_config, run_tracker) self.input_data = input_data - self.firefox_path = firefox_path - self.chrome_path = chrome_path + self.firefox_bin = browser_bin(firefox) + self.chrome_bin = browser_bin(chrome) self.screenshot_path = make_empty_temp_file( screenshot_dir, "reproduction=", ".png" ) self.script_path = make_empty_temp_file(self.repro_dir, "reproduction=", ".mjs") self.add_mcp_server( "firefox-devtools", - build_firefox_devtools_server( - firefox_path=firefox_path, - headless=task_config.headless, - enable_script=True, - enable_privileged_context=False, - profile_path=profile_path, - ), + firefox_server(firefox, headless=task_config.headless), DEVTOOLS_TOOLS, ) - self.add_mcp_server( "chrome-devtools", - build_chrome_devtools_server( - chrome_path=chrome_path, headless=task_config.headless - ), + chrome_server(chrome, headless=task_config.headless), CHROME_DEVTOOLS_TOOLS, ) if self.input_data.type == "bug_id": @@ -255,8 +279,8 @@ def system_prompt(self) -> str: `{repro_reference}`, write your script to exactly `{self.script_path}` (read the file before writing), then run it with - `BROWSER=firefox BROWSER_BIN={self.firefox_path} node {self.script_path}` - `BROWSER=chrome BROWSER_BIN={self.chrome_path} node {self.script_path}` + `BROWSER=firefox BROWSER_BIN={self.firefox_bin} node {self.script_path}` + `BROWSER=chrome BROWSER_BIN={self.chrome_bin} node {self.script_path}` The script checks one browser per run: the difference is demonstrated when the Firefox run exits with 1 (not working) and the Chrome run exits with @@ -300,21 +324,14 @@ def __init__( self, task_config: TaskConfig, run_tracker: RunTracker, - firefox_path: Path, - profile_path: Path, + firefox: Browser, steps: str, ): super().__init__(task_config, run_tracker) self.steps = steps self.add_mcp_server( "firefox_devtools", - build_firefox_devtools_server( - firefox_path=firefox_path, - headless=task_config.headless, - enable_script=True, - enable_privileged_context=False, - profile_path=profile_path, - ), + firefox_server(firefox, headless=task_config.headless), DEVTOOLS_TOOLS, ) @@ -346,20 +363,18 @@ def __init__( self, task_config: TaskConfig, run_tracker: RunTracker, - firefox_path: Path, - profile_path: Path, + firefox: Browser, steps: str, ) -> None: super().__init__(task_config, run_tracker) self.steps = steps self.add_mcp_server( "firefox_devtools", - build_firefox_devtools_server( - firefox_path=firefox_path, + firefox_server( + firefox, headless=task_config.headless, - enable_script=True, - enable_privileged_context=True, - profile_path=profile_path, + privileged=True, + extensions=["chrome-mask"], ), DEVTOOLS_TOOLS, ) @@ -581,7 +596,6 @@ async def next_repro_task( config: TaskConfig = default_config, ) -> None: browser = getattr(firefox_browser, channel.value) - profile = setup_profile(browser) logger.info( "Trying reproduction in %s%s", channel, @@ -594,7 +608,6 @@ async def next_repro_task( config, tracker, browser, - profile, input_data, bugzilla_mcp_server, screenshots_dir, @@ -617,7 +630,6 @@ async def next_repro_task( config, tracker, browser, - profile, initial_repro.steps, ) repro_results.set_result(channel, extra, await task.run()) @@ -663,13 +675,11 @@ async def next_repro_task( if repro_results.initial_repro is not None: channel = repro_results.initial_repro.channel browser = getattr(firefox_browser, channel.value) - profile = setup_profile(browser, extensions=["chrome-mask"]) task = ChromeMaskReproduction( default_config, tracker, browser, - profile, repro_results.initial_repro.steps, ) repro_results.set_result(channel, "chrome-mask", await task.run()) From 84cc606e64c2b44fd708f5147f39b9c509984ef5 Mon Sep 17 00:00:00 2001 From: Ksenia Berezina Date: Thu, 5 Nov 2026 01:23:17 -0500 Subject: [PATCH 3/4] Run webcompat reproduction tasks on Android --- .../autowebcompat_repro/agent.py | 69 +++++++++++++++---- .../autowebcompat_repro/config.py | 1 + .../autowebcompat_repro/prompts/android.md | 3 + .../prompts/android_bug_reproduction.md | 10 +++ .../autowebcompat_tools/android_emulator.py | 10 +++ 5 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md create mode 100644 agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py index b5264e37d56..c51efc913b8 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py @@ -10,12 +10,14 @@ import subprocess import tempfile from collections.abc import Callable, Sequence +from contextlib import ExitStack from dataclasses import dataclass from enum import Enum from pathlib import Path from typing import Any -from autowebcompat_tools.android_browser import AndroidBrowser +from autowebcompat_tools import android_emulator +from autowebcompat_tools.android_browser import AndroidBrowser, AndroidEnvironment from autowebcompat_tools.browser import ChromeBrowsers, FirefoxBrowsers from autowebcompat_tools.environment import Environment from autowebcompat_tools.inputs import AutoWebcompatInput, BugDataInput, BugIdInput @@ -99,14 +101,30 @@ class AutowebcompatReproResult(BaseModel): class Task(BaseTask[ResultT]): result_server_name = RESULT_SERVER_NAME + def __init__( + self, + task_config: TaskConfig, + run_tracker: RunTracker, + firefox: Browser | None = None, + ): + super().__init__(task_config, run_tracker) + self.android = isinstance(firefox, AndroidBrowser) + def system_prompt(self) -> str: - return (HERE / "prompts" / "system.md").read_text() + prompt = (HERE / "prompts" / "system.md").read_text() + if self.android: + prompt += (HERE / "prompts" / "android.md").read_text() + return prompt def run_confirmation_script( - script_path: Path, firefox: Browser, headless: bool + script_path: Path, + firefox: Browser, + headless: bool, ) -> ReproductionResult | None: script_timeout = 5 * 60 + if isinstance(firefox, AndroidBrowser): + firefox.start(fresh=True) env = {**os.environ, "BROWSER": "firefox", "BROWSER_BIN": browser_bin(firefox)} if headless: env["HEADLESS"] = "1" @@ -221,7 +239,7 @@ def __init__( screenshot_dir: Path, chrome: Browser, ): - super().__init__(task_config, run_tracker) + super().__init__(task_config, run_tracker, firefox) self.input_data = input_data self.firefox_bin = browser_bin(firefox) self.chrome_bin = browser_bin(chrome) @@ -247,7 +265,7 @@ def subject(self) -> Any: def system_prompt(self) -> str: repro_reference = self.repro_dir / "repro_reference.mjs" - return ( + prompt = ( super() .system_prompt() .format( @@ -301,6 +319,9 @@ def system_prompt(self) -> str: """ ) ) + if self.android: + prompt += (HERE / "prompts" / "android_bug_reproduction.md").read_text() + return prompt def user_prompt(self) -> str: if isinstance(self.input_data, BugDataInput): @@ -327,7 +348,7 @@ def __init__( firefox: Browser, steps: str, ): - super().__init__(task_config, run_tracker) + super().__init__(task_config, run_tracker, firefox) self.steps = steps self.add_mcp_server( "firefox_devtools", @@ -366,7 +387,7 @@ def __init__( firefox: Browser, steps: str, ) -> None: - super().__init__(task_config, run_tracker) + super().__init__(task_config, run_tracker, firefox) self.steps = steps self.add_mcp_server( "firefox_devtools", @@ -566,7 +587,7 @@ async def run_autowebcompat_repro( Returns a :class:`AutowebcompatReproResult` on success; raises :class:`AgentError` if the agent ends in an error. """ - with Environment() as env: + with Environment() as env, ExitStack() as resources: if not default_config.headless: env.start_xvfb() @@ -590,6 +611,22 @@ async def run_autowebcompat_repro( result.failure_reason = "unsupported_ios" return result + android_requested = "android" in test_plan_result.affects_platforms + android = android_requested and android_emulator.available() + if android: + logcat = Path(tempfile.mkdtemp(prefix="android-")) / "logcat.txt" + + def publish_logcat() -> None: + if logcat.exists(): + publish_file("android-logcat.txt", logcat, "text/plain") + + resources.callback(publish_logcat) + firefox_browser, chrome_browser = resources.enter_context( + AndroidEnvironment(logcat) + ) + elif android_requested: + logger.warning("Android emulator is unavailable; using desktop browsers") + async def next_repro_task( channel: FirefoxChannel, extra: str | None = None, @@ -616,7 +653,9 @@ async def next_repro_task( else: if initial_repro.script_path is not None: script_result = run_confirmation_script( - initial_repro.script_path, browser, default_config.headless + initial_repro.script_path, + browser, + default_config.headless, ) if script_result is not None: repro_results.set_result(channel, extra, script_result) @@ -652,9 +691,11 @@ async def next_repro_task( result.failure_reason = "not_firefox_specific" return result - if not repro_results.reproduced and test_plan_result.affects_platforms == [ - "android" - ]: + if ( + not repro_results.reproduced + and not android + and test_plan_result.affects_platforms == ["android"] + ): result = repro_results.into_result() result.summary = "Issue was identified as Android only and didn't reproduce on desktop nightly" result.failure_reason = "unsupported_android" @@ -667,7 +708,9 @@ async def next_repro_task( ): await next_repro_task(FirefoxChannel.stable) - if repro_results.reproduced or "esr" in test_plan_result.affects_channels: + if not android and ( + repro_results.reproduced or "esr" in test_plan_result.affects_channels + ): # If we have any result try ESR as a possible regression baseline, # otherwise try ESR if we think it's affected await next_repro_task(FirefoxChannel.esr) diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/config.py b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/config.py index 84eb9b5395b..601778c489a 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/config.py +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/config.py @@ -40,6 +40,7 @@ "mcp__firefox-devtools__set_viewport_size", "mcp__firefox-devtools__get_firefox_info", "mcp__firefox-devtools__get_firefox_output", + "mcp__firefox-devtools__restart_firefox", ] # Chrome DevTools MCP tools (chrome-devtools-mcp), exposed under the diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md new file mode 100644 index 00000000000..ded9a09bd2c --- /dev/null +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md @@ -0,0 +1,3 @@ +You are testing real Firefox for Android on an emulator. The MCP adapter starts +and activates the browser when its tools are used. The viewport is the phone +screen: do not resize it or substitute desktop mobile emulation. diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md new file mode 100644 index 00000000000..a28982a7526 --- /dev/null +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md @@ -0,0 +1,10 @@ +Chrome for Android runs on the same emulator. In Chrome, use new_page before +navigate_page to create and select a tab. Keep screenshots of the Firefox issue +before switching to Chrome. +On Android, BROWSER_BIN is the browser's remote debugging endpoint; use the +provided reference, including its connection/disconnection code. +Before running the Firefox script, call restart_firefox once to release Firefox +MCP's WebDriver session; scripts and MCP cannot hold concurrent Firefox WebDriver +sessions. Before running the Chrome script, call a Chrome DevTools tool such as +list_pages so Chrome is in the foreground. After the scripts, Firefox MCP +reconnects on its next tool call; reopen the affected URL before reusing it. diff --git a/libs/autowebcompat-tools/autowebcompat_tools/android_emulator.py b/libs/autowebcompat-tools/autowebcompat_tools/android_emulator.py index c324285620d..cb6d393fffb 100644 --- a/libs/autowebcompat-tools/autowebcompat_tools/android_emulator.py +++ b/libs/autowebcompat-tools/autowebcompat_tools/android_emulator.py @@ -1,4 +1,6 @@ import logging +import os +import shutil import subprocess import time from functools import cache @@ -16,6 +18,14 @@ BOOT_POLL = 5 +def available() -> bool: + return ( + shutil.which("emulator") is not None + and shutil.which("adb") is not None + and os.access("/dev/kvm", os.R_OK | os.W_OK) + ) + + class AndroidError(Exception): """Raised when the emulator or a device operation fails.""" From f93c0015fb8a169a876bda892b0bea3db62df5a1 Mon Sep 17 00:00:00 2001 From: Ksenia Berezina Date: Tue, 1 Dec 2026 21:35:13 -0500 Subject: [PATCH 4/4] Use mcp tool to restart emulator --- .../autowebcompat_repro/agent.py | 24 +++++++++++++++---- .../autowebcompat_repro/prompts/android.md | 15 +++++++++--- .../prompts/android_bug_reproduction.md | 3 +-- .../autowebcompat_repro/result.py | 2 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py index c51efc913b8..44ef01601cc 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/agent.py @@ -18,6 +18,7 @@ from autowebcompat_tools import android_emulator from autowebcompat_tools.android_browser import AndroidBrowser, AndroidEnvironment +from autowebcompat_tools.android_emulator import AndroidEmulator from autowebcompat_tools.browser import ChromeBrowsers, FirefoxBrowsers from autowebcompat_tools.environment import Environment from autowebcompat_tools.inputs import AutoWebcompatInput, BugDataInput, BugIdInput @@ -25,6 +26,7 @@ build_android_chrome_devtools_server, build_android_firefox_devtools_server, build_chrome_devtools_server, + build_emulator_server, build_firefox_devtools_server, ) from autowebcompat_tools.result import ResultT @@ -106,9 +108,16 @@ def __init__( task_config: TaskConfig, run_tracker: RunTracker, firefox: Browser | None = None, + emulator: AndroidEmulator | None = None, ): super().__init__(task_config, run_tracker) self.android = isinstance(firefox, AndroidBrowser) + if emulator is not None: + self.add_mcp_server( + "android-emulator", + build_emulator_server(emulator), + ["mcp__android-emulator__restart_emulator"], + ) def system_prompt(self) -> str: prompt = (HERE / "prompts" / "system.md").read_text() @@ -238,8 +247,9 @@ def __init__( bugzilla_mcp_server: McpServerConfig, screenshot_dir: Path, chrome: Browser, + emulator: AndroidEmulator | None = None, ): - super().__init__(task_config, run_tracker, firefox) + super().__init__(task_config, run_tracker, firefox, emulator) self.input_data = input_data self.firefox_bin = browser_bin(firefox) self.chrome_bin = browser_bin(chrome) @@ -347,8 +357,9 @@ def __init__( run_tracker: RunTracker, firefox: Browser, steps: str, + emulator: AndroidEmulator | None = None, ): - super().__init__(task_config, run_tracker, firefox) + super().__init__(task_config, run_tracker, firefox, emulator) self.steps = steps self.add_mcp_server( "firefox_devtools", @@ -386,8 +397,9 @@ def __init__( run_tracker: RunTracker, firefox: Browser, steps: str, + emulator: AndroidEmulator | None = None, ) -> None: - super().__init__(task_config, run_tracker, firefox) + super().__init__(task_config, run_tracker, firefox, emulator) self.steps = steps self.add_mcp_server( "firefox_devtools", @@ -613,6 +625,7 @@ async def run_autowebcompat_repro( android_requested = "android" in test_plan_result.affects_platforms android = android_requested and android_emulator.available() + emulator = None if android: logcat = Path(tempfile.mkdtemp(prefix="android-")) / "logcat.txt" @@ -621,7 +634,7 @@ def publish_logcat() -> None: publish_file("android-logcat.txt", logcat, "text/plain") resources.callback(publish_logcat) - firefox_browser, chrome_browser = resources.enter_context( + emulator, firefox_browser, chrome_browser = resources.enter_context( AndroidEnvironment(logcat) ) elif android_requested: @@ -649,6 +662,7 @@ async def next_repro_task( bugzilla_mcp_server, screenshots_dir, chrome_browser.stable, + emulator, ) else: if initial_repro.script_path is not None: @@ -670,6 +684,7 @@ async def next_repro_task( tracker, browser, initial_repro.steps, + emulator, ) repro_results.set_result(channel, extra, await task.run()) @@ -724,6 +739,7 @@ async def next_repro_task( tracker, browser, repro_results.initial_repro.steps, + emulator, ) repro_results.set_result(channel, "chrome-mask", await task.run()) diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md index ded9a09bd2c..4235b8d0f02 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android.md @@ -1,3 +1,12 @@ -You are testing real Firefox for Android on an emulator. The MCP adapter starts -and activates the browser when its tools are used. The viewport is the phone -screen: do not resize it or substitute desktop mobile emulation. +You are testing Firefox on an Android emulator. The viewport is the phone +screen: do not resize it or substitute with desktop mobile emulation. + +If Firefox crashes or stops responding, call `restart_firefox`. If Firefox still +won’t start or respond after that, or a browser tool reports that Android’s +`activity` or `package` service is unavailable, call `restart_emulator`. Use the +restart tool directly and skip adb diagnostics. Wait for the tool to return before calling any +other tool. After a successful restart, reopen the page and resume the unfinished checks. + +If a browser required for the report still can’t launch or connect after the +emulator restart, or you reach the restart limit with required checks unfinished, +submit the result with `failure_reason: "failed_emulator"`. diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md index a28982a7526..7f06e0d4e23 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/prompts/android_bug_reproduction.md @@ -1,6 +1,5 @@ Chrome for Android runs on the same emulator. In Chrome, use new_page before -navigate_page to create and select a tab. Keep screenshots of the Firefox issue -before switching to Chrome. +navigate_page to create and select a tab. On Android, BROWSER_BIN is the browser's remote debugging endpoint; use the provided reference, including its connection/disconnection code. Before running the Firefox script, call restart_firefox once to release Firefox diff --git a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/result.py b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/result.py index 81ef8ec4b78..e6fd8f4ddcb 100644 --- a/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/result.py +++ b/agents/autowebcompat-repro/hackbot_agents/autowebcompat_repro/result.py @@ -90,6 +90,7 @@ class ReproductionResult(BaseModel): | Literal["login"] | Literal["down"] | Literal["headless"] + | Literal["failed_emulator"] | Literal["other"] | None ), @@ -110,6 +111,7 @@ class ReproductionResult(BaseModel): * login - When reproducing the issue requires completing a login flow * down - When the site down or unavailable in a way that is unrelated to the issue report * headless - When there is an evidence that the issue isn't reproducible due to the headless environment + * failed_emulator - When the Android emulator keeps failing, even after restarting it, so the steps could not be completed * other - When the issue could not be reproduced for some other reason (briefly state the reason in the summary) """ ),