Skip to content

[Bug]: Old T3 binaries and stale staging directories accumulate in runtime/versions and tools #40805

Closed

Description

@7heMech

FYI this is gemini 4 neon, sorry for the slop issue.

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. Run a headless Linux T3 Code service and let it auto-update over several weeks while using T3 Connect and the preview browser.
  2. Inspect ~/.t3/runtime/versions/ and ~/.t3/tools/ after updates commit and tool pins bump.

Expected behavior

After updates finish and new tool versions activate, stale staging directories and unneeded old binaries should be pruned so disk usage stays bounded.

Actual behavior

Nearly 1 GB of old binaries and stale update artifacts accumulated under ~/.t3 across four code paths on main at 997103b, plus another 286 MB from the pinned old launcher tracked in #37705.

  1. Abandoned .staging-* runtime directories are never pruned.
    installPinnedRuntime creates .staging-* directories under runtime/versions and only deletes them inside Effect.ensuring at line 481. If the process crashes, is killed, or hits ENOSPC during extraction, the directory remains forever because selectUnusedRuntimes skips every entry that does not match isExactServiceVersion. Unlike PreviewBrowser.ts, there is no stale-age sweep for leftover staging trees. On this host, .staging-67BQG5 from October 25 sat at 149 MB for a month.

  2. prunePinnedRuntimes keeps fromVersion indefinitely after an update is committed.
    At pinnedRuntime.ts:856-859, selectUnusedRuntimes adds both state.update.fromVersion and state.update.targetVersion to keep regardless of state.update.status. Because service-state.json retains the last committed update entry until a future update replaces it, the previous ~494 MB runtime stays on disk permanently even after the new version is running and committed.

  3. cloudflared retains an older binary even when it falls below CLOUDFLARED_MIN_VERSION.
    At relayClient.ts:424-435, pruneManagedVersions keeps (yield* olderManagedVersions).slice(1) without checking whether that retained version meets CLOUDFLARED_MIN_VERSION. On this host, tools/cloudflared/2026.10.0 at 39 MB is kept permanently beside 2026.10.4 even though compatibleCandidate rejects anything below 2026.10.3 due to the eMudhra block from [Bug]: T3 Connect still accepts cloudflared versions affected by the eMudhra compromise #25608.

  4. chrome-headless-shell keeps a full ~280 MB previous copy permanently.
    At PreviewBrowser.ts:326-331, install always preserves one previous version alongside the current pin, and no later startup sweep removes it once nothing uses it. On this host, 157.0.8103.78 at 277 MB stayed beside active 158.0.8127.36 at 283 MB. By contrast, AntigravityInstallation.ts:821-830 prunes inactive releases as soon as no lease references them.

Combined with the systemd launcher still pinned to 0.0.46-nightly.20261006.2735 at 286 MB, which is tracked in #37705, old T3 binaries occupied ~1.24 GB on a 50 GB volume.

Impact

Minor bug or occasional failure

Version or commit

Server 0.1.12-nightly.20261122.5085, source references at 997103b

Environment

Ubuntu 24.04.5 LTS, Linux 6.8.0-147-generic x86_64, headless systemd user service with ~/.t3 symlinked to /mnt/HC_Volume_107060327/.t3

Logs or stack traces

$ cat ~/.t3/runtime/service-state.json
{
  "protocol": 3,
  "activeVersion": "0.1.12-nightly.20261122.5085",
  "update": {
    "id": "573b5048-d574-4fc8-beb1-dedd73e43066",
    "fromVersion": "0.1.12-nightly.20261121.5038",
    "targetVersion": "0.1.12-nightly.20261122.5085",
    "status": "committed"
  }
}

$ du -sh ~/.t3/runtime/versions/* ~/.t3/runtime/versions/.staging-* ~/.t3/tools/chrome-headless-shell/linux64/* ~/.t3/tools/cloudflared/*
494M	~/.t3/runtime/versions/0.1.12-nightly.20261121.5038
493M	~/.t3/runtime/versions/0.1.12-nightly.20261122.5085
286M	~/.t3/runtime/versions/0.0.46-nightly.20261006.2735
149M	~/.t3/runtime/versions/.staging-67BQG5
277M	~/.t3/tools/chrome-headless-shell/linux64/157.0.8103.78
283M	~/.t3/tools/chrome-headless-shell/linux64/158.0.8127.36
39M	~/.t3/tools/cloudflared/2026.10.0
39M	~/.t3/tools/cloudflared/2026.10.4

Workaround

Delete .staging-*, older tool versions under ~/.t3/tools/, and the previous committed runtime version manually.

Related issues

#37705, #25608

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