Repository navigation
fix(windows): treat a denied loopback connect like a connect timeout at startup - #8987
Conversation
…at startup On some Windows hosts a connect to ::1 fails at once with EACCES instead of being refused. The startup ownership probe counted that as an unexplained failure, so the Windows loopback bind proof from lidge-jun#8920 never ran and startup stopped with "Proxy ownership is unverified". A connect with syscall "connect" and code EACCES now qualifies for the same bind proof as a connect timeout. The proof still has to bind the exact address and the same-family wildcard, so a real listener keeps the verdict unknown. Refs lidge-jun#8697 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Maintainer integration into
|
Summary
On some Windows hosts, connecting to an unused
::1port fails right away withconnect EACCESinstead of being refused. On the machine I tested,127.0.0.1refuses normally and::1can be bound, but every connect to it is denied. I have not established which component denies it (a Mihomo/Clash TUN adapter is installed).The startup ownership probe counted that error as an unexplained transport failure. The Windows loopback bind proof added in #8920 only runs when every failure was a connect timeout, so it never ran here.
observeProxyLiveness(START_OWNERSHIP_LIVENESS)returnedunknown, and a service restart that needed journal recovery stopped with "Proxy ownership is unverified; startup refused". The Task Scheduler wrapper then kept restarting the child.This change counts a failure with
code: "EACCES"andsyscall: "connect"the same as a connect timeout for that decision. Nothing else changes: the proof is still limited to Windows and literal loopback addresses, and it still has to bind both the exact address and the same-family wildcard. If a process is listening, the bind fails and the verdict staysunknown. The troubleshooting page (en, es) andstructure/runtime.mdnow mention denied connects next to timeouts.Refs #8697. That issue covered the IPv4 timeout case; this one is the same startup path with an immediate
EACCESinstead of a timeout.Verification
On Windows 11 (26200), Bun 1.4.4, at
d61cca122:observeStartupEndpointreturneddeadfor127.0.0.1andunknownwith no bind proof for::1. The raw error wasEACCES connect EACCES ::1:10199.observeProxyLivenesswith an emptyOPENCODEX_HOMEconfigured for that port returned{"kind":"unknown","live":null}.::1→deadwithbindProof: true, and{"kind":"absent","live":null,"loopbackBindProven":true}.Bun.servelistener on::1:10198, the result stayedunknownwithbindProof: false.bun test tests/server/proxy-liveness-recovery.test.ts: 31 pass. The new EACCES case fails when the source change is reverted. The new negative cases check thatEACCESoutsideconnect, orEPERM, never reaches the bind proof.bun teston the other liveness and startup-owner files (tests/server/proxy-liveness*.test.ts,tests/cli/cross-home-loopback-family.test.ts,tests/cli/cli-start-owner-absence.test.ts,tests/cli/cli-client-start-fence.test.ts,tests/cli/cli-client-start-owner-e2e.test.ts): 390 pass, 3 fail. The same 3 fail with the source change reverted: F3 and F5 inproxy-liveness-owner-evidence.test.tsand oneprobeEndpointLivenesscase inproxy-liveness.test.ts. They need a working::1connection, which this host blocks.bun run typecheckpasses.bun run structure:checkpasses.bun run test, because a full run takes longer than 15 minutes on this machine. The rest is left to CI.Checklist
🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit