fix(core): reuse models across credential switches - #49109
Closed
opencode-agent[bot] wants to merge 1 commit into
Closed
opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
Credential changes altered the provider snapshot even when the available provider definitions stayed identical. That forced every retained Location to rematerialize its full active model catalog. Reuse the snapshot when availability is unchanged, while preserving rebuilds for real provider and account-bound inventory changes.
6 tasks
Member
|
Superseded by #49255, which landed the same availability-keyed snapshot cache plus copy-on-write model materialization so a genuinely new provider is also cheap. Closing. from OpenCode |
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.
What changed
Provider snapshots now retain their identity when only the active credential changes and the available provider definitions remain identical. This prevents every retained Location from rebuilding and freezing its full active model catalog during
/connectaccount changes.Real provider availability changes and account-bound inventory changes still produce a new snapshot and rebuild models.
Performance
A focused 6,000-model credential-switch repro dropped from roughly 84 ms to 2.5 ms per Location.
Verification
bun test test/catalog.test.ts test/model-plugins.test.ts(27 passed)bun typecheckinpackages/corebun run lint -- packages/core/src/provider.ts packages/core/test/catalog.test.tsRequested by: @thdxr (dax via Slack)