Skip to content

Auto-updater ate 266 GB by reinstalling OpenCode every 10 minutes #45087

Open

Description

@ogulcancelik

Description

A long-running opencode2 serve --service process filled ~/.npm/_cacache with 266 GB of OpenCode beta packages.

After npm updates the executable, the running server keeps its original compiled version in memory. Its ten-minute update loop still thinks it is outdated, so it installs the same latest version again.

My logs repeat this indefinitely:

update check current=0.0.0-next-16473 latest=0.0.0-beta-17498
updated OpenCode from=0.0.0-next-16473 to=0.0.0-beta-17498 method=npm

# ten minutes later

update check current=0.0.0-next-16473 latest=0.0.0-beta-17498
updated OpenCode from=0.0.0-next-16473 to=0.0.0-beta-17498 method=npm

The service ran unattended for roughly three weeks:

265.97GiB  ~/.npm/_cacache

The current beta source still schedules checks every ten minutes and compares against the immutable OPENCODE_VERSION.

Related to #38567 and #41495, but this happens after successful updates and continues until the disk fills.

Plugins

None required.

OpenCode version

0.0.0-next-16473, repeatedly updating through the beta channel.

Steps to reproduce

Use a disposable environment because this can consume substantial disk space.

root=/var/tmp/opencode-updater-repro
mkdir -p "$root/home" "$root/npm-prefix" "$root/npm-cache"

export HOME="$root/home"
export NPM_CONFIG_PREFIX="$root/npm-prefix"
export NPM_CONFIG_CACHE="$root/npm-cache"
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"

npm install -g @opencode-ai/cli@0.0.0-beta-18219
opencode2 serve --service

Then:

  1. Let the first automatic update complete.
  2. Confirm the globally installed package is now newer.
  3. Leave the original server running for another ten minutes.
  4. Check the OpenCode and npm logs.
  5. The server installs the same latest package again because its reported current version never changes.
  6. Each cycle adds more packages to the npm cache.
grep -E "update check|updated OpenCode" \
  "$HOME/.local/share/opencode/log/opencode.log"

du -sh "$NPM_CONFIG_CACHE"

Screenshot and/or share link

N/A

Operating System

Fedora Linux 44, kernel 7.1.5-200.fc44.x86_64

Terminal

Ghostty

Activity

  1. github-actions commented on Aug 25, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue was filed by an AI (explicitly noted at the bottom: "Filed by GPT-5.6-Sol, supervised by a human"). We do not accept AI-generated issue reports. Please rewrite this in your own words, describing what you personally observed.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Aug 25, 2026
  3. github-actions commented on Aug 25, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! Everything looks good now — the bug report includes a clear description, steps to reproduce, version info, and system details. We'll take a look.

  4. ogulcancelik commented on Aug 25, 2026

    @ogulcancelik
    Author

    following up on my own report, a couple of things in it might be wrong.

    reinstalling same version stores once, the 266gb came from 516 distinct versions installed between 2026-06-10 and 2026-08-25 and never pruned. i think it was two and a half months not three weeks.

    one version, 0.0.0-next-17444, was installed 200 times back to back over 33 hours. so that's the one costs cpu, bandwith and global npm install repeatedly overwriting the same thing which is #41495

    on the cache side, the fix already exists in the same function. the bun branch of upgrade() installs into a scoped temp cache dir with a comment saying bun does not prune its shared cache. npm, pnpm and yarn just call the normal global install and inherit the user cache. npm takes --cache the same way.

  5. opencode-agent commented on Aug 25, 2026

    @opencode-agent
    Contributor

    For now, update to the latest beta, restart the background service, and clear npm's accumulated cache:

    npm install -g @opencode-ai/cli@beta
    opencode2 service restart
    npm cache clean --force

    Restarting the service is important: updating the package alone leaves the existing process running with its old in-memory version.

  6. opencode-agent commented on Aug 28, 2026

    @opencode-agent
    Contributor

    Addressed by #45091. The updater now remembers the last successfully installed version so a long-running service does not repeatedly reinstall it, and npm updates use a scoped temporary cache that is removed afterward. The updater-service regression exercises repeated checks and fails with three installs when the fix is removed versus one with it applied. Closing as resolved on the v2 branch.

  7. opencode-agent commented on Aug 28, 2026

    @opencode-agent
    Contributor

    Reopening because #45865 reverted #45091 on the v2 branch. The repeated-install and scoped npm-cache fix cited in the closure is no longer shipped, so this issue no longer meets the resolved bar.

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