Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

fix(backends): default auth-mode tab to the live-effective source

cyhb32810d78e74
diff --git a/ui/src/components/settings/SettingsClaudeProviderPage.tsx b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
index 18f7ea1af..3a5234887 100644
--- a/ui/src/components/settings/SettingsClaudeProviderPage.tsx
+++ b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
@@ -136,7 +136,11 @@ export const SettingsClaudeProviderPage: React.FC = () => {
.then((data) => {
if (cancelled) return;
setAuthState(data);
- setAuthMode(data.auth_mode);
+ // Prefer the live-effective tab. V2Config defaults to ``"oauth"``
+ // even when settings.json carries the actual key, so reading
+ // ``auth_mode`` alone would land the user on the wrong tab. Fall
+ // back to V2Config only when nothing on disk is configured.
+ setAuthMode(data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode);
setBaseUrl(data.base_url || '');
// The masked preview lives in ``authState.api_key_masked``;
// ``apiKey`` stays empty until the user clicks "Replace".
@@ -495,7 +499,11 @@ export const SettingsClaudeProviderPage: React.FC = () => {
.getClaudeAuth()
.then((data) => {
setAuthState(data);
- setAuthMode(data.auth_mode);
+ setAuthMode(
+ data.active_auth_mode !== 'none'
+ ? data.active_auth_mode
+ : data.auth_mode,
+ );
setBaseUrl(data.base_url || '');
})
.catch(() => {
diff --git a/ui/src/components/settings/SettingsCodexProviderPage.tsx b/ui/src/components/settings/SettingsCodexProviderPage.tsx
index 4c2ca01ae..250577dda 100644
--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx
+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx
@@ -76,7 +76,16 @@ export const SettingsCodexProviderPage: React.FC = () => {
.then((data) => {
if (cancelled) return;
setState(data);
- setAuthMode(data.auth_mode);
+ // Default the radio to whichever auth source the running CLI is
+ // *actually* using (``active_auth_mode``). V2Config's
+ // ``auth_mode`` defaults to ``"oauth"`` on fresh installs, which
+ // would otherwise force the OAuth tab even when the user has a
+ // working API key on disk (e.g. they pre-configured ``auth.json``
+ // by hand, or a prior Sign out wiped V2Config but the relay
+ // config in ``config.toml`` still points at a custom endpoint).
+ // ``active_auth_mode === "none"`` means we have nothing on disk
+ // either, so honour V2Config's saved intent in that fallback case.
+ setAuthMode(data.active_auth_mode !== 'none' ? data.active_auth_mode : data.auth_mode);
setBaseUrl(data.base_url || '');
// Empty + read-only input + masked preview rendered separately
// (see below) reflects the saved state without leaking plaintext.
@@ -239,7 +248,11 @@ export const SettingsCodexProviderPage: React.FC = () => {
.getCodexAuth()
.then((data) => {
setState(data);
- setAuthMode(data.auth_mode);
+ setAuthMode(
+ data.active_auth_mode !== 'none'
+ ? data.active_auth_mode
+ : data.auth_mode,
+ );
setBaseUrl(data.base_url || '');
})
.catch(() => {