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(claude): make auth switching authoritative (#1017)
Call White08e4ac1f1887
diff --git a/core/agent_auth_service.py b/core/agent_auth_service.pyindex fe699b5ff..e4a74ee35 100644--- a/core/agent_auth_service.py+++ b/core/agent_auth_service.py@@ -517,21 +517,19 @@ class AgentAuthService:Anthropic/Claude variable, then layer back only the allowed values soOAuth-mode filtering really deletes stale shell credentials."""- env_override = dict(os.environ)- for key in list(env_override.keys()):- if key.startswith("ANTHROPIC_") or key.startswith("CLAUDE_"):- env_override.pop(key, None)-- from vibe.claude_config import build_claude_subprocess_env+ from vibe.claude_config import (+ build_claude_subprocess_env,+ materialize_claude_subprocess_env,+ )- env_override.update(+ return materialize_claude_subprocess_env(build_claude_subprocess_env(self._resolve_backend_config("claude"),base_env=os.environ,force_oauth=force_oauth,- )+ ),+ base_env=os.environ,)- return env_overrideasync def _resolve_opencode_provider(self, context: MessageContext) -> str:override_agent = Nonediff --git a/tests/test_claude_subprocess_env.py b/tests/test_claude_subprocess_env.pyindex 4d7f005a7..034225abe 100644--- a/tests/test_claude_subprocess_env.py+++ b/tests/test_claude_subprocess_env.py@@ -38,7 +38,12 @@ def _empty_claude_home(tmp_path, monkeypatch) -> None:monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(claude_home))-def test_oauth_strips_inherited_api_key_and_auth_token() -> None:+def _sdk_effective_env(parent_env: dict[str, str], options_env: dict[str, str]) -> dict[str, str]:+ """Mirror the SDK subprocess merge that happens after our helper returns."""+ return {**parent_env, **options_env}+++def test_oauth_masks_inherited_api_key_auth_token_and_base_url() -> None:env = {"ANTHROPIC_API_KEY": "sk-leaked","ANTHROPIC_AUTH_TOKEN": "bearer-leaked",@@ -47,9 +52,10 @@ def test_oauth_strips_inherited_api_key_and_auth_token() -> None:"PATH": "/dropped",}out = build_claude_subprocess_env(_cfg(auth_mode="oauth", auth_mode_set=True), base_env=env)- assert "ANTHROPIC_API_KEY" not in out- assert "ANTHROPIC_AUTH_TOKEN" not in out- assert "ANTHROPIC_BASE_URL" not in out+ effective = _sdk_effective_env(env, out)+ assert effective["ANTHROPIC_API_KEY"] == ""+ assert effective["ANTHROPIC_AUTH_TOKEN"] == ""+ assert effective["ANTHROPIC_BASE_URL"] == ""# Non-credential CLAUDE_ vars and unrelated keys behave as before:# inherit only the namespaced ones, never PATH.assert out["CLAUDE_CONFIG_DIR"] == "/keep"@@ -85,9 +91,10 @@ def test_force_oauth_bypasses_api_key_mode_settings_and_config(force_oauth=True,)- assert "ANTHROPIC_API_KEY" not in out- assert "ANTHROPIC_AUTH_TOKEN" not in out- assert "ANTHROPIC_BASE_URL" not in out+ effective = _sdk_effective_env(env, out)+ assert effective["ANTHROPIC_API_KEY"] == ""+ assert effective["ANTHROPIC_AUTH_TOKEN"] == ""+ assert effective["ANTHROPIC_BASE_URL"] == ""assert out["CLAUDE_CONFIG_DIR"] == str(claude_home)@@ -140,7 +147,7 @@ def test_api_key_mode_injects_configured_key_and_drops_bearer(tmp_path, monkeypa# An explicit api_key + an inherited AUTH_TOKEN would let the SDK# pick the wrong Authorization header; the helper must drop the# token so the api_key wins unambiguously.- assert "ANTHROPIC_AUTH_TOKEN" not in out+ assert _sdk_effective_env(env, out)["ANTHROPIC_AUTH_TOKEN"] == ""def test_api_key_mode_preserves_settings_json_auth_token_semantics(@@ -154,14 +161,19 @@ def test_api_key_mode_preserves_settings_json_auth_token_semantics()monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(claude_home))+ parent_env = {+ "ANTHROPIC_API_KEY": "sk-shell-stale",+ "ANTHROPIC_BASE_URL": "https://shell-stale.example",+ }out = build_claude_subprocess_env(_cfg(auth_mode="api_key", api_key="", auth_mode_set=True),- base_env={"ANTHROPIC_API_KEY": "sk-shell-stale"},+ base_env=parent_env,)- assert "ANTHROPIC_API_KEY" not in out- assert out["ANTHROPIC_AUTH_TOKEN"] == "bearer-settings"- assert out["ANTHROPIC_BASE_URL"] == "https://relay.example"+ effective = _sdk_effective_env(parent_env, out)+ assert effective["ANTHROPIC_API_KEY"] == ""+ assert effective["ANTHROPIC_AUTH_TOKEN"] == "bearer-settings"+ assert effective["ANTHROPIC_BASE_URL"] == "https://relay.example"def test_api_key_mode_without_configured_key_keeps_inherited(tmp_path, monkeypatch) -> None:diff --git a/tests/test_settings_disk_fallback.py b/tests/test_settings_disk_fallback.pyindex 8ba5a3d4a..dd05c926f 100644--- a/tests/test_settings_disk_fallback.py+++ b/tests/test_settings_disk_fallback.py@@ -102,6 +102,18 @@ def _assert_claude_managed_env(env: dict) -> None:assert env["CLAUDE_CODE_ATTRIBUTION_HEADER"] == "0"+def claude_restart_calls(monkeypatch: pytest.MonkeyPatch) -> list[dict]:+ calls: list[dict] = []++ def restart_backend(name: str, *, metadata: dict | None = None) -> dict:+ calls.append({"name": name, "metadata": metadata})+ return {"ok": True, "message": "refreshed"}++ monkeypatch.setattr("vibe.api.restart_backend", restart_backend)+ return calls++def test_claude_oauth_state_reads_current_dot_credentials_file(tmp_path: Path) -> None:"""Claude Code 2.x writes OAuth tokens to ``.credentials.json`` on Linux.@@ -498,7 +510,9 @@ def test_claude_settings_json_takes_precedence_over_legacy_v2config(def test_save_claude_auth_writes_settings_json_and_clears_v2_secret(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ claude_restart_calls: list[dict],) -> None:monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / ".claude"))monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".vibe_remote"))@@ -549,10 +563,19 @@ def test_save_claude_auth_writes_settings_json_and_clears_v2_secret(assert state["api_key_source"] == "settings_json"assert state["base_url"] == "https://relay.example.invalid"assert cleanup_calls == [True]+ assert claude_restart_calls == [+ {+ "name": "claude",+ "metadata": {"reason": "save_claude_auth", "source": "ui_api"},+ }+ ]+ assert result["restart"]["ok"] is Truedef test_save_claude_auth_reports_partial_when_oauth_cleanup_fails(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ claude_restart_calls: list[dict],) -> None:monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / ".claude"))monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".vibe_remote"))@@ -598,7 +621,9 @@ def test_save_claude_auth_reports_partial_when_oauth_cleanup_fails(def test_save_claude_auth_restores_pending_oauth_backup_before_writing_new_key(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ claude_restart_calls: list[dict],) -> None:monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / ".claude"))monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".vibe_remote"))@@ -650,7 +675,9 @@ def test_save_claude_auth_restores_pending_oauth_backup_before_writing_new_key(def test_save_claude_auth_keeps_settings_token_over_legacy_v2_key(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ claude_restart_calls: list[dict],) -> None:monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / ".claude"))monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".vibe_remote"))@@ -694,6 +721,64 @@ def test_save_claude_auth_keeps_settings_token_over_legacy_v2_key(_assert_claude_managed_env(settings["env"])+def test_remove_claude_api_key_refreshes_cached_runtime(+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ claude_restart_calls: list[dict],+) -> None:+ monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / ".claude"))+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".vibe_remote"))+ monkeypatch.setattr("config.paths._home", lambda: tmp_path, raising=False)+ _write_claude_settings(+ tmp_path,+ {+ "ANTHROPIC_API_KEY": "sk-stale",+ "ANTHROPIC_BASE_URL": "https://stale-relay.example.invalid",+ },+ )++ from config.v2_config import AgentsConfig, RuntimeConfig, SlackConfig, V2Config+ from vibe.api import remove_backend_api_key+ from vibe.claude_config import read_claude_settings_env++ config = V2Config(+ mode="self_host",+ version="v2",+ slack=SlackConfig(bot_token=""),+ runtime=RuntimeConfig(default_cwd="."),+ agents=AgentsConfig(),+ )+ config.agents.claude.auth_mode = "api_key"+ config.agents.claude.auth_mode_set = True+ config.save()++ result = remove_backend_api_key("claude")++ assert result["ok"] is True+ assert result["restart"]["ok"] is True+ assert claude_restart_calls == [+ {+ "name": "claude",+ "metadata": {"reason": "remove_api_key", "source": "ui_api"},+ }+ ]+ assert read_claude_settings_env() == {}+ saved = V2Config.load()+ assert saved.agents.claude.auth_mode == "oauth"+ assert saved.agents.claude.auth_mode_set is True++ monkeypatch.setattr(+ "vibe.api.restart_backend",+ lambda _name, **_kwargs: {"ok": False, "message": "controller unavailable"},+ )+ retry = remove_backend_api_key("claude")+ assert retry["ok"] is True+ assert retry["restart"] == {+ "ok": False,+ "message": "controller unavailable",+ }++def test_apply_claude_auth_oauth_removes_auth_env_but_keeps_managed_defaults(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:diff --git a/ui/src/components/settings/providers/ClaudeProviderConfig.tsx b/ui/src/components/settings/providers/ClaudeProviderConfig.tsxindex a134cc3fd..a7e5b7874 100644--- a/ui/src/components/settings/providers/ClaudeProviderConfig.tsx+++ b/ui/src/components/settings/providers/ClaudeProviderConfig.tsx@@ -122,9 +122,8 @@ export const ClaudeProviderConfig: React.FC<{: t('settings.backends.claudeApiKeyMissing');const onRemoveApiKey = async () => {- // Drop just the API key from V2Config; leaves Claude Code's own OAuth- // token store alone. Lets the user clear a stale key without having to- // also re-do OAuth.+ // Drop just the API key from Claude Code settings; leave its OAuth token+ // store alone. Lets the user clear a stale key without redoing OAuth.const confirmed = window.confirm(t('settings.backends.claudeApiKeyRemoveConfirm') as string,);@@ -147,7 +146,16 @@ export const ClaudeProviderConfig: React.FC<{setSavedBaseUrl(fresh.base_url || '');setApiKey('');setEditingKey(false);- showToast(t('settings.backends.claudeApiKeyRemoved'), 'success');+ if (result.restart?.ok === false) {+ showToast(+ result.restart.message || t('settings.backends.claudeApiKeyRemoveFailed', {+ detail: 'runtime refresh failed',+ }),+ 'warning',+ );+ } else {+ showToast(t('settings.backends.claudeApiKeyRemoved'), 'success');+ }} catch (err: any) {showToast(t('settings.backends.claudeApiKeyRemoveFailed', { detail: err?.message || 'unknown' }),@@ -183,17 +191,15 @@ export const ClaudeProviderConfig: React.FC<{setSavedBaseUrl(nextBase);setApiKey('');setEditingKey(false);- // Claude restart is synthetic (one-shot CLI) so result.restart.ok- // is always true; treat any falsy state defensively just in case.- if (result.partial) {+ if (result.restart?.ok === false) {+ showToast(result.restart.message || t('settings.backends.claudeSaveSuccess'), 'warning');+ } else if (result.partial) {showToast(t('settings.backends.claudeSavePartial', {detail: result.detail || result.warning || 'oauth_cleanup_failed',}),'warning',);- } else if (result.restart?.ok === false) {- showToast(result.restart.message || t('settings.backends.claudeSaveSuccess'), 'warning');} else {showToast(t('settings.backends.claudeSaveSuccess'), 'success');}diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex 768b2db4f..9743d6d71 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -475,9 +475,8 @@ export type ApiContextType = {removeClaudeOAuthCredentials: () => Promise<OAuthWebMutationResult>;// Selectively clear just the stored API key — leave OAuth credentials// intact. Symmetric to OpenCode's per-provider DELETE: lets the user- // drop a stale key without re-signing in. Codex also restarts its- // persistent daemon so the cleared key takes effect on the next- // request.+ // drop a stale key without re-signing in. The backend runtime is+ // refreshed so cached sessions observe the change on the next request.removeBackendApiKey: (backend: 'claude' | 'codex') => Promise<OAuthWebMutationResult>;testBackendAuth: (backend: 'claude' | 'codex',@@ -1650,6 +1649,7 @@ export type OAuthWebMutationResult = {error?: string;detail?: string;notices?: BackendNotice[];+ restart?: BackendRestartResult;// ``partial: true`` rides on ``ok: true`` when the V2Config side of// the operation succeeded but the CLI subprocess (``codex logout`` /// ``claude auth logout``) reported a non-zero exit. The caller shoulddiff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex e3eb594b3..b5f33cf37 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -398,10 +398,10 @@"claudeBaseUrlReset": "Reset to default","claudeSettingsConflictTitle": "Legacy Avibe key will be migrated","claudeSettingsConflictBody": "Saving updates `{{var}}` in {{path}} and clears the old Avibe copy.",- "claudeInfoHint": "Saving here writes Claude Code's `settings.json` env values. Claude relaunches per request, so no Avibe restart is needed.",- "claudeSave": "Save Claude auth",+ "claudeInfoHint": "Saving writes Claude Code's `settings.json` env values and refreshes Avibe's cached Claude sessions. The next request uses the selected authentication mode.",+ "claudeSave": "Save and refresh Claude","claudeSaving": "Saving…",- "claudeSaveSuccess": "Claude auth saved",+ "claudeSaveSuccess": "Claude auth saved and runtime refreshed","claudeSaveFailed": "Could not save Claude auth","claudeSavePartial": "API key saved, but old Claude account credentials were not fully cleared: {{detail}}","oauthAuthUrlLabel": "Authorization URL",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 0425d103a..cd8d9b68b 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -398,10 +398,10 @@"claudeBaseUrlReset": "恢复默认","claudeSettingsConflictTitle": "旧的 Avibe Key 将被迁移","claudeSettingsConflictBody": "保存会更新 {{path}} 里的 `{{var}}`,并清除旧的 Avibe 副本。",- "claudeInfoHint": "保存后会写入 Claude Code 的 `settings.json` env 配置。Claude 每次请求独立启动,无需重启 Avibe。",- "claudeSave": "保存 Claude 认证",+ "claudeInfoHint": "保存会写入 Claude Code 的 `settings.json` env 配置,并刷新 Avibe 缓存的 Claude 会话。下一次请求会使用所选认证方式。",+ "claudeSave": "保存并刷新 Claude","claudeSaving": "保存中…",- "claudeSaveSuccess": "Claude 认证已保存",+ "claudeSaveSuccess": "Claude 认证已保存,运行时已刷新","claudeSaveFailed": "保存 Claude 认证失败","claudeSavePartial": "API Key 已保存,但旧 Claude 账号凭据未清理干净:{{detail}}","oauthAuthUrlLabel": "授权链接",diff --git a/vibe/api.py b/vibe/api.pyindex 704982a3e..d4b54105f 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -8376,12 +8376,9 @@ def _resolve_claude_status_probe_cwd(config: Any | None) -> str | None:def _build_claude_status_probe_env(claude_env: dict[str, str] | None) -> dict[str, str] | None:if claude_env is None:return None- env = dict(os.environ)- for key in list(env):- if key.startswith("ANTHROPIC_") or key.startswith("CLAUDE_"):- env.pop(key, None)- env.update(claude_env)- return env+ from vibe.claude_config import materialize_claude_subprocess_env++ return materialize_claude_subprocess_env(claude_env)# ---------------------------------------------------------------------------@@ -8675,23 +8672,17 @@ def remove_backend_api_key(backend: str) -> dict:except Exception as exc: # noqa: BLE001logger.warning("V2Config clear during remove-key failed for %s: %s", backend, exc)- # Codex has a persistent daemon — refresh it so the cleared key- # actually takes effect on the next request. Claude is one-shot per- # request so a synthetic restart is enough.- restart: dict- if backend == "codex":- try:- restart = restart_backend(- "codex",- metadata={"reason": "remove_api_key", "source": "ui_api"},- )- except Exception as exc: # noqa: BLE001- restart = {"ok": False, "message": str(exc)}- else:- restart = {- "ok": True,- "message": "Claude relaunches per request; the next message uses the new auth.",- }+ # Both backends keep runtime state in the controller. Codex owns a+ # persistent app-server; Claude owns cached SDK sessions and a loaded+ # compat config. Refresh through the same controller path so the next+ # request observes the new auth without restarting the Avibe service.+ try:+ restart = restart_backend(+ backend,+ metadata={"reason": "remove_api_key", "source": "ui_api"},+ )+ except Exception as exc: # noqa: BLE001+ restart = {"ok": False, "message": str(exc)}response: dict = {"ok": True, "restart": restart}if notices:response["notices"] = notices@@ -9233,14 +9224,19 @@ def save_claude_auth(payload: dict) -> dict:"detail": str(exc),}- # Claude is one-shot per request — no daemon to restart. Return a- # synthetic restart result so the UI handles the same response shape- # as Codex / OpenCode and the toast wording can stay consistent.+ # Claude SDK clients are cached by the controller. Roll them through+ # the existing backend refresh path so the next turn cannot retain the+ # previous mode's environment or loaded compatibility config.+ try:+ restart = restart_backend(+ "claude",+ metadata={"reason": "save_claude_auth", "source": "ui_api"},+ )+ except Exception as exc: # noqa: BLE001+ restart = {"ok": False, "message": str(exc)}+state = get_claude_auth()- state["restart"] = {- "ok": True,- "message": "Claude relaunches per request; the next message uses the new auth.",- }+ state["restart"] = restartif isinstance(oauth_cleanup_result, dict) and oauth_cleanup_result.get("partial"):state["partial"] = Truestate["warning"] = oauth_cleanup_result.get("warning") or "oauth_cleanup_failed"diff --git a/vibe/claude_config.py b/vibe/claude_config.pyindex a9a4d43f4..5b4d67f9b 100644--- a/vibe/claude_config.py+++ b/vibe/claude_config.py@@ -50,6 +50,31 @@ RELEVANT_ENV_KEYS = (OAUTH_SETTINGS_ENV_BACKUP_NAME = ".avibe-oauth-settings-env-backup.json"+def materialize_claude_subprocess_env(+ claude_env: Dict[str, str],+ base_env: Optional[Dict[str, str]] = None,+) -> Dict[str, str]:+ """Build a complete env for direct Claude CLI subprocesses.++ SDK clients need blank auth values as tombstones because the SDK merges+ their options over ``os.environ``. Direct subprocess calls can remove+ inherited Claude variables themselves, so their final environment should+ omit those tombstones while preserving unrelated process variables.+ """+ env = dict(base_env if base_env is not None else os.environ)+ for key in list(env):+ if key.startswith("ANTHROPIC_") or key.startswith("CLAUDE_"):+ env.pop(key, None)+ env.update(+ {+ key: value+ for key, value in claude_env.items()+ if key not in RELEVANT_ENV_KEYS or value != ""+ }+ )+ return env++def get_claude_home(home: Path | None = None) -> Path:"""Resolve the directory Claude Code reads ``settings.json`` from.@@ -478,7 +503,7 @@ def build_claude_subprocess_env(if auth_mode == "oauth":if auth_mode_set or force_oauth:# Explicit OAuth pick from the UI, OR a caller that knows- # it IS the OAuth setup flow. Strip every inherited+ # it IS the OAuth setup flow. Mask every inherited# Anthropic credential header: an ambient# ``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` would# suppress Claude Code's OAuth credential store, and an ambient@@ -486,24 +511,30 @@ def build_claude_subprocess_env(# the shell) would route OAuth traffic through an# api-key-only gateway. Both leaks have to be plugged for# the "OAuth in Settings" promise to mean anything.- claude_env.pop("ANTHROPIC_API_KEY", None)- claude_env.pop("ANTHROPIC_AUTH_TOKEN", None)- claude_env.pop("ANTHROPIC_BASE_URL", None)+ #+ # Empty-string overrides are intentional. The Claude Agent+ # SDK builds the final subprocess environment by merging+ # ``options.env`` over ``os.environ``. Omitting a key here+ # would therefore resurrect the parent value at launch.+ for key in RELEVANT_ENV_KEYS:+ claude_env[key] = ""# else: legacy install — preserve inherited env vars verbatim.elif auth_mode == "api_key":if auth_mode_set:- claude_env.pop("ANTHROPIC_API_KEY", None)- claude_env.pop("ANTHROPIC_AUTH_TOKEN", None)- claude_env.pop("ANTHROPIC_BASE_URL", None)+ # Start from a fully masked auth environment so switching+ # between API-key header variants or clearing a custom base+ # URL cannot leak a stale parent value back through the SDK.+ for key in RELEVANT_ENV_KEYS:+ claude_env[key] = ""if settings_api_key:claude_env["ANTHROPIC_API_KEY"] = settings_api_key- claude_env.pop("ANTHROPIC_AUTH_TOKEN", None)+ claude_env["ANTHROPIC_AUTH_TOKEN"] = ""elif settings_auth_token:claude_env["ANTHROPIC_AUTH_TOKEN"] = settings_auth_token- claude_env.pop("ANTHROPIC_API_KEY", None)+ claude_env["ANTHROPIC_API_KEY"] = ""elif configured_key_raw:claude_env["ANTHROPIC_API_KEY"] = configured_key_raw- claude_env.pop("ANTHROPIC_AUTH_TOKEN", None)+ claude_env["ANTHROPIC_AUTH_TOKEN"] = ""effective_base = settings_base or configured_baseif effective_base and auth_mode != "oauth":diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex d4d04e45e..11500b982 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -5376,11 +5376,11 @@ def backend_claude_auth_get():@app.route("/api/backend/claude/auth", methods=["POST"])def backend_claude_auth_post():- """Persist Claude auth into V2Config.+ """Persist Claude auth and refresh cached Claude SDK sessions.Body: ``{auth_mode: 'oauth'|'api_key', api_key?: string, base_url?: string}``.- Claude relaunches per request, so no daemon restart is necessary —- the next user message picks up the new env injection automatically.+ Secrets live in Claude Code's own settings; V2Config records the selected+ mode, and the controller rolls its Claude runtime state after the write."""from vibe import api