feat(sdk): allow custom FileStore injection#3252
Open
StatPan wants to merge 1 commit into
Open
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
approved these changes
May 14, 2026
Collaborator
all-hands-bot
left a comment
There was a problem hiding this comment.
Clean dependency injection pattern with comprehensive tests and clear documentation. Maintains full backward compatibility while enabling custom FileStore implementations.
Contributor
Author
|
Hi @xingyaoww, #3252 splits out only the minimal custom Could you take a look or route this to the right maintainer when you have a chance? Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
file_storeparameter toConversationState.create()andLocalConversation.__init__()persistence_dirbehavior when no custom store is providedfile_storeowns state/EventLog persistence, whilepersistence_dirstill sets observation pathsInMemoryFileStoreso this PR only covers the injection point, not any database backendMotivation
Some SDK users run conversations in stateless or ephemeral environments where the local filesystem is not a durable EventLog store. This change lets callers provide their own
FileStoreimplementation without adding any storage backend to the SDK core.This is intentionally split from #2902: PostgreSQL support can remain external or be proposed separately. The API question here is only whether local SDK conversations can accept a caller-provided
FileStore.Test plan
uv run ruff format openhands-sdk/openhands/sdk/conversation/state.py openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py tests/sdk/conversation/local/test_custom_file_store.pyuv run ruff check openhands-sdk/openhands/sdk/conversation/state.py openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py tests/sdk/conversation/local/test_custom_file_store.pyuv run pytest tests/sdk/conversation/local/test_custom_file_store.py tests/sdk/conversation/test_directories.py tests/sdk/conversation/local/test_conversation_path_types.py -quv run pre-commit run --files openhands-sdk/openhands/sdk/conversation/state.py openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py tests/sdk/conversation/local/test_custom_file_store.pyuv run python .github/scripts/check_sdk_api_breakage.pyResolves StatPan#1