bug(terminal): tmux pane shows garbled ASCII/underscores, and Ctrl+Arrow/Ctrl+Backspace/Ctrl+V double-fire (AO-only, not reproducible in a bare tmux)
Bug
Using the embedded terminal (xterm.js attached to a tmux-backed session via tmux attach-session), two related but distinct symptoms show up that do not reproduce when attaching to the same tmux session directly from a regular terminal:
- Garbled rendering: a lot of the pane's box-drawing / line output renders as underscores and other ASCII substitutes instead of proper glyphs.
- Doubled input: holding Ctrl and pressing Arrow keys or Backspace (word-nav/word-delete) performs the action twice. Ctrl+V paste also pastes twice.
Both go away when attaching to the same tmux session from a plain terminal outside AO, so the corruption/duplication is introduced somewhere between AO's PTY attach and/or the xterm.js render path — not in tmux itself.
Investigation so far
backend/internal/adapters/runtime/tmux/tmux.go(attachEnv, ~line 252) unconditionally overwritesTERM=xterm-256coloron everytmux attach-sessionprocess, and forwards no locale (LANG/LC_ALL/LC_CTYPE) at all — the daemon may not have one to forward if launched without an interactive shell profile.- Hypothesis tested: tmux falls back to ASCII line-drawing when it can't confirm the attached client is UTF-8-capable via locale. This did not hold up under test: reproduced a real tmux 3.4 session (with a split pane, so a real border byte exists) and attached via a real pty twice — once with the environment completely stripped of all locale vars, once with
LC_ALL=en_US.UTF-8added. Both attaches sent identical bytes for the border (e2 94 82, correct UTF-8 for│). So locale had no effect on this tmux version's border rendering, and the ASCII-fallback theory as stated is disproven, at least for tmux 3.4. - This means the underscore corruption is more likely introduced downstream of tmux — most likely in
frontend/src/renderer/components/XtermTerminal.tsx's WebGL/Canvas glyph rendering (loadRenderer), or in how the attach PTY's bytes reach xterm.js — rather than in the tmux runtime adapter. - For the doubled Ctrl+Arrow/Ctrl+Backspace/Ctrl+V: traced
XtermTerminal.tsx'sattachCustomKeyEventHandler/normalizedTerminalShortcut/isTerminalPasteShortcut— these callpreventDefault/stopPropagationand returnfalseto suppress xterm's default handling, and no second keydown/paste listener elsewhere in the frontend was found that would explain a second emission. Root cause not yet found.
Repro
- Open a session's terminal in AO (tmux runtime).
- Hold Ctrl and press Left/Right/Backspace repeatedly, or Ctrl+V paste something — the action applies twice.
- Observe pane text/borders for stray underscores in place of expected characters, especially in agent CLI TUI chrome.
- Compare against attaching to the same tmux session (
tmux attach -t <session>) from an unrelated terminal — neither symptom reproduces there.
Next steps
Needs reproduction against the actual Electron renderer (xterm.js instance) to determine whether the corruption/doubling originates in the WebGL/Canvas addon, the attach PTY plumbing, or something in-between. Filing this to track the investigation rather than a confirmed root cause.