Skip to content

The agent that grows with you

fix(gateway): live Bot Chat handoff reads turn_author with .get, not a KeyError

teknium1697ebd8b0ae0
diff --git a/gateway/platforms/api_server.py b/gateway/platforms/api_server.py
index a51c830af9a..7be9410855c 100644
--- a/gateway/platforms/api_server.py
+++ b/gateway/platforms/api_server.py
@@ -3260,7 +3260,7 @@ class APIServerAdapter(OpenAICompatRoutesMixin, BasePlatformAdapter):
receipt on the same budget as the local path, so the peer still gets the reply on this call.
"""
session_id = ctx["session_id"]
- admitted = await self._admit_to_live_bot_chat(session_id, ctx["user_message"], ctx["run_kwargs"]["turn_author"])
+ admitted = await self._admit_to_live_bot_chat(session_id, ctx["user_message"], ctx["run_kwargs"].get("turn_author"))
if admitted is None:
return None
record = await self._await_live_bot_chat_receipt(*admitted)
@@ -3301,7 +3301,7 @@ class APIServerAdapter(OpenAICompatRoutesMixin, BasePlatformAdapter):
the run's single ``assistant.completed`` event; a receipt still open at the budget is a
``run.queued`` event (the 202 shape), a failed one an ``error`` event carrying the reason."""
session_id = ctx["session_id"]
- admitted = await self._admit_to_live_bot_chat(session_id, ctx["user_message"], ctx["run_kwargs"]["turn_author"])
+ admitted = await self._admit_to_live_bot_chat(session_id, ctx["user_message"], ctx["run_kwargs"].get("turn_author"))
if admitted is None:
return None
events = _SessionEventQueue(session_id, f"run_{uuid.uuid4().hex}")