Skip to content

fix(local): tail events in run when a server already owns the port - #1342

Merged
MathurAditya724 merged 1 commit into
mainfrom
cursor/fix-local-run-tail-existing-server-27d6
Aug 3, 2026
Merged

fix(local): tail events in run when a server already owns the port#1342
MathurAditya724 merged 1 commit into
mainfrom
cursor/fix-local-run-tail-existing-server-27d6

Conversation

@MathurAditya724

Copy link
Copy Markdown
Member

local run only printed events when it started the background server itself. When something else was already listening — most often the Spotlight desktop app's own sidecar — it injected SENTRY_SPOTLIGHT, spawned the child, and then stayed silent for the whole session: no logs, no traces, even though envelopes were flowing to that server.

Attach as an SSE consumer in that case, which is what local serve already does, so the terminal tail works regardless of who owns the port. The subscription is torn down when the child exits.

This became much more visible after #1341: now that the CLI server advertises itself as a Spotlight sidecar, the desktop app keeps its own sidecar on 8969 instead of losing the race, so run hits the attach path far more often.

`local run` only printed events when it started the background server
itself. When something else was already listening — most often the
Spotlight desktop app's own sidecar — it injected SENTRY_SPOTLIGHT,
spawned the child, and then stayed silent for the whole session: no
logs, no traces, even though envelopes were flowing to that server.

Attach as an SSE consumer in that case, which is what `local serve`
already does, so the terminal tail works regardless of who owns the
port. The subscription is torn down when the child exits.

This became much more visible after #1341: now that the CLI server
advertises itself as a Spotlight sidecar, the desktop app keeps its own
sidecar on 8969 instead of losing the race, so `run` hits the
attach path far more often.

Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
@MathurAditya724
MathurAditya724 enabled auto-merge (squash) August 3, 2026 06:22
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Aug 3, 2026
@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 06:32 UTC

Comment thread packages/cli/src/commands/local/run.ts
@MathurAditya724
MathurAditya724 merged commit dda3bc1 into main Aug 3, 2026
29 checks passed
@MathurAditya724
MathurAditya724 deleted the cursor/fix-local-run-tail-existing-server-27d6 branch August 3, 2026 06:31
MathurAditya724 added a commit that referenced this pull request Aug 3, 2026
consumeSSE() gave up silently when the very first connection attempt
failed. /health can answer 200 while /stream does not — an unrelated
service squatting on the port, or the server going away between the two
requests — and in that case nothing was ever printed again.

That is worst in `local run`, which keeps the child process alive: the
user saw 'Connected to existing server', then no events for the rest of
the session with no explanation. Emit a warning before giving up, and
log the 200-with-no-body case that was also returning silently.

Addresses the review comment on #1342.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants