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(backends): guard authMode at the setter so iOS Safari can't smuggle a flip
cyh8f090a146b26
diff --git a/ui/src/components/settings/SettingsClaudeProviderPage.tsx b/ui/src/components/settings/SettingsClaudeProviderPage.tsxindex 9ea2333a7..db5392607 100644--- a/ui/src/components/settings/SettingsClaudeProviderPage.tsx+++ b/ui/src/components/settings/SettingsClaudeProviderPage.tsx@@ -124,8 +124,29 @@ export const SettingsClaudeProviderPage: React.FC = () => {const [savedBaseUrl, setSavedBaseUrl] = useState('');// Freeze the auth-mode segmented radio while the OAuth panel is mid-// handshake. Same iOS Safari issue as the Codex page: a Copy tap- // can bounce the radio and tear down the in-flight login.+ // can bounce the radio and tear down the in-flight login. The+ // ``disabled`` HTML attribute alone isn't enough — the user has+ // reproduced the flip with the radio rendered disabled, so we+ // also guard at the setter (the radio click cannot win even if+ // iOS smuggles the event through whatever quirky path).const [oauthFlowActive, setOauthFlowActive] = useState(false);+ const oauthFlowActiveRef = React.useRef(oauthFlowActive);+ oauthFlowActiveRef.current = oauthFlowActive;+ const guardedSetAuthMode = React.useCallback(+ (next: ClaudeAuthMode) => {+ if (oauthFlowActiveRef.current) {+ // eslint-disable-next-line no-console+ console.warn(+ '[claude-auth-mode] rejected change to %s while OAuth flow active',+ next,+ );+ showToast(t('settings.backends.oauthFlowLockedToast'), 'warning');+ return;+ }+ setAuthMode(next);+ },+ [showToast, t],+ );useEffect(() => {let cancelled = false;@@ -534,7 +555,7 @@ export const SettingsClaudeProviderPage: React.FC = () => {</div><SegmentedRadiovalue={authMode}- onChange={setAuthMode}+ onChange={guardedSetAuthMode}options={modeOptions}ariaLabel={t('settings.backends.claudeAuthModeLabel') as string}disabled={oauthFlowActive}diff --git a/ui/src/components/settings/SettingsCodexProviderPage.tsx b/ui/src/components/settings/SettingsCodexProviderPage.tsxindex f1180f793..ec73ac4a2 100644--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx@@ -87,6 +87,35 @@ export const SettingsCodexProviderPage: React.FC = () => {// accidental tap (iOS Safari emits one after the "Copy" tap in// testing) tears down the in-progress login.const [oauthFlowActive, setOauthFlowActive] = useState(false);+ // We need to read the latest value of ``oauthFlowActive`` from+ // inside the guarded setter without rebuilding the setter on every+ // render — a ref keeps it stable for callbacks. The button's+ // ``disabled`` attribute alone is NOT enough on iOS Safari: the+ // user has reproduced the tab flipping while the radio is rendered+ // disabled. We do not know the exact event path that smuggles the+ // click through (URL-bar collapse reflow, fastclick coordinate+ // drift, synthetic gesture), so the only bulletproof defense is+ // rejecting the state mutation at its source.+ const oauthFlowActiveRef = React.useRef(oauthFlowActive);+ oauthFlowActiveRef.current = oauthFlowActive;+ const guardedSetAuthMode = React.useCallback(+ (next: CodexAuthMode) => {+ if (oauthFlowActiveRef.current) {+ // Visible warning in devtools so any future regression is+ // attributable. The toast is for users who happen to be+ // staring at the screen when this rejects.+ // eslint-disable-next-line no-console+ console.warn(+ '[codex-auth-mode] rejected change to %s while OAuth flow active',+ next,+ );+ showToast(t('settings.backends.oauthFlowLockedToast'), 'warning');+ return;+ }+ setAuthMode(next);+ },+ [showToast, t],+ );useEffect(() => {let cancelled = false;@@ -300,7 +329,7 @@ export const SettingsCodexProviderPage: React.FC = () => {</div><SegmentedRadiovalue={authMode}- onChange={setAuthMode}+ onChange={guardedSetAuthMode}options={modeOptions}ariaLabel={t('settings.backends.codexAuthModeLabel') as string}disabled={oauthFlowActive}diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 1a23ea625..f0bc5ad7c 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -182,6 +182,7 @@"oauthRemoved": "Credentials removed.","oauthRemoveFailed": "Could not remove credentials: {{detail}}","oauthRemovePartial": "Credentials cleared from Vibe Remote, but the backend CLI logout reported a problem: {{detail}}. The CLI's own files may still be present.",+ "oauthFlowLockedToast": "OAuth login is in progress — finish or cancel it before switching auth mode.","testConnectionTitle": "Test connection","testConnectionSubtitle": "Send a one-token \"Hi\" prompt to verify the session, the model, and any custom Base URL.","testConnectionRun": "Run test",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex eb1448393..064998787 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -182,6 +182,7 @@"oauthRemoved": "已移除凭据。","oauthRemoveFailed": "移除凭据失败:{{detail}}","oauthRemovePartial": "已清除 Vibe Remote 内的凭据,但 CLI logout 返回错误:{{detail}}。CLI 自己的凭据文件可能仍在磁盘上。",+ "oauthFlowLockedToast": "OAuth 登录进行中——请先完成或取消,再切换验证方式。","testConnectionTitle": "测试连通性","testConnectionSubtitle": "发送一条 \"Hi\" 测试 prompt,用来验证账号、模型和自定义 Base URL 是否可用。","testConnectionRun": "运行测试",