Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(local): don't abort when the port is held by an unhealthy sidecar - #1344

Merged
MathurAditya724 merged 1 commit into
mainfrom
cursor/fix-local-port-detection-27d6
Aug 3, 2026
Merged

MathurAditya724 merged 1 commit into
mainfrom
cursor/fix-local-port-detection-27d6

Conversation

@MathurAditya724

Copy link
Copy Markdown
Member

isServerRunning() returned res.ok, so a sidecar that answers /health with a non-2xx looked like no server at all. Spotlight's own sidecar does exactly that — 4.11.8 throws 'ctx.req.query(...).toString is not a function' on every request with current hono, so /health is a 500 while the process still holds port 8969.

The CLI then tried to bind the occupied port, retried three times over 15s and exited with 'Port 8969 is in use after 3 retries'. In local run that killed the user's dev command before it ever started, so no events reached the terminal or Spotlight.

Treat any HTTP reply as proof the port is taken and attach instead; only a transport failure now counts as 'no server'. consumeSSE already reports when the stream will not open, so a non-sidecar squatter is diagnosed rather than fatal. run also falls back to attaching if the bind loses a race, since wrapping a dev command means a busy port must never be fatal.

isServerRunning() returned res.ok, so a sidecar that answers /health with
a non-2xx looked like no server at all. Spotlight's own sidecar does
exactly that — 4.11.8 throws 'ctx.req.query(...).toString is not a
function' on every request with current hono, so /health is a 500 while
the process still holds port 8969.

The CLI then tried to bind the occupied port, retried three times over
15s and exited with 'Port 8969 is in use after 3 retries'. In `local
run` that killed the user's dev command before it ever started, so no
events reached the terminal *or* Spotlight.

Treat any HTTP reply as proof the port is taken and attach instead; only
a transport failure now counts as 'no server'. consumeSSE already reports
when the stream will not open, so a non-sidecar squatter is diagnosed
rather than fatal. `run` also falls back to attaching if the bind loses
a race, since wrapping a dev command means a busy port must never be
fatal.

Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-03 08:00 UTC

@MathurAditya724
MathurAditya724 merged commit 5ac5255 into main Aug 3, 2026
29 checks passed
@MathurAditya724
MathurAditya724 deleted the cursor/fix-local-port-detection-27d6 branch August 3, 2026 07:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants