diff --git a/chat/services/regenerate.py b/chat/services/regenerate.py index c432d20..6427092 100644 --- a/chat/services/regenerate.py +++ b/chat/services/regenerate.py @@ -114,13 +114,13 @@ async def regenerate_assistant_turn( # Phase 2: surface the guest (if any) so the prompt assembler and # downstream multi-entity passes see the same shape post_turn does. + # Phase 2 T47 made bot_reset cascade-clear ``chat.guest_bot_id`` when + # the referenced bot is purged (verified by tests/test_reset.py), so + # we trust the column here: it's either a valid bot id or NULL. guest_bot_id = chat.get("guest_bot_id") - guest_bot: dict | None = None - if guest_bot_id is not None: - guest_bot = get_bot(conn, guest_bot_id) - if guest_bot is None: - # Stale guest reference — degrade to single-bot regenerate. - guest_bot_id = None + guest_bot: dict | None = ( + get_bot(conn, guest_bot_id) if guest_bot_id is not None else None + ) # 1. Locate the original assistant_turn event. row = conn.execute(