All-Hands-AI / OpenHands

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

[Bug]: FinishTool doesn't have a tool response so the agent loses its content #5154

Open enyst opened 3 days ago

enyst commented 3 days ago

Is there an existing issue for the same bug?

Describe the bug and reproduction steps

Reported on slack. Regression from function calling.

FinishAction with source=agent is not the last thing that happens when running with UI or restoring session in CLI, but our backend doesn't give it a tool response. CodeAct "forgets" it, which makes other things not play nice.

Note: it happens with native function calling, but it probably happens with non-native too after we started converting them back and forth.

IMPORTANT:

With this context, fix this:

IMPORTANT INFO: We are fixing an AI agent. The agent sends multiple messages to an LLM API. That API and how it works are impossible for us to change! It is important that you do NOT hallucinate their behavior.

One requirement for tools is, for example, that a message that is a tool call, has a tool id, and is immediately followed by a tool response, which is linked to the previous message by tool id.

Additional Context

It will be addressed by this refactoring or before.

github-actions[bot] commented 8 hours ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 8 hours ago

A potential fix has been generated and a draft PR #5231 has been created. Please review the changes.