fix(honcho): wrap all Honcho calls in try/except (401 key issue)

This commit is contained in:
2026-06-05 23:46:35 -04:00
parent 2da52fbc3c
commit 187c33637a
+15 -11
View File
@@ -187,18 +187,19 @@ async def gemini_voice_ws(websocket: WebSocket):
if msg_type == "identify": if msg_type == "identify":
user_id = msg.get("user_id", "default-user").strip() user_id = msg.get("user_id", "default-user").strip()
user_name = msg.get("name", "").strip() user_name = msg.get("name", "").strip()
if user_name and user_id: try:
kira_memory.set_user_preference(user_id, "name", user_name) if user_name and user_id:
prefs = kira_memory.get_user_preferences(user_id) kira_memory.set_user_preference(user_id, "name", user_name)
if kira_memory.enabled: prefs = kira_memory.get_user_preferences(user_id)
kira_memory.ensure_peers(user_id) if kira_memory.enabled:
kira_memory.ensure_session(session_id) kira_memory.ensure_peers(user_id)
try: kira_memory.ensure_session(session_id)
ctx = kira_memory.build_system_prompt_suffix() ctx = kira_memory.build_system_prompt_suffix()
if ctx: if ctx:
memory_suffix = ctx memory_suffix = ctx
except Exception: except Exception as e:
pass logger.warning(f"Honcho error during identify: {e}")
prefs = {}
await websocket.send_json({ await websocket.send_json({
"type": "identified", "type": "identified",
"user_id": user_id, "user_id": user_id,
@@ -209,8 +210,11 @@ async def gemini_voice_ws(websocket: WebSocket):
if msg_type == "set_preference": if msg_type == "set_preference":
key = msg.get("key", "").strip() key = msg.get("key", "").strip()
value = msg.get("value", "").strip() value = msg.get("value", "").strip()
if key and user_id and user_id != "default-user": try:
kira_memory.set_user_preference(user_id, key, value) if key and user_id and user_id != "default-user":
kira_memory.set_user_preference(user_id, key, value)
except Exception:
pass
await websocket.send_json({"type": "preference_saved", "key": key, "success": True}) await websocket.send_json({"type": "preference_saved", "key": key, "success": True})
continue continue