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

This commit is contained in:
Tim O'Farrell 2025-08-11 15:44:48 -06:00 committed by GitHub
parent af49b615b1
commit 6f21b6700a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 34 additions and 24 deletions

View File

@ -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

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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,
)