[Bug]: Provider "Update now" ignores Volta installs on Windows and runs `opencode upgrade`#24873

opened21d agobyIisbool

Before submitting

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

Area

apps/desktop

Steps to reproduce

  1. On Windows, install Volta 2.x and run volta install @opencode/cli
  2. Start T3 Code and let it detect OpenCode.
  3. Open the OpenCode provider card. It offers "Update now" with C:\Users\<user>\AppData\Local\Volta\bin\opencode.CMD upgrade.
  4. Click "Update now".

Expected behavior

T3 Code recognizes the Volta install and runs volta install @opencode/cli@latest, as it already does for Volta's symlink layout on macOS/Linux.

Actual behavior

The resolver falls back to the provider's own updater, opencode upgrade. OpenCode's updater has no Volta method (--method choices: curl, npm, pnpm, bun, yarn, vp, brew, winget), so the copy Volta runs is not updated and stays at 2.1.2. Running volta install @opencode/cli@latest manually works.

Root cause

isVoltaPackageInstall in packages/provider-core/src/server/maintenanceResolver.ts only accepts a command whose real path is named volta-shim:

ts
1if (path.basename(normalizeCommandPath(context.realCommandPath)).replace(/\.exe$/, "") !== "volta-shim") {
2 return false;
3}

On Windows, Volta 2.0.2 doesn't link bin\<tool> to volta-shim.exe. It writes script shims instead:

1%LOCALAPPDATA%\Volta\bin\opencode.cmd -> @echo off
2 volta run %~n0 %*
3%LOCALAPPDATA%\Volta\bin\opencode -> #!/bin/bash
4 volta run "$(basename $0)" "$@"

realCommandPath is therefore ...\Volta\bin\opencode.CMD, so the check returns false before it looks at the package image. The image it would check, %LOCALAPPDATA%\Volta\tools\image\packages\@opencode\cli, does exist. The npm-prefix check also misses, so the resolver falls back to native opencode upgrade. The only Volta test ("updates Volta installs only when Volta has the package") builds the symlink layout, so this case isn't covered. Other npm-distributed provider CLIs installed with Volta on Windows probably take the same path.

Suggested fix

On win32, also treat the command as a Volta shim when resolvedCommandPath is a small .cmd script in <voltaHome>\bin whose body runs volta run. Keep the existing package-image check as proof of ownership. Also match .exe case-insensitively (/\.exe$/i). Add a Windows-shaped case next to the existing Volta test.

Impact

Minor bug or occasional failure

Version or commit

t3 v0.1.2-nightly.20261022.3512 (code unchanged on main)

Environment

Windows 11 Pro 10.0.26200, Volta 2.0.2, Node 22.14.0 (Volta), OpenCode @opencode/cli 2.1.2 installed with volta install

Logs or stack traces

shell
1# ~/.t3/caches/opencode.json
2"versionAdvisory": {
3 "currentVersion": "2.1.2",
4 "latestVersion": "2.1.4",
5 "updateCommand": "C:\\Users\\<user>\\AppData\\Local\\Volta\\bin\\opencode.CMD upgrade",
6 "canUpdate": true
7}
8
9# server trace for a provider refresh:
10# resolvePackageManagedProviderMaintenance runs isVoltaPackageInstall (returns false),
11# then resolveNpmGlobalPrefix, then isMiseWrapperScript.

Screenshots, recordings, or supporting files

No response

Workaround

  • Update manually with volta install @opencode/cli@latest.
  • Or create %LOCALAPPDATA%\Volta\bin\opencode.exe as a symlink to C:\Program Files\Volta\volta-shim.exe (needs Developer Mode or admin). .EXE comes before .CMD in PATHEXT, so T3 Code resolves the symlink, its real path is volta-shim.exe, and the existing check matches. Volta's shim picks the tool from its file name, so opencode still runs normally.