mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 13:52:43 +08:00
Fix v1 conversation lookup timing issue in SlackUpdateExistingConversationView
- Use ADMIN context like SlackV1CallbackProcessor (which works successfully) - Add retry logic with exponential backoff for conversation lookup - Handle race condition where conversation exists but not yet in app_conversation_info_service - Add detailed logging for debugging timing issues The issue was that SlackV1CallbackProcessor works with ADMIN context because it runs after the conversation is fully established, while our method runs immediately when a follow-up message comes in, creating a timing race condition. Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
parent
4d39f39c85
commit
f264e9a049
@ -451,13 +451,31 @@ class SlackUpdateExistingConversationView(SlackNewConversationView):
|
||||
get_sandbox_service(state) as sandbox_service,
|
||||
get_httpx_client(state) as httpx_client,
|
||||
):
|
||||
# 1. Conversation lookup
|
||||
app_conversation_info = ensure_conversation_found(
|
||||
await app_conversation_info_service.get_app_conversation_info(
|
||||
self.conversation_id
|
||||
),
|
||||
self.conversation_id,
|
||||
)
|
||||
# 1. Conversation lookup with retry for timing issues
|
||||
app_conversation_info = None
|
||||
max_retries = 3
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
app_conversation_info = ensure_conversation_found(
|
||||
await app_conversation_info_service.get_app_conversation_info(
|
||||
self.conversation_id
|
||||
),
|
||||
self.conversation_id,
|
||||
)
|
||||
break
|
||||
except RuntimeError as e:
|
||||
if attempt == max_retries - 1:
|
||||
logger.error(
|
||||
f'[Slack V1] Failed to find conversation {self.conversation_id} after {max_retries} attempts: {e}'
|
||||
)
|
||||
raise
|
||||
else:
|
||||
logger.warning(
|
||||
f'[Slack V1] Conversation {self.conversation_id} not found on attempt {attempt + 1}, retrying...'
|
||||
)
|
||||
# Wait a bit before retrying
|
||||
import asyncio
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
# 2. Sandbox lookup + validation
|
||||
sandbox = ensure_running_sandbox(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user