Skip to content

fix: support WSL mirrored networking - #274

Merged
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Premshay:agent/fix-wsl-mirrored-networking
Jul 28, 2026
Merged

fix: support WSL mirrored networking#274
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Premshay:agent/fix-wsl-mirrored-networking

Conversation

@Premshay

Copy link
Copy Markdown
Contributor

Summary

  • detect the active WSL networking mode with wslinfo --networking-mode
  • use the shared loopback address for mirrored networking
  • preserve the existing gateway and resolver fallbacks for NAT mode and older WSL installations
  • add unit coverage and update the WSL authentication documentation

Root cause

get_windows_host_ip() assumed the default gateway was always the Windows host. That is true
for WSL2 NAT networking, but in mirrored mode the gateway can be the physical network router.
As a result, nlm login --wsl polled the wrong host for Chrome DevTools Protocol and timed out.

In mirrored mode, Windows and WSL share loopback, so the correct host address is 127.0.0.1.
If the networking-mode probe is unavailable or does not report mirrored, the existing NAT
discovery path remains unchanged.

Closes #273.

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run --dev --with pytest-github-actions-annotate-failures --with pytest-asyncio pytest -v --tb=short -m "not e2e": 1,247 passed, 37 skipped, 1 deselected
  • manually verified nlm login --wsl on WSL2 mirrored networking

@Premshay
Premshay marked this pull request as ready for review July 27, 2026 18:01
@jacob-bd
jacob-bd merged commit 7d77c00 into jacob-bd:main Jul 28, 2026
3 checks passed
jacob-bd added a commit that referenced this pull request Jul 28, 2026
- Skip firewall rule prompt in mirrored mode (loopback traffic never
  crosses Windows Firewall, so the rule is unnecessary)
- Include the polled CDP URL in the timeout error message so wrong-IP
  issues are immediately visible
- Adjust troubleshooting steps per networking mode: mirrored mode
  suggests checking the portproxy rule instead of the firewall rule

Follow-up to #273 / #274.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSL2 mirrored networking: CDP address derived from default gateway (the router), so login always times out

2 participants