fix(cli): restart stale clients after updates#35455
Open
kitlangton wants to merge 1 commit into
Open
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #35448
Summary
next-9999versusnext-15000Incident
A
0.0.0-next-14901TUI remained open after the installed package advanced to0.0.0-next-14928. When its SSE connection dropped, strict discovery rejected the newer daemon.Service.start()then treated the mismatch as replaceable, terminated the daemon, and spawnedprocess.execPath.That path now resolved to the
14928binary, so the stale process could never produce the14901daemon it was waiting for. Other TUIs raced to replace each terminated daemon, and registration losers self-evicted on the 10-second ownership check.Across 23 minutes this produced 366 daemon starts, 377 interrupted event streams, 1,633 watcher-stop records, three durable
Step interruptedfailures in the reported session, and additional aborted provider work. Most warning volume was repeated startup/shutdown noise; the material failure was loss of process-local session execution.Behavior
The TUI restart uses exit code
75after normal renderer/plugin teardown. The existing Node launcher handles that code by launching its resolved binary once more with the original arguments and inherited terminal streams. A second75is propagated instead of looping.Verification
bun turbo typecheck(31 packages)bun typecheckinpackages/client,packages/cli, andpackages/tuigit diff --checkFollow-ups
This intentionally does not add a cross-process startup lock, drain active sessions before a newer client replaces an older daemon, or provide durable provider-work recovery after process death. Those are separate lifecycle changes rather than requirements for stopping this mixed-version loop.