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): surface real Codex device-flow error; allow base-URL-only OpenCode saves from the FE

cyhd3d01212e6b2
diff --git a/core/agent_auth_service.py b/core/agent_auth_service.py
index 1c7710ac8..c1a7bc16c 100644
--- a/core/agent_auth_service.py
+++ b/core/agent_auth_service.py
@@ -2259,6 +2259,24 @@ class AgentAuthService:
await flow.reader_task
except asyncio.CancelledError:
pass
+ # If the login process emitted an explicit error line before
+ # exiting (e.g. ``Error logging in with device code: device
+ # code request failed with status 403 Forbidden`` when
+ # ``auth.openai.com`` rate-limits or blocks the request),
+ # surface THAT instead of falling through to
+ # ``_verify_web_login`` — the verify probe runs ``codex login
+ # status``, which reports "Not logged in" after every failed
+ # login attempt, masking the real cause. The reader writes
+ # each non-empty stdout line into ``last_status_text``;
+ # checking for the ``error``-prefix on that line catches the
+ # device-flow failure modes Codex CLI emits before exit.
+ last_line = (flow.last_status_text or "").strip()
+ if last_line:
+ lowered = last_line.lower()
+ if lowered.startswith("error") or "failed with status" in lowered:
+ flow.state = "failed"
+ flow.error = last_line[:400]
+ return
flow.state = "verifying"
ok, detail = await self._verify_web_login(flow.backend)
if ok:
diff --git a/ui/src/components/settings/SettingsOpencodeProviderPage.tsx b/ui/src/components/settings/SettingsOpencodeProviderPage.tsx
index 83d6bcd2d..c5e84604d 100644
--- a/ui/src/components/settings/SettingsOpencodeProviderPage.tsx
+++ b/ui/src/components/settings/SettingsOpencodeProviderPage.tsx
@@ -404,7 +404,13 @@ export const SettingsOpencodeProviderPage: React.FC = () => {
const onSaveProviderAuth = async (provider: OpencodeProvider) => {
const state = editByProvider[provider.id] || emptyEdit();
const key = state.apiKey.trim();
- if (!key) {
+ // Reject an empty key only when the provider has no saved
+ // credentials. For already-configured providers the UI hides the
+ // plaintext key behind a "Replace" pencil; the backend save
+ // endpoint reuses the on-disk key in that case so a base-URL-only
+ // edit can land without re-typing the secret. Without this branch
+ // a user with a saved key can never persist a relay-URL fix.
+ if (!key && !provider.configured) {
updateEdit(provider.id, {
error: t('settings.backends.opencodeProviderApiKeyRequired') as string,
});