Repository navigation
test: prevent testhost firewall consent prompts - #1125
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 9:43 PM ET / August 8, 2026, 01:43 UTC. ClawSweeper reviewWhat this changesThe PR changes test-owned TCP listeners to use IPv4 and IPv6 loopback only, preventing Windows Firewall consent prompts during validation. Merge readinessKeep this collaborator PR open for normal merge review. Current main still uses wildcard test probes, while this focused branch removes them and retains explicit IPv4/IPv6 loopback collision coverage. Priority: P2 Review scores
Verification
How this fits togetherE2E setup reserves temporary ports before starting a WSL gateway, and SSH adversarial tests reserve local forwarding ports. These test-only listeners exercise port-conflict behavior before the real gateway or tunnel starts. flowchart LR
A[Host port state] --> B[Test port reservation]
B --> C[IPv4 and IPv6 loopback probes]
C --> D[WSL gateway setup]
C --> E[SSH forwarding setup]
D --> F[E2E connection checks]
E --> F
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the loopback-only test-listener rule with its dual-family regression tests and retain the existing production LAN-bind preflight coverage. Do we have a high-confidence way to reproduce the issue? Yes. On a Windows host, the prior wildcard test listener can be exercised while monitoring Firewall event 2099; the branch supplies a focused after-fix path and reports zero new events. Is this the best way to solve the issue? Yes. Loopback-only temporary listeners eliminate the triggering network exposure while the production LAN-bind test still verifies wildcard-bind conflict handling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 603886a81d34. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
testhost.exeRoot cause
Windows Defender Firewall event 2099 recorded per-worktree inbound rules for:
tests\OpenClaw.E2ETests\bin\Debug\net10.0-windows\testhost.exetests\OpenClaw.E2ETests\bin\Debug\net10.0-windows\win-x64\testhost.exetests\OpenClaw.SetupEngine.Tests\bin\Debug\net10.0\testhost.exeThe triggering paths were
MirroredWslPortLease.CanBindExclusively, the SSH forward port-pair allocator, andPreflightPort_Lan_FailsWhenAnyBindPortInUse. Those tests successfully listened onIPAddress.AnyorIPAddress.IPv6Any, which made the per-worktree .NETtesthost.exenetwork reachable and caused Windows to request an interactive firewall decision.Validation
./build.ps1: passeddotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 3,623 passed, 32 skippeddotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 2,241 passeddotnet test ./tests/OpenClaw.E2ETests/OpenClaw.E2ETests.csproj -c Debug -r win-x64 --no-restore --filter "FullyQualifiedName~MirroredWslPortLeaseTests": 11 passeddotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj -c Debug -r win-x64 --no-restore --filter "FullyQualifiedName~PreflightPort_Lan_FailsWhenLoopbackPortInUse": 1 passedgit diff --check: passedReal behavior proof
Before the fix, Windows Firewall event 2099 created or modified inbound
testhostrules for E2E and SetupEngine worktree paths. After the fix, the focused tests and the full required closeout ran while monitoringMicrosoft-Windows-Windows Firewall With Advanced Security/Firewall; both completed withFIREWALL_EVENT_DELTA=0for this worktree. No firewall dialog interaction, elevated mutation, firewall rule change, or global firewall weakening was used.Autoreview initially found loss of IPv6 loopback collision coverage in the SSH allocator. The allocator was corrected to reserve both
127.0.0.1and::1, with a focused IPv6 collision regression. The final autoreview reported no actionable findings. Rubber-duck review found the missing behavioral regression and was addressed.