Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add LocalRuntime and rename EventStreamRuntime to DockerRuntime #5284

Open
wants to merge 93 commits into
base: main
Choose a base branch
from

Conversation

xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Nov 26, 2024

This PR adds a new LocalRuntime implementation and renames EventStreamRuntime to LocalDockerRuntime for better clarity.

Changes

  • Add new LocalRuntime implementation that runs action_execution_server directly on the host machine
  • Rename EventStreamRuntime to LocalDockerRuntime for better clarity
  • Move runtime implementations to dedicated directories (local/ and docker/)
  • Update documentation to reflect runtime changes and add LocalRuntime description

Benefits

  • Provides a simpler setup for users who don't need container isolation
  • Clearer naming convention for runtime implementations
  • Better organized codebase with dedicated directories for each runtime type
  • Updated documentation to help users choose the right runtime for their needs

Issue fixed: https://github.com/orgs/All-Hands-AI/projects/1?pane=issue&itemId=82616729&issue=All-Hands-AI%7COpenHands%7C3903


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:b2b8f15-nikolaik   --name openhands-app-b2b8f15   docker.all-hands.dev/all-hands-ai/openhands:b2b8f15

…ntime

- Add new LocalRuntime implementation that runs action_execution_server directly on host
- Rename EventStreamRuntime to LocalDockerRuntime for clarity
- Move runtime implementations to dedicated directories
- Update documentation to reflect runtime changes
- Update imports to use LocalDockerRuntime and LocalRuntime
- Add LocalRuntime to get_runtime_classes()
- Update _close_test_runtime to handle LocalDockerRuntime
- Add proper type hints for server_process
- Fix stdout access safety
- Fix async/await type hints
- Improve error handling
openhands/runtime/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

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

@openhands-agent
Copy link
Contributor

New OpenHands update

@enyst
Copy link
Collaborator

enyst commented Nov 29, 2024

@openhands-agent This PR tests fail with

File "/home/runner/work/OpenHands/OpenHands/openhands/runtime/init.py", line 3, in
from openhands.runtime.impl.eventstream.eventstream_runtime import (

ERROR:root:<class 'ModuleNotFoundError'>: No module named 'openhands.runtime.impl.eventstream'

Fix this error. Keep your changes minimal.

Copy link
Contributor

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

tests/runtime/conftest.py Outdated Show resolved Hide resolved
tests/runtime/conftest.py Outdated Show resolved Hide resolved
tests/runtime/conftest.py Outdated Show resolved Hide resolved
@enyst
Copy link
Collaborator

enyst commented Nov 29, 2024

@openhands-agent We have done a lot to fix the original. This PR is doing these:

  • Add new LocalRuntime implementation that runs action_execution_server directly on the host machine
  • Rename EventStreamRuntime to DockerRuntime for better clarity
  • Move runtime implementations to dedicated directories (local/ and docker/)
  • Update documentation to reflect runtime changes and add LocalRuntime description.

The PR is mostly finished now. It has only one detail that went wrong: instead of the name LocalDockerRuntime, we now want the name DockerRuntime. Find all occurrences and fix them. Additionally, look also for the name EventStreamRuntime, and if you find any, update it to the new name, DockerRuntime.

Copy link
Contributor

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

@All-Hands-AI All-Hands-AI deleted a comment from openhands-agent Nov 29, 2024
@All-Hands-AI All-Hands-AI deleted a comment from github-actions bot Nov 29, 2024
@All-Hands-AI All-Hands-AI deleted a comment from github-actions bot Nov 29, 2024
@scosenza
Copy link

scosenza commented Jan 24, 2025

@xingyaoww I've been continuing to test out this branch, and it's generally been working great. I just hit an issue though, and I'm not sure if it's related to this branch or not (note that I hadn't pulled your latest changes when this happened):

Excerpt

COMMAND:
grep -n "visibility" /workspace/projects/viaduct/modules/data/datascope/src/main/kotlin/com/airbnb/viaduct/data/datascope/mutators/CreateTestStayListingMutator.kt
...
TimeoutError: timed out

Strangely, that grep command should return instantly, and does when I run it.
See also in the detailed logs below: TypeError: 'bool' object is not subscriptable

Full logs

...
   355                                   <response clipped><NOTE>Due to the max output limit, only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>

[Agent Controller default] LEVEL 0 LOCAL STEP 7 GLOBAL STEP 7
Response Latency: 4.818 seconds
Input tokens: 13328 | Output tokens: 125

ACTION
[Agent Controller default] **CmdRunAction (source=EventSource.AGENT, is_input=False)**
THOUGHT: Let me search for visibility-related code in this file:
COMMAND:
grep -n "visibility" /workspace/projects/REDACTED/Mutator.kt
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 133, in format
    return super().format(record)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 201, in _handle_action
    self.log('error', f'Unexpected error while running action: {error_message}')
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 141, in log
    getattr(logger, level)(message, stacklevel=2)
Message: '[runtime e664cffe-f099-415c-b521-b3dae4437018-10ac0feaee7bbe3e] Unexpected error while running action: AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 93, in format
    return super().format(new_record)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 201, in _handle_action
    self.log('error', f'Unexpected error while running action: {error_message}')
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 141, in log
    getattr(logger, level)(message, stacklevel=2)
Message: '[runtime e664cffe-f099-415c-b521-b3dae4437018-10ac0feaee7bbe3e] Unexpected error while running action: AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 133, in format
    return super().format(record)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 202, in _handle_action
    self.log('error', f'Problematic action: {str(event)}')
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 141, in log
    getattr(logger, level)(message, stacklevel=2)
Message: '[runtime e664cffe-f099-415c-b521-b3dae4437018-10ac0feaee7bbe3e] Problematic action: **CmdRunAction (source=EventSource.AGENT, is_input=False)**\nTHOUGHT: Let me search for visibility-related code in this file:\nCOMMAND:\ngrep -n "visibility" /workspace/projects/REDACTED/Mutator.kt'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 93, in format
    return super().format(new_record)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 202, in _handle_action
    self.log('error', f'Problematic action: {str(event)}')
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 141, in log
    getattr(logger, level)(message, stacklevel=2)
Message: '[runtime e664cffe-f099-415c-b521-b3dae4437018-10ac0feaee7bbe3e] Problematic action: **CmdRunAction (source=EventSource.AGENT, is_input=False)**\nTHOUGHT: Let me search for visibility-related code in this file:\nCOMMAND:\ngrep -n "visibility" /workspace/projects/REDACTED/Mutator.kt'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 133, in format
    return super().format(record)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 203, in _handle_action
    self.send_error_message(err_id, error_message)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 151, in send_error_message
    self.status_callback('error', message_id, message)
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/loop.py", line 22, in status_callback
    logger.error(msg)
Message: 'AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/opt/conda/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/socket.py", line 720, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 252, in send_action_for_execution
    with self._send_action_server_request(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 98, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/utils/request.py", line 44, in send_request
    response = session.request(method, url, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/.venv/lib/python3.12/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=30057): Read timed out. (read timeout=125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 191, in _handle_action
    observation: Observation = await call_sync_from_async(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 340, in run_action
    observation = getattr(self, action_type)(action)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 269, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/impl/action_execution/action_execution_client.py", line 263, in send_action_for_execution
    raise AgentRuntimeTimeoutError(
openhands.core.exceptions.AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/logger.py", line 93, in format
    return super().format(new_record)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 711, in format
    record.exc_text = self.formatException(record.exc_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.12/logging/__init__.py", line 657, in formatException
    tb = ei[2]
         ~~^^^
TypeError: 'bool' object is not subscriptable
Call stack:
  File "/opt/conda/lib/python3.12/threading.py", line 1032, in _bootstrap
    self._bootstrap_inner()
  File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/conda/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 183, in on_event
    asyncio.get_event_loop().run_until_complete(self._handle_action(event))
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/opt/conda/lib/python3.12/asyncio/base_events.py", line 1986, in _run_once
    handle._run()
  File "/opt/conda/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 203, in _handle_action
    self.send_error_message(err_id, error_message)
  File "/home/steve_cosenza/repos/OpenHands/openhands/runtime/base.py", line 151, in send_error_message
    self.status_callback('error', message_id, message)
  File "/home/steve_cosenza/repos/OpenHands/openhands/core/loop.py", line 22, in status_callback
    logger.error(msg)
Message: 'AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 120s'
Arguments: ()
02:43:14 - openhands:INFO: agent_controller.py:436 - [Agent Controller default] Setting agent(CodeActAgent) state from AgentState.RUNNING to AgentState.ERROR
OBSERVATION
[Agent Controller default] **ErrorObservation**
The action has not been executed.
OBSERVATION
[Agent Controller default] AgentStateChangedObservation(content='', agent_state=<AgentState.ERROR: 'error'>, observation='agent_state_changed')

@scosenza
Copy link

I just ran the same headless command again, I see the same timeout. I'll next update to your latest changes.

@scosenza
Copy link

Update: I pulled the latest changes from this PR, and I'm no longer seeing the timeouts 🙌

@xingyaoww
Copy link
Collaborator Author

Thanks @scosenza! Super happy to see that this PR has been working well for you!

Yeah those timeouts are existing runtime-related bugs that we are trying to fix & improve, but yeah, we do have some recent changes that improve the stability there that might help!

I think this PR is probably ready for merge (as long as I figure out correct way to run these in CI 🥹 )

async def execute_action(self, action: Action) -> Observation:
"""Execute an action by sending it to the server."""
if not self._runtime_initialized:
return ErrorObservation('Runtime not initialized')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we raise an exception, rather than send an ErrorObs? It's not the kind of thing that an agent can fix, and it would end up in its context otherwise

return ErrorObservation('Runtime not initialized')

if self.server_process is None or self.server_process.poll() is not None:
return ErrorObservation('Server process died')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Comment on lines +312 to +313
except requests.exceptions.RequestException as e:
return ErrorObservation(f'Failed to execute action: {e}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
except requests.exceptions.RequestException as e:
return ErrorObservation(f'Failed to execute action: {e}')

I wonder if maybe we don't need this? I think if there's an exception, it will fall to the controller, and there the reset should do it if it's necessary 🤔


This is the default runtime used within OpenHands.

### Local Runtime

The Local Runtime is designed for direct execution on the local machine. Currently only supports running as `root`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Local Runtime is designed for direct execution on the local machine. Currently only supports running as `root`:
The Local Runtime is designed for direct execution on the local machine. Currently only supports running as the local user:

from typing import Callable


class LogBuffer:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe we don't need this class, it's actually become LogStreamer now in main, and this seems to be the older implementation - not in use, and it doesn't seem used by LocalRuntime either 🤔

async def execute_action(self, action: Action) -> Observation:
"""Execute an action by sending it to the server."""
if not self._runtime_initialized:
return ErrorObservation('Runtime not initialized')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return ErrorObservation('Runtime not initialized')
raise AgentRuntimeDisconnectedError('Runtime not initialized')

@jimwhite
Copy link

jimwhite commented Feb 1, 2025

"Smart Manoj" on Kaggle has made a version of OpenHands that works under the K-prize conditions (which includes no Docker container execution available) and it has actually solved one of the problems using a local LLM (Qwen 2.5 Instruct 32b).

https://www.kaggle.com/code/smartmanoj/openhands-fork-offline-version

Don't know if it is based on this issue's PR or not.

@enyst
Copy link
Collaborator

enyst commented Feb 1, 2025

On Mac, seems like it also needs:

openhands-ai-py3.12➜  odie git:(add-local-runtime) ✗ poetry add ipywidgets qtconsole
Using version ^8.1.5 for ipywidgets
Using version ^5.6.1 for qtconsole

Updating dependencies
Resolving dependencies... (4.5s)

Package operations: 5 installs, 2 updates, 0 removals

  - Updating llama-index-core (0.12.13 -> 0.12.14)
  - Installing jupyterlab-widgets (3.0.13)
  - Installing qtpy (2.4.2)
  - Installing widgetsnbextension (4.0.13)
  - Installing ipywidgets (8.1.5)
  - Updating llama-index (0.12.13 -> 0.12.14)
  - Installing qtconsole (5.6.1)

Writing lock file

Edited to add:
Also

brew install tmux

@enyst
Copy link
Collaborator

enyst commented Feb 1, 2025

I had some fun today with this branch! For some reason, of course Haiku decided to do on local what it usually doesn't do on docker, because of course! 😂

It works great. I didn't actually have errors yet, so I didn't get to see issues with those ErrorObs, but I think there would be, because they're also missing tool_id, so I still think we should raise exceptions instead. But I had fun with the experiment, this is a really cool runtime and I love it!

Note: we could add to documentation a note about Prompt Confirmation, because hey it's a feature that will prove incredibly useful, even for adventurous souls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants