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 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 00:17:31 -04:00
parent db717b0b3f
commit dc69c9ddfb

View File

@@ -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",
)
)