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(ui): harden setup guard and WeChat login waits
cyh6bdd4a230db1
diff --git a/modules/im/wechat_auth.py b/modules/im/wechat_auth.pyindex 64986fb33..0ad06cdd5 100644--- a/modules/im/wechat_auth.py+++ b/modules/im/wechat_auth.py@@ -379,12 +379,15 @@ class WeChatAuthManager:while time.time() < deadline:result = await self.poll_status(session_key)status = result.get("status")+ message = result.get("message", "").lower()if status in ("confirmed", "error"):return result- if status == "expired" and "restart" in result.get("message", "").lower():- # Max refreshes exhausted+ if status == "expired" and (+ "restart" in message or "start a new login" in message+ ):+ # Max refreshes exhausted or the session no longer exists.return result# For "wait", "scaned", "refreshed" — keep pollingdiff --git a/tests/test_wechat_auth.py b/tests/test_wechat_auth.pyindex 1c9425724..0aa9598ba 100644--- a/tests/test_wechat_auth.py+++ b/tests/test_wechat_auth.py@@ -42,3 +42,11 @@ class WeChatAuthManagerTests(unittest.IsolatedAsyncioTestCase):self.assertFalse(result["ok"])self.assertIn("Failed to start login", result["error"])self.assertIsNone(manager.get_session(result["session_key"]))++ async def test_wait_for_login_returns_immediately_when_session_missing(self):+ manager = WeChatAuthManager()++ result = await manager.wait_for_login("missing-session", timeout_s=5)++ self.assertEqual(result["status"], "expired")+ self.assertIn("start a new login", result["message"].lower())diff --git a/ui/src/App.tsx b/ui/src/App.tsxindex 4daaa147f..674aa48cb 100644--- a/ui/src/App.tsx+++ b/ui/src/App.tsx@@ -27,7 +27,11 @@ const AuthGuard = ({ children }: { children: any }) => {return;}+ let cancelled = false;+ setLoading(true);+getConfig().then(config => {+ if (cancelled) return;const enabledPlatforms = getEnabledPlatforms(config);const hasToken = enabledPlatforms.some((platform) =>platform === 'discord'@@ -38,16 +42,19 @@ const AuthGuard = ({ children }: { children: any }) => {? !!config?.wechat?.bot_token: !!config?.slack?.bot_token);- if (!config || !config.mode || !hasToken) {- setNeedsSetup(true);- }+ setNeedsSetup(!config || !config.mode || !hasToken);setLoading(false);}).catch(() => {+ if (cancelled) return;// If fetch fails (e.g. config doesn't exist), setup is neededsetNeedsSetup(true);setLoading(false);});- }, [bypassSetupGuard, getConfig]);++ return () => {+ cancelled = true;+ };+ }, [bypassSetupGuard]);if (loading) return <div className="min-h-screen flex items-center justify-center bg-bg text-text">Loading...</div>;if (needsSetup && !bypassSetupGuard) return <Navigate to="/setup" replace />;