fix(agent): detect IPv6-bound listening ports - #27765
Merged
Merged
Conversation
bpmct
marked this pull request as ready for review
August 1, 2026 22:51
jeremyruppel
reviewed
Aug 3, 2026
jeremyruppel
reviewed
Aug 3, 2026
jeremyruppel
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15675
Dev servers that bind to the IPv6 wildcard address (Next.js, Node's default
http.Server, Go'snet.Listenon wildcard addresses, and others) never showed up in the dashboard Ports panel, even though they were listening and reachable. The agent's port scanner only callednetstat.TCPSocks, which reads/proc/net/tcp(IPv4 only); an[::]dual-stack socket lives exclusively in/proc/net/tcp6, so the panel reported "No open ports were detected."Also scan
netstat.TCP6Socksand merge the results into the existing dedupe loop. The IPv6 scan failure is non-fatal so hosts with IPv6 disabled (missing/proc/net/tcp6, Windows with the v6 stack off) keep their IPv4 results instead of the Ports panel 500ing.Both captures below:
python3 -m http.server 5123 --bind ::running in the same workspace, built from main vs this branch (full recordings).Before
After
Debugging and decision log
next-serverlistening on*:3000perss -tlnp,curlreturning 200, butGET /api/v2/workspaceagents/{agent}/listening-portsreturning{"ports": []}. Port 3000 (hex0BB8) present in/proc/net/tcp6, absent from/proc/net/tcp.agent/ports_supported.goonly callsnetstat.TCPSocks; the library'sTCP6Socks(parses/proc/net/tcp6on Linux,GetTcp6Table2on Windows) was never referenced.0.0.0.0) listener was detected correctly, isolating the bug to the missing IPv6 scan.ports_unsupported.go, which returns an empty list rather than erroring.osListeningPortsGetterbehind theListeningPortsGetterinterface from fix: mock Agent querying OS for listening ports in tests #20842, so the fake used by coderd tests is unaffected.seenmap covers dual-stack sockets that appear in both tables on Windows.TestOSListeningPortsGetter_IPv6listens on[::]:0and asserts detection; it skips when the host can't bind IPv6. Verified it fails against the pre-fix code.