Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: recover same-OTID retries that race with mapping storage (#10209)
cthomasd9c80042019c
diff --git a/letta/services/streaming_service.py b/letta/services/streaming_service.pyindex 1adeea2b3..ee0a713fd 100644--- a/letta/services/streaming_service.py+++ b/letta/services/streaming_service.py@@ -302,6 +302,18 @@ class StreamingService:)except ConversationBusyError as e:+ # Second-chance recovery for same-OTID retries that lost the race:+ # The pre-lock check ran before the mapping was stored, but by now+ # the lock holder has created the run and stored the mapping.+ if request.background and request_token and e.lock_holder_token and e.lock_holder_token == request_token:+ recovery_response = await try_recover_duplicate_request(+ redis_client=redis_client,+ request_token=request_token,+ lock_key=lock_key,+ include_pings=request.include_pings,+ )+ if recovery_response:+ return None, recovery_responseraise await enrich_conversation_busy_error(redis_client, e)finally:admission_wait_ms = (get_utc_timestamp_ns() - admission_wait_start_ns) / 1_000_000