Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix for issues where callbacks are not batched (#10235)

Tim O'Farrell6f21b6700a32
diff --git a/openhands/server/shared.py b/openhands/server/shared.py
index 94a910fb62..1f0d3a4c26 100644
--- a/openhands/server/shared.py
+++ b/openhands/server/shared.py
@@ -27,11 +27,11 @@ assert isinstance(server_config_interface, ServerConfig), (
)
server_config: ServerConfig = server_config_interface
file_store: FileStore = get_file_store(
- config.file_store,
- config.file_store_path,
- config.file_store_web_hook_url,
- config.file_store_web_hook_headers,
- batch=config.file_store_web_hook_batch,
+ file_store_type=config.file_store,
+ file_store_path=config.file_store_path,
+ file_store_web_hook_url=config.file_store_web_hook_url,
+ file_store_web_hook_headers=config.file_store_web_hook_headers,
+ file_store_web_hook_batch=config.file_store_web_hook_batch,
)
client_manager = None
diff --git a/openhands/storage/__init__.py b/openhands/storage/__init__.py
index d5f7dd7089..5d8a744b24 100644
--- a/openhands/storage/__init__.py
+++ b/openhands/storage/__init__.py
@@ -16,7 +16,7 @@ def get_file_store(
file_store_path: str | None = None,
file_store_web_hook_url: str | None = None,
file_store_web_hook_headers: dict | None = None,
- batch: bool = False,
+ file_store_web_hook_batch: bool = False,
) -> FileStore:
store: FileStore
if file_store_type == 'local':
@@ -40,7 +40,7 @@ def get_file_store(
client = httpx.Client(headers=file_store_web_hook_headers or {})
- if batch:
+ if file_store_web_hook_batch:
# Use batched webhook file store
store = BatchedWebHookFileStore(
store,
diff --git a/openhands/storage/conversation/file_conversation_store.py b/openhands/storage/conversation/file_conversation_store.py
index 87739c094a..5127890a00 100644
--- a/openhands/storage/conversation/file_conversation_store.py
+++ b/openhands/storage/conversation/file_conversation_store.py
@@ -106,10 +106,11 @@ class FileConversationStore(ConversationStore):
cls, config: OpenHandsConfig, user_id: str | None
) -> FileConversationStore:
file_store = get_file_store(
- config.file_store,
- config.file_store_path,
- config.file_store_web_hook_url,
- config.file_store_web_hook_headers,
+ file_store_type=config.file_store,
+ file_store_path=config.file_store_path,
+ file_store_web_hook_url=config.file_store_web_hook_url,
+ file_store_web_hook_headers=config.file_store_web_hook_headers,
+ file_store_web_hook_batch=config.file_store_web_hook_batch,
)
return FileConversationStore(file_store)
diff --git a/openhands/storage/secrets/file_secrets_store.py b/openhands/storage/secrets/file_secrets_store.py
index b80b5fa19b..1b87853cb4 100644
--- a/openhands/storage/secrets/file_secrets_store.py
+++ b/openhands/storage/secrets/file_secrets_store.py
@@ -40,9 +40,10 @@ class FileSecretsStore(SecretsStore):
cls, config: OpenHandsConfig, user_id: str | None
) -> FileSecretsStore:
file_store = get_file_store(
- config.file_store,
- config.file_store_path,
- config.file_store_web_hook_url,
- config.file_store_web_hook_headers,
+ file_store_type=config.file_store,
+ file_store_path=config.file_store_path,
+ file_store_web_hook_url=config.file_store_web_hook_url,
+ file_store_web_hook_headers=config.file_store_web_hook_headers,
+ file_store_web_hook_batch=config.file_store_web_hook_batch,
)
return FileSecretsStore(file_store)
diff --git a/openhands/storage/settings/file_settings_store.py b/openhands/storage/settings/file_settings_store.py
index 8146cbbc31..3acedeb16f 100644
--- a/openhands/storage/settings/file_settings_store.py
+++ b/openhands/storage/settings/file_settings_store.py
@@ -34,9 +34,10 @@ class FileSettingsStore(SettingsStore):
cls, config: OpenHandsConfig, user_id: str | None
) -> FileSettingsStore:
file_store = get_file_store(
- config.file_store,
- config.file_store_path,
- config.file_store_web_hook_url,
- config.file_store_web_hook_headers,
+ file_store_type=config.file_store,
+ file_store_path=config.file_store_path,
+ file_store_web_hook_url=config.file_store_web_hook_url,
+ file_store_web_hook_headers=config.file_store_web_hook_headers,
+ file_store_web_hook_batch=config.file_store_web_hook_batch,
)
return FileSettingsStore(file_store)
diff --git a/tests/runtime/conftest.py b/tests/runtime/conftest.py
index 3e1aa0632a..ecd95fac09 100644
--- a/tests/runtime/conftest.py
+++ b/tests/runtime/conftest.py
@@ -260,10 +260,11 @@ def _load_runtime(
config.mcp = override_mcp_config
file_store = file_store = get_file_store(
- config.file_store,
- config.file_store_path,
- config.file_store_web_hook_url,
- config.file_store_web_hook_headers,
+ file_store_type=config.file_store,
+ file_store_path=config.file_store_path,
+ file_store_web_hook_url=config.file_store_web_hook_url,
+ file_store_web_hook_headers=config.file_store_web_hook_headers,
+ file_store_web_hook_batch=config.file_store_web_hook_batch,
)
event_stream = EventStream(sid, file_store)
diff --git a/tests/unit/test_file_settings_store.py b/tests/unit/test_file_settings_store.py
index 41b2511c8d..f5b0113a24 100644
--- a/tests/unit/test_file_settings_store.py
+++ b/tests/unit/test_file_settings_store.py
@@ -86,4 +86,10 @@ async def test_get_instance():
assert isinstance(store, FileSettingsStore)
assert store.file_store == mock_store
- mock_get_store.assert_called_once_with('local', '/test/path', None, None)
+ mock_get_store.assert_called_once_with(
+ file_store_type='local',
+ file_store_path='/test/path',
+ file_store_web_hook_url=None,
+ file_store_web_hook_headers=None,
+ file_store_web_hook_batch=False,
+ )