Skip to content

armgit / moli

Public Imported from GitHub
0

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

test(cdp): accept optional Chromium reset retry

ldm0ce0781f2ad7e
diff --git a/moli-cdp-smoke/README.md b/moli-cdp-smoke/README.md
index 8d8a016cd..2b8bd8781 100644
--- a/moli-cdp-smoke/README.md
+++ b/moli-cdp-smoke/README.md
@@ -97,6 +97,26 @@ counters delivered together. Run
`--browser chromium --group network --group browser-semantics --repeat 20 --jobs 4`
to exercise both groups with fresh browser processes.
+The reset-before-response navigation was calibrated on 2026-10-21 with the same
+pinned Chrome for Testing 145.0.7632.6. A probe calling
+`_verify_failed_main_document_request_extra_info_on_session` on fresh pages
+observed one fixture request in 3 of 20 navigations and two requests in the other
+17. NetLog showed an internal transport retry only in the two-request case;
+both paths exposed one CDP request, one request ExtraInfo, and one
+`loadingFailed` with `net::ERR_CONNECTION_RESET`, without response events.
+Waiting another 500 ms did not change either fixture count. With four CPU cores
+and four workers, the original `chromium-cdp` group failed its fixed two-request
+assertion in 5 of 20 runs. The equivalent probe on Moli 1.1.18 observed exactly
+one fixture request in all 10 runs. The scenario accepts one or two transport
+requests on Chromium, requires one on Moli, and records `fixtureRequestCount`
+while keeping the CDP event and error assertions strict. From the repository
+root, exercise the scheduling-sensitive case with:
+
+```bash
+taskset -c 0-3 uv run --project moli-cdp-smoke --no-sync moli-cdp-smoke \
+ --browser chromium --group chromium-cdp --repeat 20 --jobs 4
+```
+
The default `cdp-ordering` group locks down Renderer native and Inspector wire
publication order. It pipelines Page trees/layout, DOMSnapshot, DOM queries and
objects, CSS, AX, and a native backend error before `Runtime.enable`; stylesheet
diff --git a/moli-cdp-smoke/moli_cdp_smoke/groups/chromium_cdp_network.py b/moli-cdp-smoke/moli_cdp_smoke/groups/chromium_cdp_network.py
index 1d057ef82..d7b669832 100644
--- a/moli-cdp-smoke/moli_cdp_smoke/groups/chromium_cdp_network.py
+++ b/moli-cdp-smoke/moli_cdp_smoke/groups/chromium_cdp_network.py
@@ -1510,11 +1510,15 @@ async def _verify_failed_main_document_request_extra_info_on_session(
1,
"failed Document loadingFailed count",
)
- assert_equal(
- state.fixture_server.request_count(route),
- 1 if is_moli_browser() else 2,
- "failed Document fixture request count",
- )
+ # Chromium may retry a reset on a reused/preconnected socket. Whether the
+ # navigation uses that socket depends on timing, so both counts are valid.
+ fixture_request_count = state.fixture_server.request_count(route)
+ expected_counts = (1,) if is_moli_browser() else (1, 2)
+ if fixture_request_count not in expected_counts:
+ raise SmokeError(
+ "failed Document fixture request count: "
+ f"expected one of {expected_counts}, got {fixture_request_count}"
+ )
loading_failed = next(
event for event in request_events if event.get("method") == "Network.loadingFailed"
)
@@ -1545,7 +1549,10 @@ async def _verify_failed_main_document_request_extra_info_on_session(
raise SmokeError(
f"failed Document request ExtraInfo missing transport Accept-Encoding: {request_headers}"
)
- state.record("chromium_failed_main_document_request_extra_info_sample")
+ state.record(
+ "chromium_failed_main_document_request_extra_info_sample",
+ {"fixtureRequestCount": fixture_request_count},
+ )
async def _verify_chromium_redirect_then_failed_main_document_extra_info_sample(
state: SmokeState,