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(wechat): surface QR start failures before polling

cyh04b9e6e970ee
diff --git a/modules/im/wechat_auth.py b/modules/im/wechat_auth.py
index 074587157..64986fb33 100644
--- a/modules/im/wechat_auth.py
+++ b/modules/im/wechat_auth.py
@@ -187,9 +187,10 @@ class WeChatAuthManager:
if not base_url:
return {
+ "ok": False,
"session_key": session_key,
"qrcode_url": "",
- "message": "No base URL configured. Please set the WeChat base URL before logging in.",
+ "error": "No base URL configured. Please set the WeChat base URL before logging in.",
}
try:
@@ -223,9 +224,10 @@ class WeChatAuthManager:
except Exception as exc:
logger.error("Failed to start WeChat login: %s", exc)
return {
+ "ok": False,
"session_key": session_key,
"qrcode_url": "",
- "message": f"Failed to start login: {exc}",
+ "error": f"Failed to start login: {exc}",
}
async def poll_status(self, session_key: str) -> dict:
diff --git a/tests/test_wechat_auth.py b/tests/test_wechat_auth.py
index cfdc0ce7c..1c9425724 100644
--- a/tests/test_wechat_auth.py
+++ b/tests/test_wechat_auth.py
@@ -29,3 +29,16 @@ class WeChatAuthManagerTests(unittest.IsolatedAsyncioTestCase):
self.assertEqual(result["status"], "expired")
self.assertIn("start a new login", result["message"].lower())
+
+ async def test_start_login_returns_error_payload_when_qr_fetch_fails(self):
+ manager = WeChatAuthManager()
+
+ with patch(
+ "modules.im.wechat_auth.get_bot_qrcode",
+ new=AsyncMock(side_effect=RuntimeError("upstream unavailable")),
+ ):
+ result = await manager.start_login(base_url="https://wechat.example.com")
+
+ self.assertFalse(result["ok"])
+ self.assertIn("Failed to start login", result["error"])
+ self.assertIsNone(manager.get_session(result["session_key"]))