You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/07/11 09:35:03 UTC

(magpie) branch fix-terminator-tint-pts created (now 5f39eb65)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a change to branch fix-terminator-tint-pts
in repository https://gitbox.apache.org/repos/asf/magpie.git


      at 5f39eb65 fix(agent-isolation): support terminator (VTE) on Linux in claude-term-bg.sh

This branch includes the following new commits:

     new 5f39eb65 fix(agent-isolation): support terminator (VTE) on Linux in claude-term-bg.sh

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(magpie) 01/01: fix(agent-isolation): support terminator (VTE) on Linux in claude-term-bg.sh

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch fix-terminator-tint-pts
in repository https://gitbox.apache.org/repos/asf/magpie.git

commit 5f39eb658a06012b67af2709ade764e1f046ceee
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sat Jul 11 11:34:51 2026 +0200

    fix(agent-isolation): support terminator (VTE) on Linux in claude-term-bg.sh
    
    find_tty_dev() only matched macOS-style pty names (ttysNNN), so on Linux
    the hook found no writable device and silently exited without emitting the
    OSC tint escape. Linux/VTE terminals (terminator, gnome-terminal, xterm)
    report the pty as "pts/N" from `ps -o tty=`; match that too so the existing
    /dev/$t composition yields /dev/pts/N.
    
    VTE honours OSC 111, so the default reset path works on Linux without
    CLAUDE_RESET_BG; the iTerm2-proprietary reset escape is harmlessly ignored.
    Docs updated to note terminator + Linux support.
    
    Generated-by: Claude Opus 4.8 (1M context)
---
 tools/agent-isolation/claude-term-bg.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/agent-isolation/claude-term-bg.sh b/tools/agent-isolation/claude-term-bg.sh
index 0ef1d89d..636ed160 100755
--- a/tools/agent-isolation/claude-term-bg.sh
+++ b/tools/agent-isolation/claude-term-bg.sh
@@ -85,10 +85,14 @@
 #      deterministic reset is an explicit colour via CLAUDE_RESET_BG (OSC 11,
 #      the path we know works); without it we emit BOTH OSC 111 and iTerm2's
 #      proprietary SetColors=bg=default and let whichever the terminal
-#      understands win.
+#      understands win. VTE terminals (terminator, gnome-terminal) DO honour
+#      OSC 111, so on Linux the default reset works without CLAUDE_RESET_BG; the
+#      iTerm2-proprietary escape they don't recognise is harmlessly ignored.
 #
-# Tested on iTerm2 + macOS. Terminals that ignore OSC 11 entirely simply see
-# no change (fail-soft). For a guaranteed reset anywhere, set CLAUDE_RESET_BG.
+# Tested on iTerm2 + macOS and terminator (VTE) + Linux. The only OS-specific
+# part is locating the pty device: find_tty_dev() matches both macOS "ttysNNN"
+# and Linux "pts/N" names. Terminals that ignore OSC 11 entirely simply see no
+# change (fail-soft). For a guaranteed reset anywhere, set CLAUDE_RESET_BG.
 set -u
 WAIT_BG="${CLAUDE_WAIT_BG:-#2a1a3a}"
 RESET_BG="${CLAUDE_RESET_BG:-}"
@@ -99,8 +103,10 @@ find_tty_dev() {
   for i in 1 2 3 4 5 6 7 8; do
     [ -z "$pid" ] || [ "$pid" = "0" ] || [ "$pid" = "1" ] && break
     t=$(ps -o tty= -p "$pid" 2>/dev/null | tr -d ' ')
+    # macOS reports ptys as "ttys003"; Linux (terminator/VTE, xterm, …) reports
+    # them as "pts/0". Both prepend /dev to give a writable device path.
     case "$t" in
-      ttys*|tty[0-9]*) echo "/dev/$t"; return 0 ;;
+      ttys*|tty[0-9]*|pts/[0-9]*) echo "/dev/$t"; return 0 ;;
     esac
     pid=$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d ' ')
   done