Skip to content

[Bug]: On macOS, runtime prune never deletes a version whose directory was on the service PATH #25398

Closed

Description

@aur3l14no

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On macOS, install the background service with t3 service install on version A. The LaunchAgent's PATH includes ~/.t3/runtime/versions/A.
  2. Start the service. Its startup prune calls shellLauncherTargets, which looks for t3 in every PATH directory, finds ~/.t3/runtime/versions/A/t3, and appends that path to ~/.t3/runtime/launchers.
  3. More than an hour after A was installed, update to version B with t3 update.
  4. Restart the service and list ~/.t3/runtime/versions.

Expected behavior

A is deleted: it is not active, not running, and no t3 launcher points at it.

Actual behavior

A stays. ~/.t3/runtime/launchers lists ~/.t3/runtime/versions/A/t3, which resolves into A, so selectUnusedRuntimes counts A as referenced. That file is only ever appended to, so A stays pinned even after its directory leaves PATH. Every version whose directory reaches the service's PATH is kept for good, about 270 MB each.

Seen on two Macs going from 0.1.0 to 0.1.2. On one of them, the startup prune after the service was reinstalled on 0.1.2 logged Removed unused t3 runtimes. { versions: [ '0.1.1' ] }. It removed 0.1.1, which only ever ran through client-started server updates and never reached the plist, and kept 0.1.0, whose t3 was in runtime/launchers. Both Macs now have versions/0.1.2/t3 recorded, so 0.1.2 will be kept after the next update too.

Our Linux hosts are not affected: the systemd unit T3 writes does not set PATH, and their runtime/launchers holds only ~/.local/bin/t3.

Cause on main @ 1ecb1a0:

Possible fixes, for maintainers to choose: have shellLauncherTargets skip a t3 that is itself a runtime's entry binary (directly inside versions/<version>/), both on PATH and in the recorded file, which also unpins existing installs; and keep runtime directories off the service's PATH (#17532).

Impact

Minor bug or occasional failure

Version or commit

0.1.2; the code above is unchanged on main @ 1ecb1a0

Environment

macOS 26.6 and 26.2 (arm64), launchd user service

Logs or stack traces

$ cat ~/.t3/runtime/launchers
~/.local/bin/t3
~/.t3/runtime/versions/0.1.2/t3
$ /usr/libexec/PlistBuddy -c "Print :EnvironmentVariables:PATH" ~/Library/LaunchAgents/com.t3tools.t3code.service.plist | tr : '\n' | grep runtime/versions
~/.t3/runtime/versions/0.1.2

Workaround

After each update, delete the previous version's directory and its line in ~/.t3/runtime/launchers. Keep the version the LaunchAgent's ProgramArguments points at (#17490).

Activity

  1. mygirleatsmayo commented on Oct 31, 2026

    @mygirleatsmayo

    25 runtimes in 11 days, ~7.4 GB

  2. GollyJer commented on Nov 6, 2026

    @GollyJer

    Still seeing this on macOS 27.0.1 (arm64) with the server on 0.1.8-nightly.20261106.4247. The PATH scan and launcher retention are unchanged at 5c004fd.

    I still have 0.0.46-nightly.20261004.2657 installed. Its folder is still on the service PATH, and runtime/launchers still records its t3:

    /Users/pac/.local/bin/t3
    /Users/pac/.t3/runtime/versions/0.0.46-nightly.20261004.2657/t3
    

    I deleted that second line by hand on Oct 30. It's back now, and the file's modification time is Oct 31 at 17:31. Removing the line alone didn't persist on this Mac. That is consistent with shellLauncherTargets adding it back when a prune reaches the PATH scan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions