Skip to content

Timed-out provider update hard-kills npm on Windows and leaves OpenCode CLI broken/missing from PATH #42148

Done

Description

@1kaahu

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

  1. 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
  2. On Windows x64, @opencode/[email protected] pulls two optional platform packages that both match win32/x64: @opencode/cli-windows-x64 and @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.
  3. In apps/server/src/provider/providerMaintenanceRunner.ts (unchanged on main at 43a0e74f):
    • UPDATE_TIMEOUT_MINUTES = 30 (lines 47–48) wraps collectCommandResult() in Effect.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 back reify. Because npm moves the working 2.3.2 package (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 opencode shims on PATH
      • a 229-byte placeholder node_modules\@opencode\cli\bin\opencode.exe (since postinstall.mjs never ran)
      • two half-extracted platform binaries (package.json not yet written; executing opencode.exe fails as an invalid executable)
      • the working 2.3.2 install orphaned in node_modules\@opencode\.cli-3X8VxDNC
    • 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

  1. On Windows x64, install @opencode/cli globally with npm (e.g. an older version such as 2.3.2) so T3 Code detects it as an npm-managed provider.
  2. Throttle network bandwidth (e.g. ~0.2 MiB/s) so npm install -g --prefix <prefix> --allow-scripts=@opencode/cli @opencode/cli@latest takes more than 30 minutes to download and extract both @opencode/cli-windows-x64 and @opencode/cli-windows-x64-baseline.
  3. Trigger Update now for OpenCode in T3 Code.
  4. Wait 30 minutes for UPDATE_TIMEOUT_MS to fire and kill npm.
  5. Observe that opencode is no longer on PATH, @opencode/cli/bin/opencode.exe is the 229-byte postinstall stub, the old install is left in node_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

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

  1. added
    via-triage
    on Nov 24, 2026
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

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions