From 8e028e6dd89ed92d9e5c005d1ff08e926315c8a2 Mon Sep 17 00:00:00 2001 From: riiiiiiiis Date: Wed, 27 May 2026 03:30:39 -0300 Subject: [PATCH 1/3] fix(terminal): reduce tmux session viewport Co-authored-by: openhands --- openhands-tools/openhands/tools/terminal/constants.py | 8 ++++---- tests/tools/terminal/test_tmux_pane_pool.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openhands-tools/openhands/tools/terminal/constants.py b/openhands-tools/openhands/tools/terminal/constants.py index b6cb4cc082..18d3f2879a 100644 --- a/openhands-tools/openhands/tools/terminal/constants.py +++ b/openhands-tools/openhands/tools/terminal/constants.py @@ -36,7 +36,7 @@ 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. +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..70083b916d 100644 --- a/tests/tools/terminal/test_tmux_pane_pool.py +++ b/tests/tools/terminal/test_tmux_pane_pool.py @@ -6,9 +6,20 @@ import pytest +from openhands.tools.terminal.constants import ( + HISTORY_LIMIT, + TMUX_SESSION_HEIGHT, + TMUX_SESSION_WIDTH, +) from openhands.tools.terminal.terminal.tmux_pane_pool import TmuxPanePool +def test_tmux_session_viewport_is_smaller_than_scrollback(): + assert TMUX_SESSION_WIDTH <= 256 + assert TMUX_SESSION_HEIGHT <= 200 + assert HISTORY_LIMIT >= 10_000 + + @pytest.fixture def pool(): """Create and initialize a pool, close it after the test.""" From efdff15b1545c492701de00496c1a16e4dc1f966 Mon Sep 17 00:00:00 2001 From: riiiiiiiis Date: Wed, 27 May 2026 03:52:41 -0300 Subject: [PATCH 2/3] test(terminal): pin tmux viewport constants --- tests/tools/terminal/test_tmux_pane_pool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tools/terminal/test_tmux_pane_pool.py b/tests/tools/terminal/test_tmux_pane_pool.py index 70083b916d..70d76d62b4 100644 --- a/tests/tools/terminal/test_tmux_pane_pool.py +++ b/tests/tools/terminal/test_tmux_pane_pool.py @@ -15,9 +15,9 @@ def test_tmux_session_viewport_is_smaller_than_scrollback(): - assert TMUX_SESSION_WIDTH <= 256 - assert TMUX_SESSION_HEIGHT <= 200 - assert HISTORY_LIMIT >= 10_000 + assert TMUX_SESSION_WIDTH == 256 + assert TMUX_SESSION_HEIGHT == 200 + assert HISTORY_LIMIT == 10_000 @pytest.fixture From 3c8eae78f6a7c499b405ef7fec5e4470fb75f2ab Mon Sep 17 00:00:00 2001 From: riiiiiiiis Date: Wed, 27 May 2026 06:57:59 -0300 Subject: [PATCH 3/3] test(terminal): relax tmux viewport invariant --- openhands-tools/openhands/tools/terminal/constants.py | 2 ++ tests/tools/terminal/test_tmux_pane_pool.py | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openhands-tools/openhands/tools/terminal/constants.py b/openhands-tools/openhands/tools/terminal/constants.py index 18d3f2879a..d8f6a33515 100644 --- a/openhands-tools/openhands/tools/terminal/constants.py +++ b/openhands-tools/openhands/tools/terminal/constants.py @@ -38,5 +38,7 @@ # 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 70d76d62b4..5545d8b78a 100644 --- a/tests/tools/terminal/test_tmux_pane_pool.py +++ b/tests/tools/terminal/test_tmux_pane_pool.py @@ -7,17 +7,15 @@ import pytest from openhands.tools.terminal.constants import ( - HISTORY_LIMIT, TMUX_SESSION_HEIGHT, TMUX_SESSION_WIDTH, ) from openhands.tools.terminal.terminal.tmux_pane_pool import TmuxPanePool -def test_tmux_session_viewport_is_smaller_than_scrollback(): - assert TMUX_SESSION_WIDTH == 256 - assert TMUX_SESSION_HEIGHT == 200 - assert HISTORY_LIMIT == 10_000 +def test_tmux_session_viewport_is_bounded(): + assert TMUX_SESSION_WIDTH <= 256 + assert TMUX_SESSION_HEIGHT <= 200 @pytest.fixture