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.

feat(backends): surface Codex auth-mode uncertainty when keychain may hold creds

cyh5e0c1d182cb4
diff --git a/ui/src/components/settings/SettingsCodexProviderPage.tsx b/ui/src/components/settings/SettingsCodexProviderPage.tsx
index ff472e3f0..2650604e1 100644
--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx
+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx
@@ -176,7 +176,17 @@ export const SettingsCodexProviderPage: React.FC = () => {
{t('settings.backends.codexHasChatgptTokens')}
</p>
)}
- {authMode === 'api_key' && state && !state.file_store_active && (
+ {state?.auth_mode_uncertain && (
+ // Codex stores credentials in the OS keychain by default
+ // (``cli_auth_credentials_store=auto``). When there's no
+ // disk key/tokens we cannot tell whether the user is
+ // signed in via keychain or not — say so honestly rather
+ // than rendering "no key configured" with an oauth toggle.
+ <p className="text-[12px] text-gold">
+ {t('settings.backends.codexAuthModeUncertain', { store: state.credentials_store })}
+ </p>
+ )}
+ {authMode === 'api_key' && state && !state.file_store_active && !state.auth_mode_uncertain && (
// Codex's documented default is ``auto`` (keyring-preferred), so
// the API-key UX is honest about what saving will do: we pin
// ``cli_auth_credentials_store = "file"`` on save, otherwise
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 66c3fa081..0131bf957 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -122,6 +122,7 @@
"codexBaseUrlReset": "Reset to default",
"codexHasChatgptTokens": "Codex has cached ChatGPT credentials from a previous `codex login`.",
"codexCredentialsStoreKeyringWarn": "Codex is currently set to store credentials in the OS keychain ({{store}}). Saving here will switch it to file storage so Vibe Remote can manage the API key directly.",
+ "codexAuthModeUncertain": "Codex is set to store credentials in the OS keychain ({{store}}), so the current auth state cannot be read here. Choose a mode below and save — Vibe Remote will switch Codex to file storage so future reads stay accurate.",
"codexInfoHint": "Saving here writes `~/.codex/auth.json` and `~/.codex/config.toml`, then restarts the persistent app-server so the next request uses the new settings.",
"codexSave": "Save and restart Codex",
"codexSaving": "Saving…",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 0b6aeb2cb..0d9dc2020 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -122,6 +122,7 @@
"codexBaseUrlReset": "重置为默认",
"codexHasChatgptTokens": "检测到上一次 `codex login` 缓存的 ChatGPT 凭据。",
"codexCredentialsStoreKeyringWarn": "Codex 当前设置为把凭据存储在系统钥匙串中({{store}})。保存后将切换为文件存储,Vibe Remote 才能直接读写 API key。",
+ "codexAuthModeUncertain": "Codex 当前设置为把凭据存储在系统钥匙串中({{store}}),此处读不到登录状态。请在下方选择一种模式并保存——Vibe Remote 会将 Codex 切换为文件存储,后续读取就能保持准确。",
"codexInfoHint": "保存会写入 `~/.codex/auth.json` 与 `~/.codex/config.toml`,并重启常驻 app-server 以加载新配置。",
"codexSave": "保存并重启 Codex",
"codexSaving": "保存中…",
diff --git a/vibe/codex_config.py b/vibe/codex_config.py
index fe2c9c1ad..9082b1ace 100644
--- a/vibe/codex_config.py
+++ b/vibe/codex_config.py
@@ -385,6 +385,18 @@ def read_codex_auth_state(home: Path | None = None) -> Dict[str, Any]:
file_store_active = effective_store == CREDENTIALS_STORE_FILE
inferred_mode = "api_key" if isinstance(api_key, str) and api_key else "oauth"
+ # When Codex is configured to use the OS keychain (``auto`` /
+ # ``keyring``) and ``auth.json`` carries no key and no ChatGPT tokens,
+ # we genuinely cannot tell whether the user is in api_key mode (key
+ # in keychain) or oauth/not-signed-in. ``has_api_key`` is a file-only
+ # signal in that case; callers must treat ``auth_mode`` as a best
+ # guess rather than the truth and surface ``auth_mode_uncertain`` so
+ # the UI can say "we can't read your auth here" instead of "no key".
+ auth_mode_uncertain = (
+ not file_store_active
+ and not (isinstance(api_key, str) and api_key)
+ and not has_chatgpt_tokens
+ )
return {
"auth_mode": inferred_mode,
"has_api_key": isinstance(api_key, str) and bool(api_key),
@@ -393,4 +405,5 @@ def read_codex_auth_state(home: Path | None = None) -> Dict[str, Any]:
"has_chatgpt_tokens": has_chatgpt_tokens,
"credentials_store": effective_store,
"file_store_active": file_store_active,
+ "auth_mode_uncertain": auth_mode_uncertain,
}