All-Hands-AI / OpenHands

šŸ™Œ OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
36.88k stars 4.19k forks source link

Agent stops working after "error condensing thoughts" problem #430

Closed penberg closed 7 months ago

penberg commented 7 months ago

Describe the bug

Steps to Reproduce

  1. I asked OpenDevin to build a frontend for a movie recommendation app.
  2. After some steps, the agent crashes.

Actual behavior

The agent logs has:

    PLAN:

    šŸ”µ 0 I would like you to build a frontend for a movie recommendation app. The front page should show top 10 recommended movies. There also should be a search bar that users can use to search for movies. Users need to be able to mark movies as seen, but also mark movies they liked with a star.

    AGENT ERROR:
    Error condensing thoughts: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/utils/monologue.py", line 32, in condense
    self.thoughts = prompts.parse_summary_response(summary_resp)
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/utils/prompts.py", line 143, in parse_summary_response
    parsed = json.loads(response)
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/utils/json.py", line 11, in loads
    return json.loads(s, **kwargs)
  File "/opt/homebrew/Cellar/python@3.10/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/homebrew/Cellar/python@3.10/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/homebrew/Cellar/python@3.10/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/penberg/src/penberg/OpenDevin/opendevin/controller/agent_controller.py", line 89, in step
    action = self.agent.step(self.state)
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/langchains_agent.py", line 124, in step
    self._add_event(prev_action.to_dict())
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/langchains_agent.py", line 74, in _add_event
    self.monologue.condense(self.llm)
  File "/Users/penberg/src/penberg/OpenDevin/agenthub/langchains_agent/utils/monologue.py", line 35, in condense
    raise RuntimeError(f"Error condensing thoughts: {e}")
RuntimeError: Error condensing thoughts: Expecting value: line 1 column 1 (char 0)

    OBSERVATION:
    Error condensing thoughts: Expecting value: line 1 column 1 (char 0)
INFO:     connection closed
Error sending data to client
Client websocket disconnected (<CloseCode.ABNORMAL_CLOSURE: 1006>, None)
enyst commented 7 months ago

Also reported in https://github.com/OpenDevin/OpenDevin/issues/420, PR here https://github.com/OpenDevin/OpenDevin/pull/440

rbren commented 7 months ago

Thanks for the report! Merged #440, let me know if you're still seeing it

penberg commented 7 months ago

Oh, missed the duplicate, thanks @enyst!

penberg commented 7 months ago

@rbren Seems to fix the problem, thanks!