Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: preserve inherited credential checks (#4612)

[._.]/ Adam Eivy8a5f1fb24ca2
diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsx
index 7ad6cca0be..d9dbbb47c1 100644
--- a/client/src/pages/AIProviders.jsx
+++ b/client/src/pages/AIProviders.jsx
@@ -387,14 +387,6 @@ export default function AIProviders() {
if (!referenced) return false;
return typeof referenced.hasApiKey === 'boolean' ? referenced.hasApiKey : null;
},
- envVarSet: (name) => {
- if (!Object.hasOwn(provider.envVars || {}, name)) return null;
- const value = provider.envVars[name];
- // Secret values arrive as `***`; only an explicitly empty configured
- // value is a definite missing credential.
- if (value === '***' || typeof value !== 'string') return null;
- return value !== '';
- },
})]));
// The default provider floats to the top of whichever section it sits in, so
// "which one runs by default" stays a one-glance answer after grouping.
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 3faeaef8a7..a23cf4331b 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -1047,12 +1047,22 @@ const defaultEnvVarSet = (provider, name) => {
return value !== '';
};
+const inheritedCredentialMissing = (provider, keySetFor) => {
+ if (!isOrcaRouterBackedProvider(provider) || providerHasStoredKey(provider)) return null;
+ const rawState = typeof keySetFor === 'function'
+ ? keySetFor('orcarouter')
+ : defaultKeySetFor(provider, 'orcarouter');
+ return normalizeCredentialState(rawState) === false
+ ? { code: 'inheritedApiKey', label: 'OrcaRouter API provider has no API key' }
+ : null;
+};
+
const credentialMissing = (provider, { keySetFor = null, envVarSet = null } = {}) => {
const source = credentialSource(provider);
if (source.kind === 'none' || !source.ref) return null;
if (source.kind === 'env') {
- return credentialEnvVars(provider)
+ const missing = credentialEnvVars(provider)
.map((name) => {
const rawState = typeof envVarSet === 'function' ? envVarSet(name) : defaultEnvVarSet(provider, name);
return normalizeCredentialState(rawState) === false
@@ -1060,18 +1070,20 @@ const credentialMissing = (provider, { keySetFor = null, envVarSet = null } = {}
: null;
})
.filter(Boolean);
+ const inherited = inheritedCredentialMissing(provider, keySetFor);
+ if (inherited) missing.push(inherited);
+ return missing.length > 0 ? missing : null;
}
+ if (source.kind === 'inherited') {
+ return inheritedCredentialMissing(provider, keySetFor);
+ }
const rawState = typeof keySetFor === 'function'
? keySetFor(source.ref)
: defaultKeySetFor(provider, source.ref);
- if (normalizeCredentialState(rawState) !== false) return null;
-
- if (source.kind === 'stored') return { code: 'apiKey', label: 'API key is not set' };
- if (source.kind === 'inherited') {
- return { code: 'inheritedApiKey', label: 'OrcaRouter API provider has no API key' };
- }
- return { code: 'envVar', label: `${source.ref} environment variable is not set` };
+ return normalizeCredentialState(rawState) === false
+ ? { code: 'apiKey', label: 'API key is not set' }
+ : null;
};
/**
@@ -1117,10 +1129,9 @@ export const PROVIDER_CARD_STATE = Object.freeze({
* server/lib/providerPrerequisites.js, and `getFallbackProvider` skips a
* provider whose CLI that same computation found missing — so a card blocked on
* an uninstalled binary is no longer a routing candidate that dies at spawn
- * time on a raw ENOENT. (Routing acts only on that finding; a missing stored
- * key still shows here but stays presentation-only, because a provider can
- * authenticate through a secret env var — issue #4612, which also covers
- * DETECTING those env-var credentials so this stops over-reporting them.)
+ * time on a raw ENOENT. (Routing acts only on that finding; stored, inherited,
+ * and env-var credential findings stay presentation-only, and the browser now
+ * derives known env-var gaps without over-reporting redacted values.)
*
* This function consumes the published list and adds what the browser alone
* can see (the local-app runtime shape and sanitized env-credential state
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index 38937657d6..6d57318996 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -1341,6 +1341,18 @@ describe('providerCardState', () => {
});
});
+ it('keeps the inherited-key check when an Orca wrapper also has an env credential', () => {
+ const wrapper = cli({
+ id: 'opencode-orcarouter',
+ orcarouterBacked: true,
+ envVars: { OPENROUTER_API_KEY: 'token-example' },
+ });
+ expect(providerCardState(wrapper, { keySetFor: () => false }).missing).toEqual([{
+ code: 'inheritedApiKey',
+ label: 'OrcaRouter API provider has no API key',
+ }]);
+ });
+
it('blocks an env-credential provider whose configured value is empty, naming the variable', () => {
const readiness = providerCardState(cli({
id: 'claude-code-bedrock',