Skip to content

Commit

Permalink
increase history limit
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww committed Dec 5, 2024
1 parent 0514bed commit 4a2c880
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion openhands/runtime/utils/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,22 @@ def __init__(
x=1000,
y=1000,
)
self.pane = self.session.attached_pane

# Set history limit to a large number to avoid losing history
# https://unix.stackexchange.com/questions/43414/unlimited-history-in-tmux
_history_limit = 100_000
self.session.set_option('history-limit', str(_history_limit), _global=True)
self.session.history_limit = _history_limit
# We need to create a new pane because the initial pane's history limit is (default) 2000
_initial_window = self.session.attached_window
self.window = self.session.new_window(
window_shell=window_command,
start_directory=work_dir,
)
self.pane = self.window.attached_pane
logger.debug(f'pane: {self.pane}; history_limit: {self.session.history_limit}')
_initial_window.kill_window()

# Configure bash to use simple PS1 and disable PS2
self.pane.send_keys(
f'export PROMPT_COMMAND=\'export PS1="{self.PS1}"\'; export PS2=""'
Expand Down Expand Up @@ -359,6 +374,7 @@ def _combine_outputs_between_matches(
ps1_matches[i].end() + 1 : ps1_matches[i + 1].start()
]
combined_output += output_segment + '\n'
logger.debug(f'COMBINED OUTPUT: {combined_output}')
return combined_output

def execute(self, action: CmdRunAction) -> CmdOutputObservation | ErrorObservation:
Expand Down

0 comments on commit 4a2c880

Please sign in to comment.