fix(agents): preserve explicit Ollama local auth marker

This commit is contained in:
Peter Steinberger
2026-04-27 12:00:41 +01:00
parent 9dd01b5e49
commit a3144b6bfd
3 changed files with 6 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ const AWS_SDK_ENV_MARKERS = new Set([
]);
const CORE_NON_SECRET_API_KEY_MARKERS = [
CUSTOM_LOCAL_AUTH_MARKER,
OLLAMA_LOCAL_AUTH_MARKER,
NON_ENV_SECRETREF_MARKER,
] as const;
let knownEnvApiKeyMarkersCache: Set<string> | undefined;

View File

@@ -918,7 +918,7 @@ describe("resolveApiKeyForProvider synthetic local auth for custom providers
expect(auth).toMatchObject({
apiKey: "ollama-local",
source: "models.providers.ollama-remote (synthetic local key)",
source: "models.json (local marker)",
mode: "api-key",
});
});

View File

@@ -179,7 +179,10 @@ export function resolveUsableCustomProviderApiKey(params: {
customProviderConfig.baseUrl &&
isLocalBaseUrl(customProviderConfig.baseUrl)
) {
return { apiKey: CUSTOM_LOCAL_AUTH_MARKER, source: "models.json (local marker)" };
return {
apiKey: customProviderConfig.api === "ollama" ? customKey : CUSTOM_LOCAL_AUTH_MARKER,
source: "models.json (local marker)",
};
}
return null;
}