hotfix(backend): Handle errors when executing run actions (#8160)

This commit is contained in:
sp.wack 2025-05-01 20:06:20 +04:00 committed by GitHub
parent 3edea7c710
commit 1ffaae17ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -309,19 +309,23 @@ class ActionExecutor:
async def run(
self, action: CmdRunAction
) -> CmdOutputObservation | ErrorObservation:
if action.is_static:
path = action.cwd or self._initial_cwd
result = await AsyncBashSession.execute(action.command, path)
obs = CmdOutputObservation(
content=result.content,
exit_code=result.exit_code,
command=action.command,
)
return obs
try:
if action.is_static:
path = action.cwd or self._initial_cwd
result = await AsyncBashSession.execute(action.command, path)
obs = CmdOutputObservation(
content=result.content,
exit_code=result.exit_code,
command=action.command,
)
return obs
assert self.bash_session is not None
obs = await call_sync_from_async(self.bash_session.execute, action)
return obs
assert self.bash_session is not None
obs = await call_sync_from_async(self.bash_session.execute, action)
return obs
except Exception as e:
logger.error(f'Error running command: {e}')
return ErrorObservation(str(e))
async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
assert self.bash_session is not None