OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Add permanent storage option for EventStream

Open rbren opened this issue 1 year ago • 2 comments

This allows EventStream to persist to a local or remote filesystem, instead of keeping all state in-memory.

This is helpful for a high-availability situation. For example, currently, if you rolled out a new deployment, any websockets would be disconnected, existing user sessions would be cancelled, and all the session data would be lost.

With this change, the client could reconnect to a new instance of the application, and the EventStore could rehydrate from persistent storage.

This change also factors action/observation/event serialization and deserialization into its own spot, to avoid circular imports

rbren avatar May 10 '24 20:05 rbren

@rbren I found this bug when opening two browsers and chat with opendevin at the same time, the bug related to EventStream. pr: https://github.com/OpenDevin/OpenDevin/pull/1713

And I found you fixed it in current pr, but I suggest to merge mine pr before you finish current one.

assertion avatar May 11 '24 09:05 assertion

good catch @assertion!

rbren avatar May 11 '24 15:05 rbren

Codecov Report

Attention: Patch coverage is 83.69565% with 45 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (main@755a407). Click here to learn what that means.

Files Patch % Lines
opendevin/server/agent/agent.py 0.00% 10 Missing :warning:
opendevin/storage/s3.py 55.55% 8 Missing :warning:
opendevin/events/serialization/event.py 85.71% 7 Missing :warning:
opendevin/events/serialization/action.py 77.77% 6 Missing :warning:
opendevin/storage/files.py 71.42% 4 Missing :warning:
agenthub/dummy_agent/agent.py 33.33% 2 Missing :warning:
opendevin/events/serialization/observation.py 91.66% 2 Missing :warning:
opendevin/runtime/server/runtime.py 0.00% 2 Missing :warning:
opendevin/storage/__init__.py 85.71% 2 Missing :warning:
opendevin/controller/agent_controller.py 0.00% 1 Missing :warning:
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1697   +/-   ##
=======================================
  Coverage        ?   61.37%           
=======================================
  Files           ?      108           
  Lines           ?     4241           
  Branches        ?        0           
=======================================
  Hits            ?     2603           
  Misses          ?     1638           
  Partials        ?        0           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 13 '24 16:05 codecov[bot]

I haven't got to test it, otherwise LGTM!

enyst avatar May 14 '24 01:05 enyst