fix(browser): ignore loopback WSL resolver hosts for launched Chrome - #324
fix(browser): ignore loopback WSL resolver hosts for launched Chrome#324Rokurolize wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:40 PM ET / 21:40 UTC. ClawSweeper reviewWhat this changesThe PR centralizes WSL resolver-host handling so resolver-derived Merge readinessKeep this PR open for maintainer review. Current Priority: P2 Review scores
Verification
How this fits togetherOracle’s browser mode launches Chrome and then connects to its DevTools endpoint for automation. On WSL, the resolver or an explicit host override determines whether Chrome uses the normal local launcher or a Windows-compatible remote-host launcher before DevTools connection begins. flowchart LR
A[WSL environment] --> B[Resolver or explicit host]
B --> C[Chrome launch route]
C --> D[DevTools endpoint]
D --> E[Browser automation]
F[Host overrides] --> B
Decision needed
Why: The patch fixes a demonstrated failure and preserves documented override precedence, but it deliberately changes the launcher and bind behavior for an existing WSL topology that current source treats as remote. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt the narrow resolver-derived loopback normalization if the browser owner accepts localhost as the supported default for those WSL setups, while retaining explicit host overrides as the documented escape hatch for exceptional Windows Chrome routes. Do we have a high-confidence way to reproduce the issue? Yes, from source and submitted live evidence: on WSL with Is this the best way to solve the issue? Unclear pending the compatibility decision. The proposed normalization is narrowly implemented and preserves explicit overrides, but maintainers must decide whether resolver-derived loopback should always prefer the local launcher rather than a Windows-side route. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 68b8c51b0ee0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
527857f to
1cd2abb
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Problem
On WSL, launcher mode uses the first
/etc/resolv.confnameserver as the Chrome DevTools connection host. With a distro-managed systemd-resolved stub, that value is a guest-local DNS endpoint such as127.0.0.53, not a Windows host address. Oracle therefore launches Chrome but checks the dynamic DevTools port through the DNS stub and fails before browser automation begins.The same resolver heuristic was duplicated in the browser connectivity smoke script.
Why
127.0.0.53can appear on WSLThis address is not assigned by WSL as the Windows host. It appears when Linux DNS management is layered on top of WSL networking:
wsl --installuse systemd by default. A WSL distribution can therefore runsystemd-resolvedjust like a regular Linux installation.generateResolvConfcontrols whether WSL generates/etc/resolv.conf. The reproduced distribution explicitly hassystemd=trueandgenerateResolvConf=false, so/etc/resolv.confis managed inside the distribution and points to systemd-resolved's stub file.resolved.confmanual defines127.0.0.53and127.0.0.54, port 53, as local DNS stub listener addresses. The full resolver is exposed on127.0.0.53; it forwards queries to the currently selected upstream DNS server.127.<any>as internal host loopback that must not appear outside a host. A resolver-derived127.0.0.53therefore cannot identify a separate Windows host across the WSL network boundary.localhost. It does not define a127/8address other than local loopback as a remote Windows-host endpoint.10.255.255.254as the defaultdnsTunnelingIpAddress. On the reproduced host, systemd-resolved uses that address as its upstream DNS server while exposing127.0.0.53to local Linux clients.The observed resolver chain was:
The old heuristic only works when the first nameserver is a reachable non-loopback host-side address. It becomes invalid when
/etc/resolv.confnames a local resolver frontend. Oracle does not need to infer the complete WSL topology for this fix: rejecting resolver-derived127/8values is sufficient because those values are unambiguously guest loopback.Change
This centralizes WSL host resolution, maps only resolver-derived
127/8values to127.0.0.1, and uses the standard local launcher for that route. ExplicitORACLE_BROWSER_REMOTE_DEBUG_HOSTandWSL_HOST_IPvalues remain authoritative. Resolver-derived non-loopback values retain the patched remote-host launcher and0.0.0.0bind behavior for Windows Chrome compatibility.The runtime and
scripts/test-browser.tsnow use the same resolver parser. The WSL behavior is recorded indocs/windows-work.mdand the unreleased changelog.Reproduction and live proof
The original comparison used upstream
8e3456e7and submitted head527857f1on the same WSL2 host. Both host overrides were removed withenv -u ORACLE_BROWSER_REMOTE_DEBUG_HOST -u WSL_HOST_IP.Upstream, using a fixed diagnostic port:
After rebasing onto
19a0b79b, I repeated the productionlaunchChromepath on rebased head1cd2abb8with the same overrides unset. The live resolver was the systemd-resolved stub:The success status is from Chrome's live
/json/versionendpoint. The failed upstream launch was terminated after capture.Validation
On rebased head
1cd2abb8,pnpm vitest run tests/browser/wslHost.test.ts tests/browser/chromeLifecycle.test.tspasses 35 tests. Coverage includes127.0.0.53,127.0.0.54, another127/8value, non-loopback preservation, explicit override precedence, explicit loopback override preservation, legacy override preservation, and local versus patched launcher routing.pnpm check,pnpm build, andgit diff --checkpass.pnpm testpasses 1,601 tests in 147 files, with the existing 43 tests and 18 files skipped.Non-goal
This does not redesign the broader WSL topology heuristic or change attach-running and explicit remote-Chrome behavior. Distinguishing native Linux Chrome, Windows Chrome, and remote Chrome using positive topology evidence remains separate work.