fix(server): stop npx service updates from silently leaving the old server running - #5217
Conversation
The installer resolved service-launcher.mjs from process.argv[1], which is the .bin/t3 symlink under npx. That directory has no launcher, so the update failed before stopping systemd and the old server kept running. Source the launcher from the pinned runtime the installer just prepared. Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 747860a This is a focused bug fix that changes path resolution for the service launcher source from the ephemeral CLI entry path to the pinned runtime path. The change is small, includes a test, and addresses a clear issue with npx-based updates. Low risk. You can customize Macroscope's approvability policy. Learn more. |
## What's Changed * fix(server): stop npx service updates from silently leaving the old server running by @t3dotgg in pingdotgg/t3code#5217 **Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260801.976...v0.0.32-nightly.20260802.979 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260802.979
Updating T3 Code with
npx t3@nightly connectfailed on my machine. It downloaded the new version, then reported "Could not set up the T3 Code background service" and left the old server running. Retrying and rebooting did not help.The installer looked for
service-launcher.mjsnext toprocess.argv[1]. Undernpxthat path is thenode_modules/.bin/t3symlink, and Node keeps the symlink path inargv[1], so it searched a bin directory that has no launcher. The read failed before systemd was stopped, so the update aborted with the previous version still serving.It now reads the launcher from the pinned runtime the installer just prepared and verified, which is the same place the version is staged for every install path.
Verified on bb-1: the repair completed, systemd now runs the launcher with the new server as its child, and the machine came back reachable over the relay.
Made by Claude Opus 5 in Claude Code.
Note
Medium Risk
Changes install-time file resolution for the systemd background service on Linux; wrong paths would break updates, but scope is limited to boot service setup and covered by a new test.
Overview
Fixes background service setup when the CLI runs via
npx, where the installer used to look forservice-launcher.mjsbesideprocess.argv[1](often anode_modules/.binsymlink with no launcher). That read failed before systemd was updated, so updates aborted and the old server kept running.BootServicenow defaults the launcher source to the pinned runtime directory prepared and verified during install—the same staging path used for every install flow.cliEntryPathandHostProcessArgumentsare removed fromBootServiceHost; an explicitlauncherSourcePathoverride remains.A test confirms install copies the launcher from the pinned runtime when no override is set.
Reviewed by Cursor Bugbot for commit 747860a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
npxservice updates leaving old server running by resolving launcher from pinned runtimeWhen
host.launcherSourcePathis not provided, the launcher is now copied from the pinned runtime directory (service-launcher.mjsalongside the pinned runtime entry) rather than from the host CLI entry path directory. This fixes a bug wherenpxservice updates would silently leave the old server running because the wrong launcher was used.cliEntryPathfrom theBootServiceHostinterface in bootService.ts and stops readingHostProcessArgumentsMacroscope summarized 747860a.