Before submitting#
Area#
apps/server
Steps to reproduce#
- On Linux without
lsof (NixOS doesn't install it by default), start the same server on a port outside the common list and on a common one: python3 -m http.server 8765 and python3 -m http.server 5173.
- Open a new preview tab and look at the local servers it offers.
Expected behavior#
Both servers are offered, as they are when lsof is installed.
Actual behavior#
Only 5173 is offered. On Linux and macOS, PortScanner lists listeners only through lsof -iTCP -sTCP:LISTEN. When lsof can't be spawned, it logs at debug level and falls back to probeCommonPorts, which checks the 16 ports in COMMON_DEV_PORTS and returns them with pid: null and terminal: null. So a server on any other port is never discovered, and even a server on a common port loses its terminal ownership. Nothing in the UI says discovery is limited, and the scan retries lsof every 3 seconds.
A possible fix: on Linux, read listeners from /proc/net/tcp and /proc/net/tcp6 and map their socket inodes to PIDs through /proc/<pid>/fd, which needs no extra binary.
Impact#
Minor bug or occasional failure
Version or commit#
0.0.46-nightly.20261003.2623 (fed41fa)
Environment#
Desktop app on Linux (NixOS, Wayland, niri); Claude Code 2.1.288
Logs or stack traces#
No response
Screenshots, recordings, or supporting files#
A new preview tab with servers on 8765 and 5173: "Local servers" lists only 5173
Workaround#
No response
Note
Grok responding on behalf of Julius.
Triage#
Thanks @Vantrongs for the clear write-up and the screenshot.
Confirmed on main (
ce90eec). The missing-lsofpath does what it was written to do, but it's too limited to serve as normal Linux discovery.On macOS and Linux, preview discovery runs
lsof -iTCP -sTCP:LISTEN -P -n -F pcn. If that can't be spawned, theProcessSpawnErroris logged at debug level and discovery falls back toprobeCommonPorts()(PortScanner.ts).That probe only tries 16 ports:
3000,3001,3333,4173,4200,4321,5000,5173,5174,5175,5500,8000,8080,8081,8888, and9000.5173is on the list and8765isn't, which matches your screenshot. Anything it finds comes back withpid: null,processName: null, andterminal: null, so terminal ownership never attaches. The preview doesn't mention that discovery is limited, and while a preview is open the scan retrieslsofevery 3 seconds.The app doesn't bundle
lsof, so any desktop install where it isn't on the server'sPATH(NixOS by default) always takes this path.Workaround for now: install
lsofsomewhere the server process can see it, or type the URL into the preview bar.Likely fix area#
Your
/proc/net/tcp+/proc/net/tcp6idea (listeners in state0A, socket inodes mapped to PIDs through/proc/<pid>/fd) fits well as the Linux fallback. It needs no extra binary, and having a PID keeps terminal ownership. Some details worth keeping in mind:lsofwhen it's available, since macOS has no/proc/net/tcp.lsofis missing, rather than failing a spawn every 3 seconds.A maintainer will decide on the fix direction.