All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
33.27k stars 3.81k forks source link

Compatibility for renamed attribute #4582

Open enyst opened 1 day ago

enyst commented 1 day ago

End-user friendly description of the problem this fixes or functionality that this introduces


Give a summary of what the PR does, explaining any non-trivial design decisions

When restoring sessions, they fail due to

  File "/odie/openhands/events/serialization/event.py", line 31, in event_from_dict
    evt = action_from_dict(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/odie/openhands/events/serialization/action.py", line 73, in action_from_dict
    raise LLMMalformedActionError(
openhands.core.exceptions.LLMMalformedActionError: action={'id': 21, 'timestamp': '2024-10-11T17:11:05.710852', 'source': 'agent', 'message': 'Running Python code interactively: print(55)', 'action': 'run_ipython', 'args': {'code': 'print(55)', 'thought': '', 'is_confirmed': 'confirmed', 'kernel_init_code': 'from agentskills import *'}} has the wrong arguments: IPythonRunCellAction.__init__() got an unexpected keyword argument 'is_confirmed'

This PR proposes to add compatibility with older sessions.

I think 4508 hasn't been in a release yet, which might be why we're not seeing reports yet. I'm also not fully sure how much people use session restore right now, although for UI sessions I think it's default, so maybe we need this.

An alternative may be to revert 4508.


Link of any specific issues this addresses