Skip to content

Commit 8991be7

Browse files
committed
Remove HARD TIMEOUT
as NO_CHANGE_TIMEOUT is enough.
1 parent 014366d commit 8991be7

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

openhands/runtime/utils/bash.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ class BashCommandStatus(Enum):
158158
CONTINUE = 'continue'
159159
COMPLETED = 'completed'
160160
NO_CHANGE_TIMEOUT = 'no_change_timeout'
161-
HARD_TIMEOUT = 'hard_timeout'
162161

163162

164163
def _remove_command_prefix(command_output: str, command: str) -> str:
@@ -381,42 +380,6 @@ def _handle_nochange_timeout_command(
381380
metadata=metadata,
382381
)
383382

384-
def _handle_hard_timeout_command(
385-
self,
386-
command: str,
387-
pane_content: str,
388-
ps1_matches: list[re.Match],
389-
timeout: float,
390-
) -> CmdOutputObservation:
391-
self.prev_status = BashCommandStatus.HARD_TIMEOUT
392-
if len(ps1_matches) != 1:
393-
logger.warning(
394-
'Expected exactly one PS1 metadata block BEFORE the execution of a command, '
395-
f'but got {len(ps1_matches)} PS1 metadata blocks:\n---\n{pane_content!r}\n---'
396-
)
397-
raw_command_output = self._combine_outputs_between_matches(
398-
pane_content, ps1_matches
399-
)
400-
metadata = CmdOutputMetadata() # No metadata available
401-
metadata.suffix = (
402-
f'\n[The command timed out after {timeout} seconds. '
403-
"You may wait longer to see additional output by sending empty command '', "
404-
'send other commands to interact with the current process, '
405-
'or send keys to interrupt/kill the command.]'
406-
)
407-
command_output = self._get_command_output(
408-
command,
409-
raw_command_output,
410-
metadata,
411-
continue_prefix='[Command output continued from previous command]\n',
412-
)
413-
414-
return CmdOutputObservation(
415-
command=command,
416-
content=command_output,
417-
metadata=metadata,
418-
)
419-
420383
def _ready_for_next_command(self):
421384
"""Reset the content buffer for a new command."""
422385
# Clear the current content
@@ -495,7 +458,6 @@ def execute(self, action: CmdRunAction) -> CmdOutputObservation | ErrorObservati
495458
if command == '' and self.prev_status not in {
496459
BashCommandStatus.CONTINUE,
497460
BashCommandStatus.NO_CHANGE_TIMEOUT,
498-
BashCommandStatus.HARD_TIMEOUT,
499461
}:
500462
return CmdOutputObservation(
501463
content='ERROR: No previous command to continue from. '
@@ -581,18 +543,6 @@ def execute(self, action: CmdRunAction) -> CmdOutputObservation | ErrorObservati
581543
ps1_matches=ps1_matches,
582544
)
583545

584-
# 3) Execution timed out due to hard timeout
585-
logger.debug(
586-
f'CHECKING HARD TIMEOUT ({action.timeout}s): elapsed {time.time() - start_time}'
587-
)
588-
if action.timeout and time.time() - start_time >= action.timeout:
589-
return self._handle_hard_timeout_command(
590-
command,
591-
pane_content=cur_pane_output,
592-
ps1_matches=ps1_matches,
593-
timeout=action.timeout,
594-
)
595-
596546
logger.debug(f'SLEEPING for {self.POLL_INTERVAL} seconds for next poll')
597547
time.sleep(self.POLL_INTERVAL)
598548
raise RuntimeError('Bash session was likely interrupted...')

0 commit comments

Comments
 (0)