perf: speed up model switcher credential discovery#3673
Merged
Conversation
Opening the model picker checked every provider credential sequentially. Missing environment variables fall through the secret-provider chain and can spawn a macOS Keychain lookup for each key, causing a multi-second delay before the model picker opened. Deduplicate credential names and resolve the independent lookups concurrently before filtering catalog providers. This preserves the existing provider availability checks while substantially reducing model-picker latency. Signed-off-by: Djordje Lukic <[email protected]>
rumpl
enabled auto-merge
July 15, 2026 21:44
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The concurrent credential pre-fetch is implemented correctly. The lookupEnvironmentValues helper properly deduplicates names before spawning goroutines, uses a thread-safe concurrent.Map for writes, and drains all goroutines via wg.Wait() before the result map is built. No data races, goroutine leaks, or correctness issues were found in the new code.
Reviewed: pkg/runtime/model_switcher.go — concurrent credential discovery refactor
dgageot
approved these changes
Jul 16, 2026
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.
Opening the model picker checked every provider credential sequentially. Missing environment variables fall through the secret-provider chain and can spawn a macOS Keychain lookup for each key, causing a multi-second delay before the model picker opened.
Deduplicate credential names and resolve the independent lookups concurrently before filtering catalog providers. This preserves the existing provider availability checks while substantially reducing model-picker latency.
On my machine this went from ~3 second for the model switcher to open to about <1s, it's still not great but not sure what else we can do