Skip to content

[v2] cli: update prompt recommends older version #47714

Open

Description

@mynameistito

Description

Summary

Launching opencode2 version v0.0.0-beta-19215 shows an update prompt recommending v0.0.0-beta-19213, which is older than the currently installed version.

Environment

  • opencode version: opencode2 v0.0.0-beta-19215
  • OS: Windows 11, build 10.0.26200.9278
  • Terminal: Windows Terminal Preview 1.25.1912.0
  • Shell: "Custom pwsh"
Custom pwsh configuration

pwsh.cmd

@echo off
"%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exe" -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%~dp0pwsh-wrapper.ps1" %*

pwsh-wrapper.ps1

$realPwsh = '%LOCALAPPDATA%\Local\Microsoft\WindowsApps\pwsh.exe'

$filteredArgs = foreach ($arg in $args) {
	if ($arg -ine '-NoProfile') {
		$arg
	}
}

& $realPwsh @filteredArgs
exit $LASTEXITCODE
  • Install/channel: Beta
  • Active plugins: None configured; no local plugin files found

Reproduction

  1. Install or run opencode2 v0.0.0-beta-19215.
  2. Launch opencode2.
  3. Observe the update notification recommending v0.0.0-beta-19213.

Expected Behavior

The update check should recognize that v0.0.0-beta-19215 is newer than v0.0.0-beta-19213 and should only recommend an update when a newer version is available.

Actual Behavior

The update prompt recommends updating from v0.0.0-beta-19215 to the older version v0.0.0-beta-19213.

Additional Context

This was observed immediately after launching opencode2.

The exact update prompt text has not yet been captured, and it is currently unclear whether the prompt appears on every launch.

Activity

  1. github-actions commented on Sep 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. ZaraByte commented on Sep 19, 2026

    @ZaraByte

    Another instance of this, with a different shape: a 2.0.9 install was downgraded to 2.0.8 because the update service's answer for current=2.0.9 moved backwards.

    Environment

    • opencode version: 2.0.9 → 2.0.8 (installed automatically at 2026-09-19 09:21:29 UTC)
    • OS: Windows 11 (Windows_NT 10.0.26200, win32 x64)
    • Install/channel: bun global install (~/.bun/bin), channel latest, local=false
    • Active plugins: none at the time (a plugin was installed later that day)

    Evidence

    CLI log (~/.local/share/opencode/log/opencode.log, UTC):

    09:21:10 level=INFO message="update check" current=2.0.9 latest=2.0.8
    09:21:10 level=INFO message="OpenCode update available" current=2.0.9 latest=2.0.8 action=notify
    09:21:24 level=INFO message="spawning process" command=bun args="[... \"install\",\"--global\",\"--trust\",\"--cache-dir\",\"C:\\Users\\<user>\\.cache\\opencode\\update-268SSX\",\"@opencode/[email protected]\"]"
    09:21:29 level=INFO message="updated OpenCode" from=2.0.9 to=2.0.8 method=bun
    

    Earlier the same day the same check reported current=2.0.9 latest=2.0.9 (action=up-to-date, 08:54:53 UTC), so the service's "latest" for latest/cli/npm changed from 2.0.9 to 2.0.8 between 08:54 and 09:21 UTC.

    The update API still answers this way (checked 2026-09-19 ~09:35 UTC):

    $ curl -s "https://opencode.ai/update/api/latest/cli/npm?current=2.0.9"
    {"channel":"latest","name":"cli","distribution":"npm","version":"2.0.8","metadata":{"package":"@opencode/cli","github":{"sha":"0a611129...","run_id":"35325251492","run_attempt":"1","actor":"Hona","ref":"refs/heads/v2"}},"active":false,"minimum":false,"time_created":1789722595958,"time_updated":1789722595958}
    

    Meanwhile @opencode/[email protected] is published on npm (dist-tag latest, published 2026-09-19T05:11:15Z) and v2.0.9 is tagged in the repo. So any client on 2.0.9 is currently told that 2.0.8 is "available".

    Expected

    The update prompt/install should only fire when latest > current (semver-greater), so a client that is ahead of the update service can never be downgraded.

    Actual

    2.0.9 was downgraded to 2.0.8; OpenCode even logged it as updated OpenCode from=2.0.9 to=2.0.8. (Same missing semver-gt guard noted in #49660.)

  3. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report!

    I looked at the updater code, and this is how it's built to work right now. The CLI asks the update server which version you should be on for your channel. If your installed version is different from that answer, it shows the prompt, even when the server's version is older. This is on purpose: it lets the server roll users back if a release has problems (there's a test for this rollback case in packages/cli/src/services/updater.test.ts). So when you saw it, the beta channel was most likely still serving 0.0.0-beta-19213, and the prompt pointed you back to it.

    I've filed this as a feature request: offer only newer versions, or at least say clearly when a prompt is a rollback/downgrade and not an update. Maintainers will consider it.

    In the meantime, you can turn off automatic updates or switch to notify-only with the autoupdate setting in your config (false or "notify"). The beta channel is also older than the current 2.x releases, so moving to the stable 2.x channel may be worth it.

    Related: #49660 is a different /update problem (an update offered on a pacman install that can't actually be upgraded), so it's only loosely related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions