fix(provider): persist plugin providers after instance dispose#20254
Open
luanweslley77 wants to merge 2 commits intoanomalyco:devfrom
Open
fix(provider): persist plugin providers after instance dispose#20254luanweslley77 wants to merge 2 commits intoanomalyco:devfrom
luanweslley77 wants to merge 2 commits intoanomalyco:devfrom
Conversation
- Add fromConfigProvider() to convert config providers to database format - Register plugin providers in database before mergeProvider() is called - Remove unused type assertion (code quality) - Fixes issue where plugin providers disappeared after /instance/dispose Fixes anomalyco#20026
- Add robust test for provider persistence after instance dispose/reload - Tests fix for issue anomalyco#20026 (plugin providers disappearing) - Verifies provider config, models, capabilities, and options persist correctly - Two instance lifecycle test: load → dispose → reload → verify Test coverage: - Provider registration and metadata - Multiple models with full capability specs - Options (baseURL, headers) persistence - Model limits, costs, and modalities - Complete data integrity after reload Test plan: bun test test/provider/plugin-reload.test.ts Result: ✅ 1 pass, 41 expect() calls Related to: anomalyco#20026
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #20026
Type of change
What does this PR do?
Plugin providers registered via
config()hook disappear from TUI provider list after/instance/dispose.Root cause:
mergeProvider()only checksdatabase(models.dev), but plugin providers aren't persisted there after reload.Fix: Add
fromConfigProvider()function and register plugin providers in database beforemergeProvider()is called.Changes:
How did you verify your code works?
Unit tests:
cd packages/opencode && bun test test/provider/plugin-reload.test.ts✅ (1 pass, 41 expects)Manual test: Plugin with custom provider (not from models.dev)
Screenshots / recordings
N/A - no UI changes
Checklist