From 701bd57293c4e6734f59b8523d1e4fc37e18eade Mon Sep 17 00:00:00 2001 From: Fusion Date: Sun, 24 May 2026 19:07:37 +0200 Subject: [PATCH] fix: send stty resize on every resize, not just first time The _stty_sent guard prevented the container shell from updating its terminal size after the first resize. This caused visual mismatches where xterm.js displayed at the new size but the shell still wrapped output at the old size. Remove the guard so stty is sent on every resize event. --- apps/api/src/services/terminal_session.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/api/src/services/terminal_session.py b/apps/api/src/services/terminal_session.py index 396f9d1..e45f546 100644 --- a/apps/api/src/services/terminal_session.py +++ b/apps/api/src/services/terminal_session.py @@ -154,12 +154,10 @@ class TerminalSession: # Docker exec doesn't forward PTY resize to the container process, # so we need to explicitly set the size inside the container shell. - # Only do this on the first resize to avoid interfering with user input. - if not getattr(self, '_stty_sent', False): - self._stty_sent = True - stty_cmd = f"stty cols {cols} rows {rows}\n".encode() - await self.write_input(stty_cmd) - logger.info(f"Sent stty command to container for session {self.session_id}: {cols}x{rows}") + # Send on every resize so the container shell always matches the frontend. + stty_cmd = f"stty cols {cols} rows {rows}\n".encode() + await self.write_input(stty_cmd) + logger.debug(f"Sent stty resize to container for session {self.session_id}: {cols}x{rows}") async def reset(self) -> None: """Reset the session by killing the process and clearing state."""