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

[Bug]: The service get stuck if I tap 'confirmed' twice(or more) consecutively #3899

Open
2 tasks done
WannaTen opened this issue Sep 16, 2024 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working severity:low Minor issues, affecting single user

Comments

@WannaTen
Copy link
Contributor

Is there an existing issue for the same bug?

Describe the bug

I activated confirmation mode while in browser mode. When the confirmation button shows up on the left, double-clicking(or even more clicks) it causes the agent to halt every time. To resume, I have to click the 'pause' button in the lower-left corner, then click 'continue'.

Current OpenHands version

0.9.3

Installation and Configuration

not used any command or specific configuration.

Model and Agent

No response

Operating System

WSL

Reproduction Steps

  1. open webUI
  2. open Confirm Mode with CodeActagent
  3. click the confirm button twice or more
  4. stuck....

Logs, Errors, Screenshots, and Additional Context

click it twice or more:
image

then the logger output like this, output two NullObservation, which made the whole process stuck:
image

The logger output is from the code I added for debug:
image

only after I clicked pause then continue, the whole process continue:
image

@WannaTen WannaTen added the bug Something isn't working label Sep 16, 2024
@WannaTen
Copy link
Contributor Author

23:36:38 - openhands:INFO: session.py:139 - Server event
23:36:38 - OBSERVATION
AgentStateChangedObservation(content='', agent_state=<AgentState.RUNNING: 'running'>, observation='agent_state_changed')
23:36:38 - openhands:INFO: session.py:139 - Server event
23:36:38 - OBSERVATION
AgentStateChangedObservation(content='', agent_state='user_confirmed', observation='agent_state_changed')
23:36:38 - openhands:INFO: session.py:139 - Server event
23:36:38 - OBSERVATION
NullObservation(content='', observation='null')
23:36:38 - OBSERVATION
NullObservation(content='', observation='null')
23:36:38 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:40520 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:40524 - "POST /execute_action HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
23:36:38 - openhands:INFO: runtime.py:414 - Awaiting session
23:36:38 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58818 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58822 - "POST /list_files HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
INFO:     127.0.0.1:58926 - "GET /api/list-files HTTP/1.1" 200 OK
23:36:38 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58836 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58848 - "POST /execute_action HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
23:36:38 - openhands:INFO: runtime.py:414 - Awaiting session
23:36:38 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58858 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58870 - "POST /list_files HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
INFO:     127.0.0.1:58939 - "GET /api/list-files HTTP/1.1" 200 OK
23:36:38 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58874 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58880 - "POST /execute_action HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
23:36:39 - openhands:INFO: runtime.py:414 - Awaiting session
23:36:39 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58892 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58906 - "POST /list_files HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
INFO:     127.0.0.1:58926 - "GET /api/list-files HTTP/1.1" 200 OK
23:41:41 - OBSERVATION
AgentStateChangedObservation(content='', agent_state='paused', observation='agent_state_changed')
23:41:41 - openhands:INFO: session.py:139 - Server event
23:41:41 - OBSERVATION
NullObservation(content='', observation='null')
23:41:41 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:58918 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:58928 - "POST /execute_action HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
23:41:41 - openhands:INFO: runtime.py:414 - Awaiting session
INFO:     127.0.0.1:59511 - "GET /api/list-files HTTP/1.1" 200 OK
23:41:50 - OBSERVATION
AgentStateChangedObservation(content='', agent_state='running', observation='agent_state_changed')
23:41:50 - openhands:INFO: session.py:139 - Server event
23:41:50 - OBSERVATION
NullObservation(content='', observation='null')
23:41:50 - openhands:INFO: runtime.py:307 -

-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:38586 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:38602 - "POST /list_files HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:38604 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:38620 - "POST /execute_action HTTP/1.1" 200 OK
--------------------------------------------------------------------------------
23:41:50 - openhands:INFO: runtime.py:414 - Awaiting session
23:41:50 - openhands:INFO: runtime.py:307 -
-----------------------------------Container logs:-----------------------------------
    |INFO:     172.17.0.1:50862 - "GET /alive HTTP/1.1" 200 OK
    |INFO:     172.17.0.1:50878 - "POST /list_files HTTP/1.1" 200 OK
--------------------------------------------------------------------------------

@s-smits
Copy link

s-smits commented Nov 2, 2024

Same problem here. it's suck at GET /api/list-files HTTP/1.1 using Qwen72B through openrouter; I don't think this is an API issue but not sure.

Claude 3.5 Sonnet:
Based on the error stack trace, this appears to be a configuration/URL issue rather than an API issue. The key error message is:

httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

This suggests that somewhere in your configuration (likely where you're setting up the OpenRouter/Qwen72B connection), the URL is malformed or missing the protocol prefix (http:// or https://).

To fix this, you should check:

  1. Your OpenRouter API base URL configuration - make sure it includes the full URL with protocol, e.g.:
base_url = "https://openrouter.ai/api/v1"  # Not just "openrouter.ai/api/v1"
  1. If you're using environment variables or a config file, verify that the URL is properly formatted there.

The subsequent errors (including the UnboundLocalError) are cascading effects from this initial URL protocol issue. Fix the base URL configuration, and these errors should resolve.

Would you like me to help you check your configuration setup?

16:08:07 - openhands:ERROR: agent_controller.py:135 - [Agent Controller 5598d053-f7bd-42b0-94d6-47954ce16e10] Error while running the agent: cannot access local variable 'error_str' where it is not associated with a value
16:08:07 - openhands:ERROR: agent_controller.py:135 - [Agent Controller 5598d053-f7bd-42b0-94d6-47954ce16e10] Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions
    yield
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 236, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 167, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

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

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 990, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 926, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 954, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 991, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1027, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 235, in handle_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions
    yield
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 236, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 167, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

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

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 990, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 926, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 954, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 991, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1027, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 235, in handle_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions
    yield
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 236, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 167, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

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

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 990, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 926, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 954, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 991, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1027, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 235, in handle_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/app/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

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

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/litellm/llms/OpenAI/openai.py", line 854, in completion
    raise e
  File "/app/.venv/lib/python3.12/site-packages/litellm/llms/OpenAI/openai.py", line 790, in completion
    self.make_sync_openai_chat_completion_request(
  File "/app/.venv/lib/python3.12/site-packages/litellm/llms/OpenAI/openai.py", line 649, in make_sync_openai_chat_completion_request
    raise e
  File "/app/.venv/lib/python3.12/site-packages/litellm/llms/OpenAI/openai.py", line 631, in make_sync_openai_chat_completion_request
    raw_response = openai_client.chat.completions.with_raw_response.create(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_legacy_response.py", line 356, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 274, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 815, in create
    return self._post(
           ^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1277, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 954, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1014, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1092, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1014, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1092, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1024, in _request
    raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 2168, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/litellm/llms/OpenAI/openai.py", line 864, in completion
    raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError: Connection error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/openhands/controller/agent_controller.py", line 168, in start_step_loop
    await self._step()
  File "/app/openhands/controller/agent_controller.py", line 462, in _step
    action = self.agent.step(self.state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/agenthub/codeact_agent/codeact_agent.py", line 345, in step
    response = self.llm.completion(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/app/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/app/openhands/llm/llm.py", line 248, in wrapper
    resp: ModelResponse = completion_unwrapped(*args, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1013, in wrapper
    raise e
  File "/app/.venv/lib/python3.12/site-packages/litellm/utils.py", line 903, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/litellm/main.py", line 2999, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2116, in exception_type
    raise e
  File "/app/.venv/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2086, in exception_type
    message="{} - {}".format(exception_provider, error_str),
                                                 ^^^^^^^^^
UnboundLocalError: cannot access local variable 'error_str' where it is not associated with a value

16:08:07 - openhands:INFO: agent_controller.py:135 - [Agent Controller 5598d053-f7bd-42b0-94d6-47954ce16e10] Setting agent(CodeActAgent) state from AgentState.RUNNING to AgentState.ERROR
INFO:     192.168.65.1:64166 - "GET /config.json HTTP/1.1" 200 OK
INFO:     192.168.65.1:59609 - "GET /config.json HTTP/1.1" 200 OK
INFO:     192.168.65.1:26034 - "GET /api/list-files HTTP/1.1" 200 OK

Provider List: https://docs.litellm.ai/docs/providers


Provider List: https://docs.litellm.ai/docs/providers

INFO:     192.168.65.1:59609 - "GET /api/list-files HTTP/1.1" 200 OK

Provider List: https://docs.litellm.ai/docs/providers


Provider List: https://docs.litellm.ai/docs/providers

INFO:     192.168.65.1:26034 - "GET /api/list-files HTTP/1.1" 200 OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity:low Minor issues, affecting single user
Projects
None yet
Development

No branches or pull requests

3 participants