Fix issue #5234: [Bug]: [Resolver] Error when parsing the JSON response on success

This commit is contained in:
openhands 2024-11-27 01:46:38 +00:00
parent 9a96e9f1e4
commit f6e4160884
6 changed files with 11 additions and 20 deletions

View File

@ -61,7 +61,7 @@ The core configuration options are defined in the `[core]` section of the `confi
- Description: API key for E2B
- `modal_api_token_id`
- Type: `str`
- Type: `str`
- Default: `""`
- Description: API token ID for Modal
@ -455,5 +455,3 @@ The security configuration options are defined in the `[security]` section of th
> **Note**: Adjust configurations carefully, especially for memory, security, and network-related settings to ensure optimal performance and security.
Please note that the configuration options may be subject to change in future versions of OpenHands. It's recommended to refer to the official documentation for the most up-to-date information.

View File

@ -2,7 +2,6 @@
import asyncio
import dataclasses
import json
import os
import pathlib
import shutil
@ -254,13 +253,8 @@ async def process_issue(
if issue_handler.issue_type == 'pr' and comment_success:
success_log = 'I have updated the PR and resolved some of the issues that were cited in the pull request review. Specifically, I identified the following revision requests, and all the ones that I think I successfully resolved are checked off. All the unchecked ones I was not able to resolve, so manual intervention may be required:\n'
try:
explanations = json.loads(success_explanation)
except json.JSONDecodeError:
logger.error(
f'Failed to parse success_explanation as JSON: {success_explanation}'
)
explanations = [str(success_explanation)] # Use raw string as fallback
# Split the explanation into a list by newlines since each explanation is separated by newlines
explanations = success_explanation.split('\n')
for success_indicator, explanation in zip(comment_success, explanations):
status = (

View File

@ -10,7 +10,6 @@ import requests
import tenacity
from openhands.core.config import AppConfig
from openhands.core.logger import openhands_logger as logger
from openhands.events import EventStream
from openhands.events.action import (
BrowseInteractiveAction,

View File

@ -8,19 +8,19 @@ interruptions are recoverable.
There are 3 main server side event handlers:
* `connect` - Invoked when a new connection to the server is established. (This may be via http or WebSocket)
* `oh_action` - Invoked when a connected client sends an event (Such as `INIT` or a prompt for the Agent) -
* `oh_action` - Invoked when a connected client sends an event (Such as `INIT` or a prompt for the Agent) -
this is distinct from the `oh_event` sent from the server to the client.
* `disconnect` - Invoked when a connected client disconnects from the server.
## Init
Each connection has a unique id, and when initially established, is not associated with any session. An
`INIT` event must be sent to the server in order to attach a connection to a session. The `INIT` event
may optionally include a GitHub token and a token to connect to an existing session. (Which may be running
locally or may need to be hydrated). If no token is received as part of the init event, it is assumed a
`INIT` event must be sent to the server in order to attach a connection to a session. The `INIT` event
may optionally include a GitHub token and a token to connect to an existing session. (Which may be running
locally or may need to be hydrated). If no token is received as part of the init event, it is assumed a
new session should be started.
## Disconnect
The (manager)[manager.py] manages connections and sessions. Each session may have zero or more connections
The (manager)[manager.py] manages connections and sessions. Each session may have zero or more connections
associated with it, managed by invocations of `INIT` and disconnect. When a session no longer has any
connections associated with it, after a set amount of time (determined by `config.sandbox.close_delay`),
the session and runtime are passivated (So will need to be rehydrated to continue.)
the session and runtime are passivated (So will need to be rehydrated to continue.)

View File

@ -8,7 +8,6 @@ from openhands.core.config import AppConfig
from openhands.core.const.guide_url import TROUBLESHOOTING_URL
from openhands.core.logger import openhands_logger as logger
from openhands.core.schema import AgentState
from openhands.core.schema.action import ActionType
from openhands.core.schema.config import ConfigType
from openhands.events.action import MessageAction, NullAction
from openhands.events.event import Event, EventSource
@ -23,7 +22,6 @@ from openhands.events.stream import EventStreamSubscriber
from openhands.llm.llm import LLM
from openhands.server.session.agent_session import AgentSession
from openhands.storage.files import FileStore
from openhands.utils.async_utils import call_coro_in_bg_thread
ROOM_KEY = 'room:{sid}'

View File

@ -97,6 +97,7 @@ reportlab = "*"
[tool.coverage.run]
concurrency = ["gevent"]
[tool.poetry.group.runtime.dependencies]
jupyterlab = "*"
notebook = "*"
@ -127,6 +128,7 @@ ignore = ["D1"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.poetry.group.evaluation.dependencies]
streamlit = "*"
whatthepatch = "*"