OpenHands
OpenHands copied to clipboard
[Bug]: Very longs commands execution in terminal on macos
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Describe the bug and reproduction steps
There is a significant delay in commands execution which are run in openhands terminal. This leads to errors like this: [The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.] --END AGENT OBSERVATION--
Running commands directly via docker exec does not cause any delays and work normally.
Manual commands execution pose the same significant delays in commands execution.
OpenHands Installation
Docker command in README
OpenHands Version
0.19
Operating System
MacOS
Logs, Errors, Screenshots, and Additional Context
11:03:20 - ACTION [Agent Controller 732999583fee427caaf06cf09e3b9196] CmdRunAction (source=EventSource.AGENT) COMMAND: y 11:05:20 - OBSERVATION [Agent Controller 732999583fee427caaf06cf09e3b9196] CmdOutputObservation (source=EventSource.AGENT, exit code=-1, metadata={ "exit_code": -1, "pid": -1, "username": null, "hostname": null, "working_dir": null, "py_interpreter_path": null, "prefix": "[Command output continued from previous command]\n", "suffix": "\n[The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.]" }) --BEGIN AGENT OBSERVATION-- [Command output continued from previous command]
npx create-vue my-todo-app
RangeError: Incorrect locale information provided
Vue.js - The Progressive JavaScript Framework
? Add TypeScript? › No / Yes [The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.] --END AGENT OBSERVATION--
I believe with the new changes, you can send Yes / No to the question for interactive prompts.
It says:
Add Typscript? No / Yes
Oh my apologies. In the new changes, this happens automatically. I just saw it happen in one of my runs. If you leave it running does it automatically send Yes to the terminal at all?
Yes, eventually it will send "yes" but it's not effective due to terminal timeout
Hmmmm in my case it was able to continue but yours looks like it behaved differently?
I also just noticed this error, and I'm also on mac.
I'm not sure if it's related to the OpenHands branch I'm in, but I noticed this while testing out https://github.com/All-Hands-AI/OpenHands/pull/5284 using CLI mode:
...
poetry run ... openhands.core.cli ...
...
15:58:12 - openhands:DEBUG: stream.py:265 - Adding CmdRunAction id=21 from AGENT
15:58:12 - openhands:DEBUG: agent_controller.py:612
ACTION
[Agent Controller default] **CmdRunAction (source=EventSource.AGENT)**
THOUGHT: Now let's run the build and test script to ensure our changes compile and pass tests:
COMMAND:
tools/bazelCompileAndTest.sh
16:00:13 - openhands:DEBUG: stream.py:265 - Adding CmdOutputObservation id=22 from AGENT
16:00:13 - openhands:DEBUG: agent_controller.py:300
OBSERVATION
[Agent Controller default] **CmdOutputObservation (source=EventSource.AGENT, exit code=-1, metadata={
"exit_code": -1,
"pid": -1,
"username": null,
"hostname": null,
"working_dir": null,
"py_interpreter_path": null,
"prefix": "",
"suffix": "\n[The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.]"
})**
--BEGIN AGENT OBSERVATION--
[The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.]
--END AGENT OBSERVATION--
[Agent Controller default] LEVEL 0 LOCAL STEP 10 GLOBAL STEP 10
...
16:00:19 - openhands:DEBUG: stream.py:265 - Adding FileReadAction id=23 from AGENT
16:00:19 - openhands:DEBUG: agent_controller.py:612
ACTION
[Agent Controller default] FileReadAction(path='/workspace/projects/datascope/BUILD.bazel', start=0, end=-1, thought='I apologize, but it seems the bazelCompileAndTest.sh script is not available in this environment. Let me check if we need to update the BUILD.bazel file to include the Apache Commons dependency:', action='read', security_risk=None, impl_source=<FileReadSource.OH_ACI: 'oh_aci'>, translated_ipython_code="print(file_editor(**{'path': '/workspace/projects/datascope/BUILD.bazel', 'command': 'view'}))")
16:00:19 - openhands:DEBUG: stream.py:265 - Adding FileReadObservation id=24 from AGENT
...
I also just noticed this in "headless" mode. Is this where to increase the timeout? https://github.com/All-Hands-AI/OpenHands/blob/b9a70c8d5ccbead0ad621f9fd1814acff2d55984/config.template.toml#L239
[The command timed out after 120 seconds. You may wait longer to see additional output by sending empty command '', send other commands to interact with the current process, or send keys to interrupt/kill the command.]
I think that timeout is defined in config.toml, the [sandbox] section, as you pointed out above in the template. So you can increase there (in the config.toml) as you wish.
Or, if you run with docker run, then it can be sent via env, with the equivalent environment var SANDBOX_TIMEOUT
I think there may be a regression somewhere. Several people bringing up issues with running commands: https://github.com/All-Hands-AI/OpenHands/issues/6259
@mamoodi I agree. This should be escalated! Things that used to take a second are taking minutes. Something simple like this Running a bash command Command: cd /workspace && cat instructions/plan.md used to take a split second. Now it takes minutes. This is something new and should be addressed soon.
I've recently been using Docker run to start my session and that's where I've been having the problems. I switched to using make build and make run and it seems like it's not happening there. I hope that gives a clue to what's going on
Agreed @amirshawn . The team is looking into it actively right now.
Hey all I think we have some understanding on this now. For now you can use 0.18 version as that doesn't seem to have the issue. Hoping to get a fix soon 🤞
Hey folks. There's been a PR with some potential fixes. Can you all try to see if you're still seeing the same issue very frequently please? And let me know when you run into it. Either by sharing logs or pressing the thumbs down and sharing the link if you can.
I've been testing it a bit. Using npm it struggles a bit but seems to recover better in some scenarios. I'll continue testing tomorrow as well.
There's been some improvements in this area in 0.21. However, don't believe it's 100% fixed. Let me know if you all are seeing better/worse/same results if you happen to see this.
@mamoodi I can confirm there's been huge improvement. Still no 100% but much much better. To me it seems like what seems to make it stall now is the error from anthropic about reaching it's minute token limit. It seems to make it stall and then it doesn't restart every time. If I respond ok, it gets it going again.
I think this is basically fixed with the new tmux terminal, at least in the example above. I'm going to close this as completed, but if you're still encountering stalling in the most recent version of OpenHands, please try to provide a way to reproduce the issue (and also any logs you can provide) in a new issue and we'll try to tackle it.