From 11c87caba40225e7bf727e6d3f16391c5dac4838 Mon Sep 17 00:00:00 2001 From: Tim O'Farrell Date: Tue, 27 Jan 2026 09:02:48 -0800 Subject: [PATCH] fix(backend): fix callback state not persisting due to dual-session conflict (#12627) Co-authored-by: openhands --- .../github_callback_processor.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/enterprise/server/conversation_callback_processor/github_callback_processor.py b/enterprise/server/conversation_callback_processor/github_callback_processor.py index 403125001f..f87118f1ea 100644 --- a/enterprise/server/conversation_callback_processor/github_callback_processor.py +++ b/enterprise/server/conversation_callback_processor/github_callback_processor.py @@ -14,7 +14,6 @@ from storage.conversation_callback import ( ConversationCallback, ConversationCallbackProcessor, ) -from storage.database import session_maker from openhands.core.logger import openhands_logger as logger from openhands.core.schema.agent import AgentState @@ -108,13 +107,10 @@ class GithubCallbackProcessor(ConversationCallbackProcessor): f'[GitHub] Sent summary instruction to conversation {conversation_id} {summary_event}' ) - # Update the processor state + # Update the processor state - the outer session will commit this self.send_summary_instruction = False callback.set_processor(self) callback.updated_at = datetime.now() - with session_maker() as session: - session.merge(callback) - session.commit() return # Extract the summary from the event store @@ -130,14 +126,15 @@ class GithubCallbackProcessor(ConversationCallbackProcessor): logger.info(f'[GitHub] Summary sent for conversation {conversation_id}') - # Mark callback as completed status + # Mark callback as completed status - the outer session will commit this callback.status = CallbackStatus.COMPLETED callback.updated_at = datetime.now() - with session_maker() as session: - session.merge(callback) - session.commit() except Exception as e: logger.exception( f'[GitHub] Error processing conversation callback: {str(e)}' ) + # Mark callback as error to prevent infinite re-invocation + # The outer session will commit this + callback.status = CallbackStatus.ERROR + callback.updated_at = datetime.now()