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): WebAuthFlow.provider field + lock auth radio after first load

cyh5f20a8176128
diff --git a/core/agent_auth_service.py b/core/agent_auth_service.py
index a8998a415..6e9efa197 100644
--- a/core/agent_auth_service.py
+++ b/core/agent_auth_service.py
@@ -252,7 +252,7 @@ WebFlowState = str # "starting" | "awaiting_code" | "verifying" | "success" | "
@dataclass
class WebAuthFlow:
flow_id: str
- backend: str # "claude" | "codex"
+ backend: str # "claude" | "codex" | "opencode"
state: WebFlowState = "starting"
process: asyncio.subprocess.Process | None = None
reader_task: asyncio.Task[None] | None = None
@@ -263,6 +263,12 @@ class WebAuthFlow:
awaiting_code: bool = False
error: str | None = None
last_status_text: str | None = None
+ # Per-provider context for OpenCode flows; ``None`` for Claude / Codex
+ # which authenticate at the backend level. Declared on the dataclass
+ # so ``api.py::start_oauth_web`` can serialise it unconditionally
+ # — accessing a runtime-assigned attribute on Claude/Codex flows
+ # would AttributeError out and 500 the start endpoint.
+ provider: str | None = None
created_at: float = field(default_factory=time.time)
diff --git a/ui/src/components/settings/SettingsClaudeProviderPage.tsx b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
index 9cdd5d2c3..b6c10356d 100644
--- a/ui/src/components/settings/SettingsClaudeProviderPage.tsx
+++ b/ui/src/components/settings/SettingsClaudeProviderPage.tsx
@@ -513,12 +513,16 @@ export const SettingsClaudeProviderPage: React.FC = () => {
void api
.getClaudeAuth()
.then((data) => {
+ // Refresh the underlying state (active badge,
+ // masked key, settings.json conflict warning)
+ // but DO NOT clobber ``authMode``. The radio
+ // tab is a *user-controlled* affordance after
+ // first load — re-syncing it from the server
+ // here would force a tab change every time
+ // OAuth completes / Sign out fires, even when
+ // the user wants to stay on the OAuth tab to
+ // re-authenticate.
setAuthState(data);
- 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 ca1d26691..87f27c17c 100644
--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx
+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx
@@ -278,12 +278,13 @@ export const SettingsCodexProviderPage: React.FC = () => {
void api
.getCodexAuth()
.then((data) => {
+ // Refresh underlying state but DO NOT clobber the
+ // radio tab — that's a user-controlled affordance
+ // after first load. Forcing a re-sync here would
+ // bounce the user back to whatever
+ // ``active_auth_mode`` reports every time OAuth
+ // completes / Sign out runs.
setState(data);
- setAuthMode(
- data.active_auth_mode !== 'none'
- ? data.active_auth_mode
- : data.auth_mode,
- );
setBaseUrl(data.base_url || '');
})
.catch(() => {