fix(config-health): recognize per-label custom provider API keys - #851
Open
365diascollaboration-prog wants to merge 1 commit into
Open
Conversation
…ndpointKeyResolvable
Contributor
Greptile SummaryThis PR teaches config health to recognize per-label custom provider keys. The main changes are:
Confidence Score: 4/5The per-label custom provider check can still miss valid keys for equivalent URL strings.
src/main/config.ts Important Files Changed
Reviews (1): Last reviewed commit: "fix(config-health): include per-label cu..." | Re-trigger Greptile |
Comment on lines
+786
to
+790
| for (const row of modelRows) { | ||
| if (row.provider === "custom" && (row.baseUrl || "") === baseUrl && row.providerLabel) { | ||
| candidates.add(customProviderEnvKey(row.providerLabel)); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Raw Base URL Match Misses Keys
When the selected custom endpoint and the model row store the same URL with different formatting, such as https://api.example.com/v1/ versus https://api.example.com/v1, this equality check skips the per-label env var. A user whose only credential is CUSTOM_PROVIDER_<LABEL>_KEY can still get missing-key readiness or health warnings for a configured provider.
Suggested change
| for (const row of modelRows) { | |
| if (row.provider === "custom" && (row.baseUrl || "") === baseUrl && row.providerLabel) { | |
| candidates.add(customProviderEnvKey(row.providerLabel)); | |
| } | |
| } | |
| const normalizeBaseUrl = (u: string): string => | |
| (u || "").trim().replace(/\/+$/, "").toLowerCase(); | |
| const targetBaseUrl = normalizeBaseUrl(baseUrl); | |
| for (const row of modelRows) { | |
| if ( | |
| row.provider === "custom" && | |
| normalizeBaseUrl(row.baseUrl || "") === targetBaseUrl && | |
| row.providerLabel | |
| ) { | |
| candidates.add(customProviderEnvKey(row.providerLabel)); | |
| } | |
| } |
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.
Problem\nAfter the provider-owned-models refactor (#848), named custom providers store their API key under . The config-health audit and pre-send readiness check still only look at URL-specific keys, , and , so a correctly configured custom provider can be flagged as missing a key.\n\n## Fix\nUpdate in to also collect env vars from rows whose and matches the configured base URL.\n\n## Scope\n- Minimal change on top of current main.\n- Does not alter the runtime key-resolution chain in .\n- Type-checked with