This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(local): don't abort when the port is held by an unhealthy sidecar - #1344
Merged
Merged
Conversation
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>
Contributor
|
5 tasks
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.
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 runthat 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.
runalso falls back to attaching if the bind loses a race, since wrapping a dev command means a busy port must never be fatal.