Skip to content

[Bug]: OpenCode update reports "still needs an update" after a successful upgrade because verification reads the running server version #13010

Description

@satyalyadav

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. Enable the OpenCode provider with Server URL empty so T3 Code owns the local server.
  2. Open a thread and send a prompt so T3 Code spawns its opencode serve helper. Leave that helper running.
  3. When the update toast appears, click Update now.
  4. opencode upgrade runs, exits 0, and replaces the binary on disk.
  5. T3 Code shows Provider still needs an update / OpenCode still appears outdated even though the CLI on disk is now the latest version.

Expected behavior

After the update command exits 0, T3 Code should verify the newly installed version and show the success state. For a local OpenCode server that T3 Code owns, it should restart or invalidate that helper before re-reading the version, or fall back to the version from the opencode --version probe it just ran.

Actual behavior

The post-update verification reads the version from the already-running opencode serve child instead of the updated CLI. opencode upgrade replaces the binary but the running process keeps the old code in memory, so /global/health keeps returning the old version. The advisory stays behind_latest, the update state becomes unchanged, and the client renders Provider still needs an update.

Relevant code on main:

  • apps/server/src/provider/Layers/OpenCodeProvider.ts probes opencode --version, then overwrites that result with the server handle's version at line 535: version = inventoryExit.value.version;
  • The local server handle comes from OpenCodeServerOwner.withServer(...), which reuses any live server and only restarts it after OPENCODE_SERVER_IDLE_TTL = "30 seconds" (apps/server/src/provider/OpenCodeServerOwner.ts).
  • apps/server/src/provider/providerMaintenanceRunner.ts computes stillOutdated from that refreshed snapshot and records status: "unchanged" at line 416, which produces the toast.

Timeline from my machine (local time, 2026-09-21, OpenCode 1.18.31 to 1.18.32, native install, no npm):

  • 22:16:30 the update starts. opencode upgrade exits 0 after about 15 s and the binary on disk becomes 1.18.32.
  • 22:16:45.667 the provider probe records version = 1.18.31 in ~/.t3/caches/opencode.json, even though opencode --version reports 1.18.32 at the same moment.
  • 22:16:49.99 the update finishes as unchanged.
  • 22:17:39 and 22:18:26 new opencode serve children start. Both report 1.18.32 on /global/health, so the reported state self-corrects once the helper is replaced.

Trace: ProviderMaintenanceRunner.runCommandAndVerify, traceId b345808a7791d2cd9d02b630872e0cbc.

Note: this is the same visible symptom as #5629 and #3550 (Codex) and #8280 (Claude Code), but a different root cause. The binary install path is detected correctly here, the upgrade succeeds, and the CLI probe returns the new version. Only the server version used for verification is stale.

Impact

Minor bug or occasional failure

Version or commit

T3 Code 0.0.42 (client APP_VERSION from the running bundle)

Environment

Windows host with a WSL2 (Ubuntu) environment. OpenCode provider enabled with the default local server (Server URL empty). OpenCode upgraded from 1.18.31 to 1.18.32 via opencode upgrade, native install at ~/.opencode/bin/opencode.

Logs or stack traces

# Snapshot written by the failed verification (~/.t3/caches/opencode.json)
{
  "version": "1.18.31",
  "checkedAt": "2026-09-22T05:16:45.667Z",
  "versionAdvisory": {
    "status": "behind_latest",
    "currentVersion": "1.18.31",
    "latestVersion": "1.18.32",
    "updateCommand": "~/.local/bin/opencode upgrade",
    "canUpdate": true
  }
}

# CLI after the update
$ opencode --version
1.18.32

# T3 Code owned servers after the helper was replaced
$ curl -s http://127.0.0.1:<port>/global/health
{"healthy":true,"version":"1.18.32"}
Span timeline (server.trace.ndjson):
22:16:30  ProviderMaintenanceRunner.updateProvider started
22:16:45  ProviderMaintenanceRunner.collectCommandResult finished (exit 0, 14.9 s)
22:16:45  checkOpenCodeProviderStatus started, recorded version 1.18.31
22:16:50  setProviderMaintenanceActionState status=unchanged

Screenshots, recordings, or supporting files

Toast text: Provider still needs an update / OpenCode still appears outdated. Check provider settings for details. with a Settings button.

Workaround

Refresh provider status after the local helper has been idle for about 30 seconds (it restarts from the new binary), or restart T3 Code. The update itself is already applied.

Activity

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

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions