OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Released resolver doesn't run due to "Invalid token" error

Open malhotra5 opened this issue 9 months ago • 9 comments

Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).

  • [x] I have checked the existing issues.

Describe the bug and reproduction steps

https://github.com/malhotra5/test-repo/actions/runs/14543443533/job/40805579570

^ I've attached logs for the error. Can't run the latest released resolver at all because of this. I think this would be affecting all users?

OpenHands Installation

GitHub resolver

OpenHands Version

No response

Operating System

None

Logs, Errors, Screenshots, and Additional Context

ERROR:root:  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 773, in <module>
    main()
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 769, in main
    asyncio.run(issue_resolver.resolve_issue())
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 568, in resolve_issue
    output = await self.process_issue(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 279, in process_issue
    await runtime.connect()
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/impl/docker/docker_runtime.py", line 189, in connect
    await call_sync_from_async(self.setup_initial_env)
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/utils/async_utils.py", line 18, in call_sync_from_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/utils/async_utils.py", line 17, in <lambda>
    coro = loop.run_in_executor(None, lambda: fn(*args, **kwargs))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/base.py", line 167, in setup_initial_env
    self.add_env_vars(self.initial_env_vars)
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/base.py", line 227, in add_env_vars
    obs = self.run(CmdRunAction(cmd))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/impl/action_execution/action_execution_client.py", line 310, in run
    return self.send_action_for_execution(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/impl/action_execution/action_execution_client.py", line 292, in send_action_for_execution
    response = self._send_action_server_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/impl/action_execution/action_execution_client.py", line 128, in _send_action_server_request
    return send_request(self.session, method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/runtime/utils/request.py", line 54, in send_request
    raise RequestHTTPError(

ERROR:root:<class 'openhands.runtime.utils.request.RequestHTTPError'>: Server error '500 Internal Server Error' for url 'http://localhost:30526/execute_action'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
Details: Traceback (most recent call last):
  File "/openhands/code/openhands/events/serialization/action.py", line 122, in action_from_dict
    decoded_action = action_class(**args)
                     ^^^^^^^^^^^^^^^^^^^^
TypeError: CmdRunAction.__init__() got an unexpected keyword argument 'is_static'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openhands/code/openhands/runtime/action_execution_server.py", line 632, in execute_action
    action = event_from_dict(action_request.action)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openhands/code/openhands/events/serialization/event.py", line 56, in event_from_dict
    evt = action_from_dict(data)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/openhands/code/openhands/events/serialization/action.py", line 132, in action_from_dict
    raise LLMMalformedActionError(
openhands.core.exceptions.LLMMalformedActionError

malhotra5 avatar Apr 19 '25 00:04 malhotra5

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

openhands-agent avatar Apr 19 '25 01:04 openhands-agent

I'm curious if experimental works.

enyst avatar Apr 19 '25 01:04 enyst

Looking into this now

  1. I think experimental is down due to action serialization issue
  2. I think released resolver is down but the fix was merged today in #7934

malhotra5 avatar Apr 19 '25 01:04 malhotra5

Looks like experimental works. I think the reason for the is_static issue is the runtime is on a different version (older) than the code running.

enyst avatar Apr 19 '25 01:04 enyst

Hmm this is weird, I ran openhands experimental on a test repo and it still failed: https://github.com/malhotra5/test-repo/actions/runs/14544104353/job/40807085671

EDIT: Specifically this workflow run installed openhands using pip install git+https://github.com/all-hands-ai/openhands.git

malhotra5 avatar Apr 19 '25 01:04 malhotra5

^ Oh sorry for the noise experimental does work, my workflow definition in my personal repo was incorrect

Although looks like we should patch release #7934 maybe

malhotra5 avatar Apr 19 '25 01:04 malhotra5

Hmm this is weird, I ran openhands experimental on a test repo and it still failed: https://github.com/malhotra5/test-repo/actions/runs/14544104353/job/40807085671

EDIT: Specifically this workflow run installed openhands using pip install git+https://github.com/all-hands-ai/openhands.git

I see, but for some reason this one ran nikolaik https://github.com/malhotra5/test-repo/actions/runs/14544104353/job/40807085671#step:10:40

enyst avatar Apr 19 '25 01:04 enyst

Yeah the workflow definition wasn't passing the experimental env to resolve_issue.py; so instead of building the runtime image it was pulling it

That's was an improper workflow definition on my part

This run worked as expected when I fixed my workflow definition: https://github.com/malhotra5/test-repo/actions/runs/14544289306/job/40807522801

malhotra5 avatar Apr 19 '25 01:04 malhotra5

Note for released resolver, the error logs are

ERROR:root:  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 734, in <module>
    main()
  File "/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/openhands/resolver/resolve_issue.py", line 673, in main
Error:     raise ValueError('Token is invalid.')

ERROR:root:<class 'ValueError'>: Token is invalid.
Error: Process completed with exit code 1.

This should be fixed with a release

malhotra5 avatar Apr 19 '25 01:04 malhotra5

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

openhands-agent avatar Apr 19 '25 15:04 openhands-agent

Any change my PAT token issue #7957 is related to this issue?

ryx2 avatar Apr 20 '25 06:04 ryx2

Answering my own question: when i run with 'fix-me', it fails, but when i run with 'fix-me-experimental' with the same setup it works.

ryx2 avatar Apr 20 '25 06:04 ryx2

Would there be any interest in adding a openhands-version flag to the resolver? I could make a PR. I notice that when I run the resolver every couple of days or so, if i dont update my workflow, it sometimes will fail, and I don't really want to do that much work in my own repo to keep up with resolver bugs and workflow updates, I would like something more stable. a simple openhands-version would allow people like me to always pull the same stable version that i set my workflow to. otherwise, my workflow is the way it is but the newest """stable""" version expects something different or otherwise errors like this

ryx2 avatar Apr 20 '25 06:04 ryx2

Yes I think that's a good idea @ryx2. It should be like anything else. You choose the version to run and whenever you choose to, you can upgrade it. This will definitely help with things all of a sudden not working.

mamoodi avatar Apr 20 '25 15:04 mamoodi

@malhotra5 can this be closed?

mamoodi avatar May 05 '25 13:05 mamoodi

Yup this is resolved!

malhotra5 avatar May 25 '25 18:05 malhotra5