From dc69c9ddfbda06bab8825b6739a23647281efdda Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Thu, 30 Apr 2026 00:17:31 -0400 Subject: [PATCH] fix(escalations): allow claimed-by user to send chat messages to escalated session unified_chat_service.send_chat_message checked AISession.user_id == user_id, blocking the senior who claimed an escalation from sending the AI briefing. Now also allows AISession.escalated_to_id == user_id (the claimer). Co-Authored-By: Claude Sonnet 4.6 --- backend/app/services/unified_chat_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/services/unified_chat_service.py b/backend/app/services/unified_chat_service.py index 7b121a3d..a313286d 100644 --- a/backend/app/services/unified_chat_service.py +++ b/backend/app/services/unified_chat_service.py @@ -583,10 +583,14 @@ async def send_chat_message( Returns (ai_content, suggested_flows, session, fork_metadata, actions_data, questions_data). """ + from sqlalchemy import or_ result = await db.execute( select(AISession).where( AISession.id == session_id, - AISession.user_id == user_id, + or_( + AISession.user_id == user_id, + AISession.escalated_to_id == user_id, + ), AISession.session_type == "chat", ) )