Skip to content

fix(cli): Tell local run when the daemon stops under its session - #2348

Merged
MathurAditya724 merged 3 commits into
mainfrom
fix/local-run-daemon-stop
Nov 18, 2026
Merged

MathurAditya724 merged 3 commits into
mainfrom
fix/local-run-daemon-stop

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

If you run sentry local daemon stop while a sentry local run --session is still capturing, the stop used to say {"stopped": true} and nothing else. The run kept retrying its stream for minutes (reconnecting in 1s… 2s… 16s…). Meanwhile the app kept sending telemetry to an address nobody answers, and SDKs only log that in debug mode.

What changes:

  • daemon stop and daemon restart warn about sessions that were still capturing. daemon stop also lists them in a new capturingSessions field. The JSON only gains that field.
  • A run (or local serve --session) whose stream drops, and then gets a refused connection or a 404, prints one warning and stops reconnecting. Sessions live in the daemon's memory, so once the daemon is gone they can't come back. Retrying can't help.
  • The app keeps running. That matches what already happens when a session is closed (local session close or Stop capture in the viewer): the tail stops and the app goes on. Killing someone's dev server because the telemetry side went away felt worse than a clear warning.

Before:

$ sentry local daemon stop --json
{ "stopped": true }

# in the run's terminal
[info] SSE connection lost, reconnecting in 1s...
[info] SSE connection lost, reconnecting in 2s...
[info] SSE connection lost, reconnecting in 4s...
[info] SSE connection lost, reconnecting in 8s...
[info] SSE connection lost, reconnecting in 16s...

After:

$ sentry local daemon stop --json
[warn] Stopped the Local daemon while 1 session was still capturing: web (01a1eb68-…). Their apps' telemetry is no longer captured; restart their commands to capture again.
{ "stopped": true, "capturingSessions": [{ "id": "01a1eb68-…", "label": "web" }] }

# in the run's terminal
[info] SSE connection lost, reconnecting in 1s...
[warn] The Local daemon stopped or restarted, so this session is no longer capturing telemetry. Restart this command to capture into a new session.

via @MathurAditya724.

--

View Session [Sentry]

`local daemon stop` used to return `{"stopped": true}` even while a
`local run --session` was capturing. The run then retried its stream
with backoff for minutes, and the app kept sending telemetry to an
address nobody answered.

Stop now warns about the sessions that were still capturing and lists
them in a new `capturingSessions` field. A run or serve tailing a
daemon session treats a refused connection or a 404 after a dropped
stream as the end of that session (sessions live in daemon memory, so
it can't come back). It prints one warning and stops reconnecting. The
wrapped app keeps running, same as when a session is closed.

Co-Authored-By: Aditya Mathur <[email protected]>
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 18, 2026 7:54am UTC

Request Review

sentry-junior Bot and others added 2 commits November 18, 2026 07:43
`daemon restart` now prints the same warning as `daemon stop` when
sessions were still capturing. The not-running `daemon stop` output also
gets `capturingSessions: []`, so the field is always there. The run's
warning now says the daemon stopped or restarted.

Co-Authored-By: Aditya Mathur <[email protected]>
@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 18, 2026 08:10
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 18, 2026

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed daemon-stop session reporting, transient versus terminal SSE failures, reconnect termination and wrapped-app lifetime. All 63 focused tests pass, and the real CLI daemon-stop regression passes with the app continuing to run. The configured-port restart E2E case also passes; GitHub CI passes. No blocking findings.

@MathurAditya724
MathurAditya724 merged commit eedd731 into main Nov 18, 2026
31 checks passed
@MathurAditya724
MathurAditya724 deleted the fix/local-run-daemon-stop branch November 18, 2026 10:23

This branch was successfully deployed

1 active deployment
Preview — 41669cc8 Deployed Nov 18, 2026 by vercel[bot]
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.

1 participant