Skip to content

Commit

Permalink
fix python lint
Browse files Browse the repository at this point in the history
  • Loading branch information
toshok committed Nov 13, 2024
1 parent e6c7c5e commit b73f09a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions openhands/core/config/app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
get_field_info,
)
from openhands.core.config.llm_config import LLMConfig
from openhands.core.config.replay_config import ReplayConfig
from openhands.core.config.sandbox_config import SandboxConfig
from openhands.core.config.security_config import SecurityConfig

Expand Down Expand Up @@ -42,11 +43,13 @@ class AppConfig:
file_uploads_max_file_size_mb: Maximum file size for uploads in megabytes. 0 means no limit.
file_uploads_restrict_file_types: Whether to restrict file types for file uploads. Defaults to False.
file_uploads_allowed_extensions: List of allowed file extensions for uploads. ['.*'] means all extensions are allowed.
replay: Settings related to replay integration.
"""

llms: dict[str, LLMConfig] = field(default_factory=dict)
agents: dict = field(default_factory=dict)
default_agent: str = OH_DEFAULT_AGENT
replay: ReplayConfig = field(default_factory=ReplayConfig)
sandbox: SandboxConfig = field(default_factory=SandboxConfig)
security: SecurityConfig = field(default_factory=SecurityConfig)
runtime: str = 'eventstream'
Expand Down
8 changes: 7 additions & 1 deletion openhands/runtime/action_execution_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
FileReadAction,
FileWriteAction,
IPythonRunCellAction,
ReplayCmdRunAction,
)
from openhands.events.observation import (
CmdOutputObservation,
Expand All @@ -42,6 +43,7 @@
FileWriteObservation,
IPythonRunCellObservation,
Observation,
ReplayCmdOutputObservation,
)
from openhands.events.serialization import event_from_dict, event_to_dict
from openhands.runtime.browser import browse
Expand Down Expand Up @@ -171,7 +173,7 @@ async def run(
) -> CmdOutputObservation | FatalErrorObservation:
return self.bash_session.run(action)

async def run_replay(self, action: ReplayCmdRunAction) -> ReplayCmdOutputObservation:
async def run_replay(self, action: ReplayCmdRunAction) -> ReplayCmdOutputObservation | FatalErrorObservation:
command = f'/replay/replayapi/scripts/run.sh {action.command}'
if action.recording_id != '':
command = command + f' -r {action.recording_id}'
Expand All @@ -189,6 +191,10 @@ async def run_replay(self, action: ReplayCmdRunAction) -> ReplayCmdOutputObserva
)
cmd_action.timeout = 600
obs = self.bash_session.run(cmd_action)

if isinstance(obs, FatalErrorObservation):
return obs

# we might not actually need a separate observation type for replay...
return ReplayCmdOutputObservation(
command_id=obs.command_id,
Expand Down

0 comments on commit b73f09a

Please sign in to comment.