Skip to content

[BUG] /update offers 2.0.7 on pacman-managed install, but upgrade cannot work (method undetected; GitHub release v2.0.7 missing) #49660

Open

Description

@disonjer

Description

Environment

  • OS: CachyOS (Arch Linux derivative), x86_64
  • Install: distro package via pacman (pacman -S opencode, repo cachyos-extra-v3), binary at /usr/bin/opencode
  • OpenCode version: 2.0.5, channel=latest

What happens

  1. The TUI home screen shows /update to install v2.0.7; running /update opens an "Update available" dialog (Skip / Update). The update server does return 2.0.7:
    $ curl -s "https://opencode.ai/update/api/latest/cli/npm?current=2.0.5"
    {"version":"2.0.7","metadata":{"package":"@opencode/cli","github":{"ref":"refs/heads/v2",...}}}
    
  2. Pressing Update cannot succeed: Updater.method() (packages/cli/src/services/updater.ts @ v2.0.5) only detects ~/.opencode/bin (curl installs) and npm/pnpm/bun/yarn globals. A distro-package install at /usr/bin returns undefined → the upgrade aborts with "Could not detect the installation method".
  3. The prompt is not suppressed for such unmanaged installs, even though the upgrade path is guaranteed to fail.

Second inconsistency — the advertised version isn't downloadable

  • The tag v2.0.7 exists, but there is no GitHub Release object for it: GET /repos/anomalyco/opencode/releases/tags/v2.0.7 → 404. The tag web page (/releases/tag/v2.0.7) returns 200, but shows only GitHub's auto-generated source archives — no binary assets.
  • The binary URL the install script downloads → 404: releases/download/v2.0.7/opencode-linux-x64.tar.gz (the same URL for v1.18.31 → 302, exists).
  • The install script's own existence check is fooled as well: it HEADs the tag web page (200), so --method curl proceeds and then dies on the asset download with HTTP 404.
  • Only @opencode/cli@2.0.7 on npm is actually published (dist-tag latest: 2.0.7); the legacy opencode-ai package remains on 1.18.31, and GitHub Releases currently carry only the 1.x line.

Root cause: the v2 branch's publish.yml has no gh release create/upload step at all — it deploys the update service, creates the git tag, and publishes to npm only. The dev branch (1.x line) still has them (packages/opencode/script/build.ts runs gh release upload v${version} ./dist/*.zip ./dist/*.tar.gz; workflow steps at lines ~205/~505). So the update API and git tags moved to the v2 world, while the GitHub Releases delivery channel that the install script (--method curl) relies on was left behind in 1.x.

Related defect in the same path

Expected behavior

  • Suppress update prompts (or show "update via your package manager") when the install method is undetectable.
  • Only advertise versions whose artifacts are published to all supported upgrade channels (npm and GitHub Releases).

Not duplicates (checked): #47714, #5618, #11411, #5375, #46493, #36572.

Activity

  1. changed the title [-][BUG] Update prompt offers 2.0.7 to pacman-managed install, but upgrade is impossible (method undetected; GitHub release v2.0.7 missing)[/-] [+][BUG] /update offers 2.0.7 on pacman-managed install, but upgrade cannot work (method undetected; GitHub release v2.0.7 missing)[/+] on Sep 18, 2026
  2. aron-intframe commented on Sep 18, 2026

    @aron-intframe

    Confirmed on v2.0.5 source, and one part of the report is narrower than stated: the v2 curl updater does not use GitHub Releases at all, so the missing v2.0.7 release only breaks the legacy opencode.ai/install script (dev branch), not /update.

    What I ran against the v2.0.5 checkout (packages/cli/src/services/updater.ts, updater-action.ts executed as-is, types stripped):

    $ node repro.mjs
    { execPath: '/usr/bin/opencode', isCurl: false, manifest: '/usr/package.json', manifestExists: false, method: undefined }
    { current: '2.0.5', latest: '2.0.7', notify: 'notify', disable: 'none' }
    { current: '2.0.8', latest: '2.0.7', notify: 'notify' }      # no semver-gt guard, as you said
    200 https://registry.npmjs.org/@opencode/cli-linux-x64/-/cli-linux-x64-2.0.7.tgz
    404 https://github.com/anomalyco/opencode/releases/download/v2.0.7/opencode-linux-x64.tar.gz
    

    So the actual sequence for a pacman install:

    1. inspect() -> action("2.0.5","2.0.7","notify") returns notify and the home screen shows the banner. method() is never consulted at this point.
    2. Pressing Update calls apply() -> install() -> method(). method() checks only ~/.opencode/bin/opencode and a package.json two levels above process.execPath. For /usr/bin/opencode that is /usr/package.json, which does not exist, so installedPackage is undefined and method() returns undefined -> "Installation method not found".
    3. Had method() returned curl, upgrade() fetches https://opencode.ai/v2/install, and that script resolves @opencode/cli-linux-x64@2.0.7 from registry.npmjs.org (200 above). The GitHub Releases dependency lives only in https://opencode.ai/install, which 307s to raw.githubusercontent.com/.../refs/heads/dev/install and does releases/download/v${version}/... (line 194 of that script). That is the 1.x installer; it cannot install 2.x from GitHub because nothing publishes assets there.

    Workaround until this is fixed: the banner is driven by run(), which honours the policy file, so either

    echo '{"update":"disable"}' > ~/.config/opencode/opencode.json   # or "autoupdate": false
    # or
    export OPENCODE_DISABLE_AUTOUPDATE=1
    

    readPolicy() only reads config.json / opencode.json / opencode.jsonc under $XDG_CONFIG_HOME/opencode (or $OPENCODE_CONFIG_DIR), not a project-level config. A manual /update still goes through check(), which ignores the policy, but it no longer nags.

    Suggested fix in updater.ts: have run() call method() before returning {type:"available"} under notify/auto, and return undefined (with the existing "installation method not found" log) when it is undetected. That drops the banner for distro packages without touching the manual /update path. Detecting the package manager itself (pacman -Qo "$(realpath "$0")", dpkg -S, brew --prefix) would be a separate, nice-to-have step so the dialog can say "update via your package manager".

  3. Acidburn0x90 commented on Oct 25, 2026

    @Acidburn0x90

    Same failure on 2.1.3 with the Arch extra package, so it survived 2.0.5 → 2.1.3:

    $ opencode --version && pacman -Q opencode
    opencode v2.1.3
    opencode 2.1.3-1
    
    $ pacman -Qo "$(readlink -f "$(command -v opencode)")"
    /usr/bin/opencode is owned by opencode 2.1.3-1
    
    $ opencode upgrade
    ■  Could not detect the installation method. Pass --method to choose how to upgrade OpenCode.
    
    $ opencode upgrade --method pacman
    ERROR  Invalid value for flag --method: "pacman". Expected: "curl" | "npm" | "pnpm" | "bun" | "yarn" | "vp" | "brew" | "winget"
    

    packages/cli/src/services/updater.ts on dev is unchanged on this point:

    export const methods = ["curl", "npm", "pnpm", "bun", "yarn", "vp", "brew", "winget"] as const

    and method() still bails at if (!installedPackage) return before any package-manager probe, so a distro binary at /usr/bin/opencode can never be identified.

    Two notes for whoever picks this up:

    • pacman -Qo <realpath(process.execPath)> returns ownership and the installed version in one call (/usr/bin/opencode is owned by opencode 2.1.3-1), and pacman -Si opencode with LC_ALL=C gives the sync-db candidate. dpkg -S / rpm -qf are the equivalents for the other distro packages.
    • The upgrade itself needs root, and the TUI's child process has no controlling terminal, so sudo pacman -Syu cannot authenticate from there. Detection plus "update via your package manager, then restart" is probably the realistic scope; feat(desktop): honor OPENCODE_DISABLE_AUTOUPDATE in the updater #55155 and fix(nix): disable the self-updater in the flake build #57979 already take that direction for the env-var and nix cases.

    Workaround in use here: a custom ~/.config/opencode/commands/update.md that overrides /update with a helper that picks repo vs AUR (pacman -Qm) and runs sudo pacman -S --needed opencode or yay -S opencode.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions