fix(terminal): a pane on a hidden tab never shrinks its tmux window

A terminal mounted on a hidden tab sits in a 0x0 box; its first fit shrank
xterm to 12x6 and the attach carried that size to tmux, so every background
pane was squeezed (Claude's TUI redrawn at 12 columns). It now neither fits
nor reports a size until shown, attaches with no size, and the server spawns
such an attach at the window's own size (tmux.windowSize). A shown tab
reports its size even when the fit did not change xterm's.

Settings > Agents shows the host's login profiles to staff only: a developer
got two 403s from reads that were never theirs.
This commit is contained in:
2026-10-26 14:53:29 +07:00
parent e3745d7504
commit a0cd808456
9 changed files with 151 additions and 30 deletions
+7 -3
View File
@@ -115,13 +115,17 @@ const PTY_PATH_RE = /^\/ws-pty\/(agenthub-lane-\d+(?:-[1-9])?)$/;
* `resize` message lands, leaving 80-column wreckage in the scrollback that
* shows up as torn left-margin fragments when the user scrolls back
* (issue #33). Bounded, because this number reaches a `TIOCSWINSZ` ioctl.
* No size at all (a terminal on a hidden tab has none to give) stays
* `undefined`: the attach then takes the window's own size and resizes nothing.
*/
function sizeFromQuery(params) {
const read = (name, fallback) => {
const read = (name) => {
const parsed = Number.parseInt(params.get(name) ?? "", 10);
return Number.isInteger(parsed) && parsed >= 2 && parsed <= 1000 ? parsed : fallback;
return Number.isInteger(parsed) && parsed >= 2 && parsed <= 1000 ? parsed : undefined;
};
return { cols: read("cols", 80), rows: read("rows", 24) };
const cols = read("cols");
const rows = read("rows");
return cols && rows ? { cols, rows } : { cols: undefined, rows: undefined };
}
/**