Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): only report OpenCode OAuth sign-in for stored OAuth auth (#1440)
Call White1a99b1d1fe7a
diff --git a/ui/src/components/settings/providers/OpencodeProviderConfig.test.tsx b/ui/src/components/settings/providers/OpencodeProviderConfig.test.tsxnew file mode 100644index 000000000..d20b12cf3--- /dev/null+++ b/ui/src/components/settings/providers/OpencodeProviderConfig.test.tsx@@ -0,0 +1,67 @@+import { describe, expect, it } from 'vitest';++import type { OpencodeProvider } from '@/context/ApiContext';++import { providerOauthSignedIn } from './opencodeProviderAuth';++const baseProvider: OpencodeProvider = {+ id: 'openai',+ name: 'OpenAI',+ description: '',+ configured: false,+ oauth_available: true,+ local: false,+ models: [],+ default_model: null,+};++describe('providerOauthSignedIn', () => {+ // Regression: an API-key save marks the provider ``configured``, and the+ // in-card OAuth panel used to render "OAuth credentials stored" off that+ // flag alone. The panel must only report signed-in for a stored OAuth+ // entry — property: signed-in follows the active auth type, never the+ // configured badge.+ it('is false for a provider configured with an API key', () => {+ expect(+ providerOauthSignedIn({+ ...baseProvider,+ configured: true,+ has_auth: true,+ active_auth_type: 'api',+ api_key_masked: 'sk-9d68•••8819',+ }),+ ).toBe(false);+ });++ it('is true only while the active auth type is oauth', () => {+ expect(+ providerOauthSignedIn({+ ...baseProvider,+ configured: true,+ has_auth: true,+ active_auth_type: 'oauth',+ }),+ ).toBe(true);+ });++ it('is false when no auth type is reported (unconfigured, local, or custom)', () => {+ expect(providerOauthSignedIn({ ...baseProvider })).toBe(false);+ expect(+ providerOauthSignedIn({+ ...baseProvider,+ configured: true,+ local: true,+ oauth_available: false,+ }),+ ).toBe(false);+ expect(+ providerOauthSignedIn({+ ...baseProvider,+ configured: true,+ custom: true,+ oauth_available: false,+ active_auth_type: null,+ }),+ ).toBe(false);+ });+});diff --git a/ui/src/components/settings/providers/OpencodeProviderConfig.tsx b/ui/src/components/settings/providers/OpencodeProviderConfig.tsxindex e0d08c77f..39280795d 100644--- a/ui/src/components/settings/providers/OpencodeProviderConfig.tsx+++ b/ui/src/components/settings/providers/OpencodeProviderConfig.tsx@@ -37,6 +37,7 @@ import { useModelHubCapability } from '../models/useModelHubCapability';import { OpencodePermissionSetup } from '../shared/OpencodePermissionSetup';import { useBackendRuntime } from '../shared/useBackendRuntime';import { useOpencodePermission } from '../shared/useOpencodePermission';+import { providerOauthSignedIn } from './opencodeProviderAuth';import { useApi } from '@/context/ApiContext';import type {OpencodeMutationResult,@@ -1354,7 +1355,7 @@ export const OpencodeProviderConfig: React.FC<{<BackendOAuthPanelbackend="opencode"opencodeProviderId={provider.id}- signedIn={provider.configured}+ signedIn={providerOauthSignedIn(provider)}title={t('settings.backends.opencodeProviderOauthPanelTitle', {name: provider.name,})}diff --git a/ui/src/components/settings/providers/opencodeProviderAuth.ts b/ui/src/components/settings/providers/opencodeProviderAuth.tsnew file mode 100644index 000000000..1b9d67d9f--- /dev/null+++ b/ui/src/components/settings/providers/opencodeProviderAuth.ts@@ -0,0 +1,8 @@+import type { OpencodeProvider } from '@/context/ApiContext';++// The in-card OAuth panel must only report "signed in" when OpenCode's+// auth store actually holds an OAuth entry for the provider. ``configured``+// alone is true for API-key saves too, which used to render "OAuth+// credentials stored" over a plain API-key setup.+export const providerOauthSignedIn = (provider: OpencodeProvider): boolean =>+ provider.active_auth_type === 'oauth';