Summary
When attaching to a running sandbox with sbx exec -it, the PTY allocated inside the sandbox has no window size set. stty size returns 0 0 and the shell falls back to COLUMNS=80, causing prompts and TUIs to wrap incorrectly. Resizing the host terminal window after attach does not fix it — the new size is never propagated either. Passing -t/--tty explicitly (in addition to or instead of -it) makes no difference.
Reproduction
Using the base claude-code template (no customisation):
sbx run claude .
sbx exec -it claude-myproject bash
Inside the sandbox:
agent@claude-myproject:~/workspace$ stty size
0 0
agent@claude-myproject:~/workspace$ echo $COLUMNS
80
Now resize the iTerm window (drag a corner) and re-check — size is still wrong:
agent@claude-myproject:~/workspace$ stty size
0 0
agent@claude-myproject:~/workspace$ echo $COLUMNS
80
Same result with explicit --tty:
$ sbx exec -i --tty claude-myproject bash
agent@claude-myproject:~/workspace$ stty size
0 0
Expected behaviour
stty size inside the sandbox should report the host terminal's actual rows/cols, matching what stty size returns on the host. SIGWINCH should be forwarded when the host window is resized. This matches the behaviour of docker exec -it.
Actual behaviour
- Initial PTY size is
0 0 (kernel TIOCGWINSZ returns zeros).
COLUMNS defaults to 80, LINES is unset.
- Host window resize is not propagated — size remains
0 0.
- Shells, prompts, and TUIs render as if on an 80-column terminal, causing visible wrapping (e.g. long prompts wrap mid-word).
-t / --tty is accepted but has no effect on this behaviour — a PTY is allocated, but with zero dimensions.
Impact
- Interactive shells render incorrectly when the host terminal is wider/taller than 80x24.
- TUIs (Claude Code, vim, tmux, less, etc.) cannot lay out correctly.
- Workarounds require the user to manually run
stty rows N cols N after every attach, which is fragile and doesn't handle subsequent resizes.
Environment
sbx version: 0.26.1
- Host OS: macOS Tahoe 26.4
Summary
When attaching to a running sandbox with
sbx exec -it, the PTY allocated inside the sandbox has no window size set.stty sizereturns0 0and the shell falls back toCOLUMNS=80, causing prompts and TUIs to wrap incorrectly. Resizing the host terminal window after attach does not fix it — the new size is never propagated either. Passing-t/--ttyexplicitly (in addition to or instead of-it) makes no difference.Reproduction
Using the base
claude-codetemplate (no customisation):Inside the sandbox:
Now resize the iTerm window (drag a corner) and re-check — size is still wrong:
Same result with explicit
--tty:Expected behaviour
stty sizeinside the sandbox should report the host terminal's actual rows/cols, matching whatstty sizereturns on the host.SIGWINCHshould be forwarded when the host window is resized. This matches the behaviour ofdocker exec -it.Actual behaviour
0 0(kernelTIOCGWINSZreturns zeros).COLUMNSdefaults to80,LINESis unset.0 0.-t/--ttyis accepted but has no effect on this behaviour — a PTY is allocated, but with zero dimensions.Impact
stty rows N cols Nafter every attach, which is fragile and doesn't handle subsequent resizes.Environment
sbxversion: 0.26.1