Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

refactor(cdp): remove connection admission limits

ldm0d292cc07b969
diff --git a/moli-frontend-smoke/moli_frontend_smoke/browsers.py b/moli-frontend-smoke/moli_frontend_smoke/browsers.py
index e28a3762c..4c1dee8ce 100644
--- a/moli-frontend-smoke/moli_frontend_smoke/browsers.py
+++ b/moli-frontend-smoke/moli_frontend_smoke/browsers.py
@@ -251,7 +251,7 @@ async def _start_process(
return BrowserProcess(name, endpoint, process, logs, tasks, temp_dirs, version)
-async def start_moli(binary: Path, *, max_connections: int) -> BrowserProcess:
+async def start_moli(binary: Path) -> BrowserProcess:
cache_dir = tempfile.mkdtemp(prefix="moli-frontend-smoke-cache-")
return await _start_process(
name="moli",
@@ -264,8 +264,6 @@ async def start_moli(binary: Path, *, max_connections: int) -> BrowserProcess:
"127.0.0.1",
"--port",
"0",
- "--cdp-max-connections",
- str(max_connections),
"--resource",
"--layout",
"--http-cache-dir",
diff --git a/moli-frontend-smoke/moli_frontend_smoke/runner.py b/moli-frontend-smoke/moli_frontend_smoke/runner.py
index 16e5b9313..9b8dc8afa 100644
--- a/moli-frontend-smoke/moli_frontend_smoke/runner.py
+++ b/moli-frontend-smoke/moli_frontend_smoke/runner.py
@@ -469,11 +469,7 @@ async def run(args: argparse.Namespace) -> tuple[int, dict[str, Any]]:
)
else:
moli_path = moli_binary(args.moli_bin)
- max_connections = max(16, args.jobs + 4)
- moli_process = await start_moli(
- moli_path,
- max_connections=max_connections,
- )
+ moli_process = await start_moli(moli_path)
moli_endpoint = moli_process.endpoint
moli_version = moli_process.version
moli_observations = await _observe_phase(
diff --git a/moli-frontend-smoke/tests/test_browsers.py b/moli-frontend-smoke/tests/test_browsers.py
index 0abad5e1b..86b770864 100644
--- a/moli-frontend-smoke/tests/test_browsers.py
+++ b/moli-frontend-smoke/tests/test_browsers.py
@@ -178,9 +178,7 @@ def test_launchers_delegate_atomic_port_selection_to_each_browser(
monkeypatch.setattr(browsers.tempfile, "mkdtemp", fake_mkdtemp)
asyncio.run(browsers.start_chromium(Path("/test/chromium")))
- asyncio.run(
- browsers.start_moli(Path("/test/moli"), max_connections=17)
- )
+ asyncio.run(browsers.start_moli(Path("/test/moli")))
chromium = calls[0]
assert "--remote-debugging-port=0" in chromium["command"]
@@ -195,7 +193,7 @@ def test_launchers_delegate_atomic_port_selection_to_each_browser(
moli = calls[1]
command = moli["command"]
assert command[command.index("--port") + 1] == "0"
- assert command[command.index("--cdp-max-connections") + 1] == "17"
+ assert "--cdp-max-connections" not in command
assert "endpoint" not in moli
assert (
moli["endpoint_parser"](
diff --git a/moli-protocol-server/src/config.rs b/moli-protocol-server/src/config.rs
index e3c585c14..455829e2c 100644
--- a/moli-protocol-server/src/config.rs
+++ b/moli-protocol-server/src/config.rs
@@ -4,8 +4,6 @@ pub struct ServerConfig {
pub host: String,
pub port: u16,
pub timeout_secs: u32,
- pub cdp_max_connections: u16,
- pub cdp_max_pending_connections: u16,
}
impl ServerConfig {
@@ -20,8 +18,6 @@ impl Default for ServerConfig {
host: "127.0.0.1".to_owned(),
port: 9222,
timeout_secs: 10,
- cdp_max_connections: 16,
- cdp_max_pending_connections: 128,
}
}
}
diff --git a/moli/src/cli.rs b/moli/src/cli.rs
index a5d5ae3a8..089ee8538 100644
--- a/moli/src/cli.rs
+++ b/moli/src/cli.rs
@@ -320,12 +320,6 @@ pub struct ServeArgs {
#[arg(short, long, default_value_t = 10)]
pub timeout: u32,
- #[arg(long, default_value_t = 16)]
- pub cdp_max_connections: u16,
-
- #[arg(long, default_value_t = 128)]
- pub cdp_max_pending_connections: u16,
-
#[command(flatten)]
pub common: CommonArgs,
}
diff --git a/moli/src/config.rs b/moli/src/config.rs
index 2c93c444b..e1e36ec2c 100644
--- a/moli/src/config.rs
+++ b/moli/src/config.rs
@@ -58,8 +58,6 @@ impl AppConfig {
config.server.host = args.host.clone();
config.server.port = args.port;
config.server.timeout_secs = args.timeout;
- config.server.cdp_max_connections = args.cdp_max_connections;
- config.server.cdp_max_pending_connections = args.cdp_max_pending_connections;
}
}
diff --git a/moli/tests/cli.rs b/moli/tests/cli.rs
index 1ab53c7b0..864f2fed5 100644
--- a/moli/tests/cli.rs
+++ b/moli/tests/cli.rs
@@ -564,8 +564,6 @@ fn infers_serve_mode_when_called_without_args() {
host: "127.0.0.1".to_owned(),
port: 9222,
timeout: 10,
- cdp_max_connections: 16,
- cdp_max_pending_connections: 128,
common: CommonArgs::default(),
}))
);
@@ -591,8 +589,6 @@ fn parses_serve_flags_with_explicit_command() {
host: "0.0.0.0".to_owned(),
port: 9333,
timeout: 42,
- cdp_max_connections: 16,
- cdp_max_pending_connections: 128,
common: CommonArgs::default(),
}))
);
@@ -1386,6 +1382,8 @@ fn parse_env_flags_in_child_process() {
#[test]
fn removed_long_form_flags_are_rejected() {
for flag in [
+ "--cdp-max-connections",
+ "--cdp-max-pending-connections",
"--no-layout",
"--enable-all-resource-fetch",
"--enable-image-fetch",
diff --git a/skills/moli-cdp-server/references/protocols.md b/skills/moli-cdp-server/references/protocols.md
index 9fe5cfa32..975505b1a 100644
--- a/skills/moli-cdp-server/references/protocols.md
+++ b/skills/moli-cdp-server/references/protocols.md
@@ -16,11 +16,6 @@ Defaults:
- Host: `127.0.0.1`
- Port: `9222`
- Server timeout: 10 seconds
-- CDP active connections: 16
-- CDP pending connections: 128
-
-Tune the last two with `--cdp-max-connections` and
-`--cdp-max-pending-connections`.
## Endpoint map