Repository navigation
Description
What happened
Clicking Update now for OpenCode on Windows (on a slow connection) broke a previously working standalone @opencode/cli (2.3.2) install and left T3 Code reporting OpenCode as not found.
A 30-minute ceiling on an updater is reasonable to stop a hung process, but hitting it should not destroy the working CLI that was installed before the update started.
Diagnosis
- T3 Code runs npm global provider updates directly against the live prefix (
apps/server/src/provider/providerMaintenanceRunner.ts+@t3tools/provider-core/server/maintenanceResolver), here:
npm install --global --prefix <prefix> --allow-scripts @opencode/cli @opencode/cli@latest - On Windows x64,
@opencode/[email protected]pulls two optional platform packages that both matchwin32/x64:@opencode/cli-windows-x64and@opencode/cli-windows-x64-baseline(~500 MB uncompressed combined). On a ~0.1–0.3 MiB/s connection, downloading and unpacking both exceeds 30 minutes. - In
apps/server/src/provider/providerMaintenanceRunner.ts(unchanged onmainat43a0e74f):UPDATE_TIMEOUT_MINUTES = 30(lines 47–48) wrapscollectCommandResult()inEffect.scoped+Effect.timeoutOption(Duration.millis(UPDATE_TIMEOUT_MS))(lines 204–206) as a fixed wall-clock limit, even while the installer is actively writing bytes.- When the timeout fires, closing the scope runs
Effect.addFinalizer(() => child.kill().pipe(Effect.ignore))(line 141). - On Windows,
child.kill()terminates npm abruptly without giving it a chance to roll backreify. Because npm moves the working2.3.2package (node_modules\@opencode\cli→.cli-XXXXXXXX) and all global bin shims (opencode,opencode.cmd,opencode.ps1,opencode2*→.opencode*-XXXXXXXX) aside before extracting the new tarballs, killing npm mid-extraction leaves:- no
opencodeshims onPATH - a 229-byte placeholder
node_modules\@opencode\cli\bin\opencode.exe(sincepostinstall.mjsnever ran) - two half-extracted platform binaries (
package.jsonnot yet written; executingopencode.exefails as an invalid executable) - the working
2.3.2install orphaned innode_modules\@opencode\.cli-3X8VxDNC
- no
- Lines 597–614 then mark the update
failed("Update timed out after 30 minutes.") without recovering, restoring the retired install, or warning that the provider CLI may now be missing.
Note: the server trace files (server.trace.ndjson*) on the machine had already rotated past the 01:38–02:08Z window, so the timeout span itself is not in the surviving trace. The 30-minute kill is evidenced by the npm debug log start time (01:38:28Z), both extracting binaries stopping writes at 02:08:28Z (exactly 30m00s later), and the npm debug log ending abruptly mid-reify with no error or verbose exit line.
Steps to reproduce
- On Windows x64, install
@opencode/cliglobally with npm (e.g. an older version such as2.3.2) so T3 Code detects it as an npm-managed provider. - Throttle network bandwidth (e.g. ~0.2 MiB/s) so
npm install -g --prefix <prefix> --allow-scripts=@opencode/cli @opencode/cli@latesttakes more than 30 minutes to download and extract both@opencode/cli-windows-x64and@opencode/cli-windows-x64-baseline. - Trigger Update now for OpenCode in T3 Code.
- Wait 30 minutes for
UPDATE_TIMEOUT_MSto fire and kill npm. - Observe that
opencodeis no longer onPATH,@opencode/cli/bin/opencode.exeis the 229-byte postinstall stub, the old install is left innode_modules/@opencode/.cli-*, and T3 Code reports OpenCode as not installed.
(Can also be reproduced quickly in a test/dev setup by lowering UPDATE_TIMEOUT_MS so it fires during npm reify tarball extraction on Windows.)
Version
T3 Code Nightly 0.1.12-nightly.20261122.5111 (Windows). Verified the timeout and kill path in apps/server/src/provider/providerMaintenanceRunner.ts is unchanged in 0.1.12-nightly.20261124.5178 and on main at 43a0e74f.
Environment
Windows x64, Node v24.19.0, npm 11.17.0, @opencode/cli 2.3.2 → 2.4.1, slow network (~0.07–0.30 MiB/s observed in the same session).
Evidence
# npm debug log header (~\AppData\Local\npm-cache\_logs\2026-11-24T01_38_28_905Z-debug-0.log)
1 info using [email protected]
2 info using [email protected]
6 verbose title npm install @opencode/cli@latest
7 verbose argv "install" "--global" "--prefix" "~\AppData\Local\Programs\nodejs" "--allow-scripts" "@opencode/cli" "@opencode/cli@latest"
# Last lines of the npm debug log (ends abruptly with no error / verbose exit / rollback)
84 silly reify moves {
84 silly reify '~\AppData\Local\Programs\nodejs\node_modules\@opencode\cli': '~\AppData\Local\Programs\nodejs\node_modules\@opencode\.cli-3X8VxDNC',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode': '~\AppData\Local\Programs\nodejs\.opencode-4IILEltI',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode.cmd': '~\AppData\Local\Programs\nodejs\.opencode.cmd-5o8k51Xy',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode.ps1': '~\AppData\Local\Programs\nodejs\.opencode.ps1-vUmjvhBq',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode2': '~\AppData\Local\Programs\nodejs\.opencode2-EsmX0ilx',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode2.cmd': '~\AppData\Local\Programs\nodejs\.opencode2.cmd-eS5MhTlP',
84 silly reify '~\AppData\Local\Programs\nodejs\opencode2.ps1': '~\AppData\Local\Programs\nodejs\.opencode2.ps1-ZNnTrRKz'
84 silly reify }
85 http cache @opencode/cli@<registry>/@opencode/cli/-/cli-2.4.1.tgz 0ms (cache hit)
86 http cache @opencode/cli-windows-x64-baseline@<registry>/@opencode/cli-windows-x64-baseline/-/cli-windows-x64-baseline-2.4.1.tgz 0ms (cache hit)
87 http cache @opencode/cli-windows-x64@<registry>/@opencode/cli-windows-x64/-/cli-windows-x64-2.4.1.tgz 0ms (cache hit)
88 silly tarball no local data for @opencode/cli@<registry>/@opencode/cli/-/cli-2.4.1.tgz. Extracting by manifest.
89 silly tarball no local data for @opencode/cli-windows-x64@<registry>/@opencode/cli-windows-x64/-/cli-windows-x64-2.4.1.tgz. Extracting by manifest.
90 silly tarball no local data for @opencode/cli-windows-x64-baseline@<registry>/@opencode/cli-windows-x64-baseline/-/cli-windows-x64-baseline-2.4.1.tgz. Extracting by manifest.
91 http fetch GET 200 <registry>/@opencode/cli/-/cli-2.4.1.tgz 613ms (cache miss)
# File sizes & timestamps (UTC) showing exact 30m00s cutoff (01:38:28Z -> 02:08:28Z)
File Length Created LastWrite
---- ------ ------- ---------
_logs/2026-11-24T01_38_28_905Z-debug-0.log 10822 01:38:28Z 01:39:35Z
@opencode/cli/bin/opencode.exe 229 01:39:35Z 01:39:35Z
@opencode/cli/.../@opencode/cli-windows-x64/bin/opencode.exe 245210691 01:39:35Z 02:08:28Z
@opencode/cli/.../@opencode/cli-windows-x64-baseline/bin/opencode.exe
219605728 01:39:36Z 02:08:28Z
# Retired working install still intact beside the broken 2.4.1 directory:
# @opencode/.cli-3X8VxDNC/bin/opencode.exe -> 259,702,664 bytes, `opencode v2.3.2` (exit 0)
# @opencode/cli/bin/opencode.exe -> 229 bytes ("Error: @opencode/cli's postinstall script was not run.")Related issues
- [Bug]: OpenCode CLI unavailable after provider update attempt on Windows #27056, Provider update is killed when the client's connection drops mid-update #27361, [Bug]: An interrupted provider update kills npm mid-install and leaves the provider CLI missing #37960 (closed by PR fix(server): provider updates keep running when the client disconnects #27261): fixed the same broken-install symptom when triggered by a client WebSocket disconnect, by moving
ProviderMaintenanceRunnerto a server-lifetime scope. Not a duplicate because the 30-minuteUPDATE_TIMEOUT_MSkill still interrupts and corrupts a running Windows npm install even when no client disconnects. - PR fix(server): provider updates no longer time out mid-download #28132 (merged): raised
UPDATE_TIMEOUT_MSfrom 5 to 30 minutes to prevent killing slow downloads mid-install, noting that killing an installer mid-download corrupts the installation. On slow links,@opencode/cli's dual Windows x64 binaries still exceed 30 minutes, and hitting the timeout still leaves the provider unusable instead of preserving/restoring the prior working install.
Fix applied or workaround
Pointed T3 Code's OpenCode provider binary path at OpenCode Desktop's bundled resources\opencode-cli.exe (2.4.1) and stopped using T3's one-click Update now for npm-installed OpenCode on this machine. (Alternatively, renaming npm's retired .cli-* folder and .opencode*-* shims back restores the prior version.)
Filed by
Gemini 4 Neon in Antigravity, via t3 triage
Activity