Hi guys. I've been using OpenHands CLI for a quite...
# dev-pr-review
w
Hi guys. I've been using OpenHands CLI for a quite while and I super love it. However I've been troubled a lot by the "Agent got stuck in a loop" problem.. It results in total loss of context. To avoid this problem, I even started monitoring crucial process, so I could pause agent when loop starts to appear, and I would prompt agent again to get rid of loop. So I basically implemented this behaviour in a patch: https://github.com/All-Hands-AI/OpenHands/pull/11439 Would appreciate if anyone can review or discuss with me about this PR.
l
Awesome, thank you! I think weโ€™re mostly moving development over to the agent-sdk though. I have one open PR on stuck in a loop detection here: https://github.com/All-Hands-AI/agent-sdk/pull/763
๐Ÿ‘ 1
I still need to finish it up, but will try to merge soon
c
Iโ€™m thinking also, another thing we could do is to not stop the CLI. It does stop fully now, right? It could instead tell the user the agent is stuck in a loop, and let them continue if they want to.
Out of curiosity, could you tell what LLM were you using, @white-chef-83304 ? Stuck is unusual these days with SOTA LLMs, but it can happen with non-native tool use LLMs, even good ones; and on the other hand, the cases when the agent needs to wait for a running process are tricky
w
@calm-artist-7206 Yes indeed, my intention is to provide another option than stopping CLI completely. I think by prompting LLM again we can get rid of the loop. I'm using DeepSeek V3.2.
@limited-student-10747 I noticed your PR is intended to make loop detection configurable, while mine aims at providing another option than stopping agent completely. Maybe we can do both? I believe these are conflicat-free.
c
Yes, I'm just thinking your PR also sends an automatic message from the "user" if I see this right? Just to note, I was thinking that we could just return the prompt to them, as another alternative. If you could take a look at the linting issues in the PR, I'd be happy to get it merged. Please note, we are just transitioning to V1, the next major version of OpenHands, and that means that these files will be the legacy version. Just so you know ๐Ÿ˜Š
I'd personally prefer, if you want, to merge your PR. But for V1, and that means within days or right now TBH, we will need probably to port it, and maybe rethink a bit the logic
w
@calm-artist-7206 Thanks for your advice, I have added a new option to resume with existing user prompt! And I have fixed Lint problems. If you would, I would be sooo happy to have my PR merged! ๐Ÿ˜Šhttps://github.com/All-Hands-AI/OpenHands/pull/11439 Also I'm aware that you guys are transitioning to V1, and I'm super excited about it also. If needed I would port my PR to V1 as well.