Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(tmux): unset the override/feature arrays a long-lived server accumulated

enes75d7f38a9468
diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.ts
index 854167851..ad2f6cc69 100644
--- a/src/core/pty-manager.ts
+++ b/src/core/pty-manager.ts
@@ -72,6 +72,13 @@ set -g destroy-unattached off
setw -g aggressive-resize on
# Copy to the SYSTEM clipboard via OSC 52 (the client's terminal writes it). BOTH lines are needed
# on tmux 3.2+ — see tmuxConf's doc comment before touching either.
+# MIGRATION — do not remove. Older versions of this file blanked smcup/rmcup/indn via
+# terminal-overrides, and a long-lived tmux server keeps every entry ever sourced into it (the
+# array only grows; -f is read once at server start). With those stale entries present the client
+# never returns to the alternate screen and scrolling stays broken NO MATTER what this file sets
+# below. Unset both arrays back to defaults, then re-add the one feature we actually want.
+set -su terminal-overrides
+set -su terminal-features
set -g set-clipboard on
set -as terminal-features ",*:clipboard"
# Mouse copy: on release tmux copies to its buffer AND (thanks to the two lines above) emits OSC 52,
diff --git a/src/shared/ssh.test.ts b/src/shared/ssh.test.ts
index 92c69b52b..80920d35d 100644
--- a/src/shared/ssh.test.ts
+++ b/src/shared/ssh.test.ts
@@ -160,7 +160,16 @@ describe('remoteTmuxConf', () => {
expect(c).toContain('set -g set-clipboard on')
expect(c).toContain('set -as terminal-features ",*:clipboard"')
expect(c).not.toContain('Ms=')
- expect(c).not.toContain('terminal-overrides')
+ // The only terminal-overrides mention allowed is the MIGRATION unset — never a new entry.
+ expect(c).not.toMatch(/set -g[a]? terminal-overrides/)
+ expect(c).not.toMatch(/set -a[gs]? terminal-overrides/)
+ })
+ it('clears the override/feature arrays a long-lived server accumulated from older versions', () => {
+ // A tmux server outlives the app and keeps every entry ever sourced into it; the stale
+ // smcup@/rmcup@/indn@ entries would otherwise keep breaking scrolling forever. Measured:
+ // sourcing these unsets into a poisoned server restored the alternate screen for new clients.
+ expect(c).toContain('set -su terminal-overrides')
+ expect(c).toContain('set -su terminal-features')
})
it('copies mouse selections through tmux, with no pbcopy (it would run on the remote host)', () => {
expect(c).toContain('bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel')
diff --git a/src/shared/ssh.ts b/src/shared/ssh.ts
index 8bc757488..8a3f7b23e 100644
--- a/src/shared/ssh.ts
+++ b/src/shared/ssh.ts
@@ -107,6 +107,13 @@ set -g destroy-unattached off
setw -g aggressive-resize on
# OSC 52 to the client, which writes the LOCAL clipboard. BOTH lines are needed on tmux 3.2+ — see
# remoteTmuxConf's doc comment before touching either.
+# MIGRATION — do not remove. Older versions of this file blanked smcup/rmcup/indn via
+# terminal-overrides, and a long-lived tmux server keeps every entry ever sourced into it (the
+# array only grows; -f is read once at server start). With those stale entries present the client
+# never returns to the alternate screen and scrolling stays broken NO MATTER what this file sets
+# below. Unset both arrays back to defaults, then re-add the one feature we actually want.
+set -su terminal-overrides
+set -su terminal-features
set -g set-clipboard on
set -as terminal-features ",*:clipboard"
# Mouse copy: tmux copies to its buffer AND emits OSC 52. No pipe to a local command — it would run