Skip to content

Conversation

@code-yeongyu
Copy link
Owner

@code-yeongyu code-yeongyu commented Feb 3, 2026

Summary

Fixes auto-update failing silently due to operating on wrong directory.

Problem

The auto-update-checker was using CACHE_DIR (/.cache/opencode) for plugin invalidation, but plugins are actually installed in USER_CONFIG_DIR (/.config/opencode).

Symptom: "Update available" toast appears, but after restart the old version is still installed.

Root cause:

  1. invalidatePackage() tried to remove package from ~/.cache/opencode/node_modules/ (wrong!)
  2. removeFromBunLock() tried to modify ~/.cache/opencode/bun.lock (wrong!)
  3. bun install ran in correct dir but respected existing lockfile → old version reinstalled

Fix

  • Change invalidatePackage() to use USER_CONFIG_DIR
  • Change removeFromBunLock() to use USER_CONFIG_DIR
  • Move INSTALLED_PACKAGE_JSON constant to use USER_CONFIG_DIR

Testing

  • All existing tests pass (bun test src/hooks/auto-update-checker/)
  • Verified paths are correct in code review

Summary by cubic

Fixes auto-update by using USER_CONFIG_DIR for plugin invalidation and lockfile edits so updates apply after restart instead of failing silently.

  • Bug Fixes
    • Use USER_CONFIG_DIR for bun.lock, node_modules, and package.json paths.
    • Update invalidatePackage() and removeFromBunLock() to target USER_CONFIG_DIR.
    • Move INSTALLED_PACKAGE_JSON to USER_CONFIG_DIR for consistency.

Written for commit 9c2c109. Summary will update on new commits.

… invalidation

The auto-update-checker was operating on the wrong directory:
- CACHE_DIR (~/.cache/opencode) was used for node_modules, package.json, and bun.lock
- But plugins are installed in USER_CONFIG_DIR (~/.config/opencode)

This caused auto-updates to fail silently:
1. Update detected correctly (3.x.x -> 3.y.y)
2. invalidatePackage() tried to delete from ~/.cache/opencode (wrong!)
3. bun install ran but respected existing lockfile
4. Old version remained installed

Fix: Use USER_CONFIG_DIR consistently for all invalidation operations.

Also moves INSTALLED_PACKAGE_JSON constant to use USER_CONFIG_DIR for consistency.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants