refactor(provider): stop custom loaders using facades#20776
Conversation
|
Hi @kitlangton, noticed this PR is still in draft — wanted to flag a related timing issue we've been investigating that might be worth considering as part of this refactor. |
Hey, thanks. I added a regression test which did indeed reproduce the issue! I've included your changes into this PR. 🫡 |
Load plugin hooks before snapshotting config providers so plugin-defined providers survive instance rebuilds. Add a regression test that covers the dispose and reload path. Co-authored-by: luanweslley77 <213105503+luanweslley77@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors provider-layer custom loaders to stop calling static Auth.get(...) / Config.get() facades by injecting auth and config services into the loader layer, and adds regression tests around opencode paid model loading behavior.
Changes:
- Converted provider custom loaders to return
Effectand added an injected dependency bridge forauth/config. - Updated loader execution to run these effects directly (instead of wrapping promise-returning loaders).
- Added opencode regression tests ensuring paid models remain available when an apiKey is present in config or auth storage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/opencode/src/provider/provider.ts | Refactors custom provider loaders to use injected auth/config services via Effect instead of static facades. |
| packages/opencode/test/provider/provider.test.ts | Adds regression tests for opencode paid model filtering based on config apiKey or auth presence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Read enabled and disabled provider config after plugin hooks run so plugin config can affect provider filtering. Add a regression test for plugin-driven provider filters and fix the auth cleanup test so cleanup does not swallow assertion failures.
Co-authored-by: luanweslley77 <213105503+luanweslley77@users.noreply.github.com>
Summary
Auth.get(...)andConfig.get()facadesauthandconfigservices inside the provider layer and expose only tiny local Promise bridges where the loader contract still requires promisesopencodeprovider regression tests for config-key and auth-backed paid model loadingTesting