Skip to content

fix(config-health): recognize per-label custom provider API keys - #851

Open
365diascollaboration-prog wants to merge 1 commit into
fathah:mainfrom
365diascollaboration-prog:fix/config-health-custom-provider-key
Open

fix(config-health): recognize per-label custom provider API keys#851
365diascollaboration-prog wants to merge 1 commit into
fathah:mainfrom
365diascollaboration-prog:fix/config-health-custom-provider-key

Conversation

@365diascollaboration-prog

Copy link
Copy Markdown
Contributor

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

hermes-desktop@0.7.3 typecheck:node
tsc --noEmit -p tsconfig.node.json --composite false.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR teaches config health to recognize per-label custom provider keys. The main changes are:

  • Adds model-row lookup inside customEndpointKeyResolvable.
  • Adds CUSTOM_PROVIDER_<NAME>_KEY candidates for matching custom provider labels.
  • Refreshes package lock metadata and the lockfile package version.

Confidence Score: 4/5

The per-label custom provider check can still miss valid keys for equivalent URL strings.

  • The changed config path handles the intended env var shape.
  • Raw URL equality can skip the new candidate when stored custom endpoint strings differ by trailing slash or casing.
  • The lockfile changes look contained for the normal install path.

src/main/config.ts

Important Files Changed

Filename Overview
src/main/config.ts Adds per-label custom provider env vars to config-health key detection, but the new URL match uses raw string equality.
package-lock.json Updates the lockfile package version and npm metadata without changing resolved packages.

Reviews (1): Last reviewed commit: "fix(config-health): include per-label cu..." | Re-trigger Greptile

Comment thread src/main/config.ts
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));
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant