diff --git a/openhands-tools/openhands/tools/terminal/constants.py b/openhands-tools/openhands/tools/terminal/constants.py index b6cb4cc082..d8f6a33515 100644 --- a/openhands-tools/openhands/tools/terminal/constants.py +++ b/openhands-tools/openhands/tools/terminal/constants.py @@ -36,7 +36,9 @@ TMUX_SOCKET_NAME: Final[str] = "openhands" -# Tmux session dimensions (columns x rows). -# Large values ensure output is not wrapped or truncated by the virtual terminal. -TMUX_SESSION_WIDTH: Final[int] = 1000 -TMUX_SESSION_HEIGHT: Final[int] = 1000 +# Tmux session dimensions (columns x rows). Keep the viewport wide enough for +# common command output while leaving scrollback retention to HISTORY_LIMIT. +# Output wider than TMUX_SESSION_WIDTH columns will wrap; this is an accepted +# tradeoff to avoid the oversized 1000x1000 virtual terminal grid. +TMUX_SESSION_WIDTH: Final[int] = 256 +TMUX_SESSION_HEIGHT: Final[int] = 200 diff --git a/tests/tools/terminal/test_tmux_pane_pool.py b/tests/tools/terminal/test_tmux_pane_pool.py index cb0ac610f0..5545d8b78a 100644 --- a/tests/tools/terminal/test_tmux_pane_pool.py +++ b/tests/tools/terminal/test_tmux_pane_pool.py @@ -6,9 +6,18 @@ import pytest +from openhands.tools.terminal.constants import ( + TMUX_SESSION_HEIGHT, + TMUX_SESSION_WIDTH, +) from openhands.tools.terminal.terminal.tmux_pane_pool import TmuxPanePool +def test_tmux_session_viewport_is_bounded(): + assert TMUX_SESSION_WIDTH <= 256 + assert TMUX_SESSION_HEIGHT <= 200 + + @pytest.fixture def pool(): """Create and initialize a pool, close it after the test."""