Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix for issue where stats are not updated for conversations (#12688)

Tim O'Farrell0b8c69fad23f
diff --git a/openhands/app_server/event_callback/webhook_router.py b/openhands/app_server/event_callback/webhook_router.py
index ee14e7b61c..0b0091247a 100644
--- a/openhands/app_server/event_callback/webhook_router.py
+++ b/openhands/app_server/event_callback/webhook_router.py
@@ -126,6 +126,7 @@ async def on_conversation_update(
pr_number=existing.pr_number,
# Preserve parent/child relationship and other metadata
parent_conversation_id=existing.parent_conversation_id,
+ metrics=conversation_info.stats.get_combined_metrics(),
)
await app_conversation_info_service.save_app_conversation_info(
app_conversation_info
diff --git a/tests/unit/app_server/test_webhook_router_parent_conversation.py b/tests/unit/app_server/test_webhook_router_parent_conversation.py
index dcae5c5384..4d6252ff5d 100644
--- a/tests/unit/app_server/test_webhook_router_parent_conversation.py
+++ b/tests/unit/app_server/test_webhook_router_parent_conversation.py
@@ -91,6 +91,10 @@ def mock_conversation_info() -> ConversationInfo:
conversation_info.agent.llm = MagicMock()
conversation_info.agent.llm.model = 'gpt-4'
+ # Mock stats.get_combined_metrics() structure
+ conversation_info.stats = MagicMock()
+ conversation_info.stats.get_combined_metrics.return_value = None
+
return conversation_info