chore: remove defensive stale-guest degrade in turns.py (T74.4)
T44 carried a defensive degrade-to-1:1 block in post_turn for the case where chat.guest_bot_id pointed at a deleted bot. T47 then fixed the root cause by adding a bot_reset cascade that clears guest_bot_id from any chat that referenced the deleted bot, so the post_turn defensive block was rendered dead. Remove the orphan-clear branch and replace it with a comment documenting that get_bot now returns a real row when guest_bot_id is non-None. The cascade behavior is pinned by test_reset_clears_guest_reference_in_other_chats in tests/test_reset.py.
This commit is contained in:
+5
-4
@@ -236,11 +236,12 @@ async def post_turn(
|
||||
guest_bot = None
|
||||
guest_bot_id = chat.get("guest_bot_id")
|
||||
if guest_bot_id is not None:
|
||||
# T47's bot_reset cascade clears guest_bot_id from any chat that
|
||||
# referenced the deleted bot, so by the time we read it here it's
|
||||
# either None or a live bot id. The previous defensive
|
||||
# degrade-to-1:1 block (T44) was rendered dead by T47 and removed
|
||||
# in T74.4 — get_bot now returns a real row.
|
||||
guest_bot = get_bot(conn, guest_bot_id)
|
||||
# If the chat references a deleted guest we degrade to single-bot
|
||||
# rather than 404 — the chat is still usable as a 1:1.
|
||||
if guest_bot is None:
|
||||
guest_bot_id = None
|
||||
|
||||
settings = request.app.state.settings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user