Skip to content

Conversation

@jerome-benoit
Copy link
Contributor

@jerome-benoit jerome-benoit commented Jan 23, 2026

Fixes #10276

What changed

Track provider packages in package.json under opencode.providers. When a provider switches SDK, the old package is removed if no other provider uses it.

How to verify

bun test test/bun.test.ts

When a provider switches SDK packages, the old package is now automatically
removed to avoid accumulating unused dependencies in the cache.

- Add provider tracking in package.json under opencode.providers section
- Modify BunProc.install() to accept optional providerID parameter
- Remove old package when provider switches to a different SDK
- Add comprehensive integration tests for provider tracking
Copilot AI review requested due to automatic review settings January 23, 2026 16:45
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds automatic tracking and cleanup of npm packages used by providers to prevent accumulation of unused dependencies when providers switch SDKs.

Changes:

  • Adds provider-to-package tracking in package.json under opencode.providers section
  • Modifies BunProc.install() to accept an optional providerID parameter for tracking
  • Implements automatic removal of old packages when a provider switches to a different SDK
  • Adds OPENCODE_TEST_CACHE environment variable for test isolation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/opencode/src/bun/index.ts Implements provider tracking logic, package switching detection, and automatic cleanup of old packages
packages/opencode/src/provider/provider.ts Passes model.providerID to BunProc.install() to enable tracking
packages/opencode/src/global/index.ts Adds dynamic getter for cache path that respects OPENCODE_TEST_CACHE env var
packages/opencode/test/bun.test.ts Adds 10 integration tests covering provider tracking, package switching, and backward compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Don't remove package if other providers still use it
- Fix version comparison to handle "latest" correctly
- Add test for shared package scenario
@jerome-benoit jerome-benoit force-pushed the feat/provider-package-tracking branch from 8328b99 to 326ca0e Compare January 23, 2026 19:07
@jerome-benoit jerome-benoit force-pushed the feat/provider-package-tracking branch from 326ca0e to 0607311 Compare January 23, 2026 19:10
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.

Provider SDK packages accumulate in cache when switching

1 participant