mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-17 04:01:13 +00:00
fix(code_execution): recover from closed PTY sessions
Detect closed or exited local TTY sessions before writing, convert invalid PTY write errors into retryable session failures, and reset/retry the terminal session once after send/read failures.
This commit is contained in:
parent
2ce1947b0f
commit
a0f0c2e8d2
2 changed files with 16 additions and 7 deletions
|
|
@ -194,12 +194,11 @@ class CodeExecution(Tool):
|
|||
)
|
||||
|
||||
except Exception as e:
|
||||
if i == 1:
|
||||
PrintStyle.error(str(e))
|
||||
await self.prepare_state(cfg, reset=True, session=session)
|
||||
PrintStyle.error(str(e))
|
||||
await self.prepare_state(cfg, reset=True, session=session)
|
||||
if i == 0:
|
||||
continue
|
||||
else:
|
||||
raise e
|
||||
raise e
|
||||
|
||||
def format_command_for_output(self, command: str):
|
||||
short_cmd = command[:250]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue