fix(macos-container): forward TERM env var in container exec --tty
lint / lint (push) Successful in 1m41s
test / unit (pull_request) Successful in 36s
test / integration (pull_request) Successful in 21s

Without TERM, Claude Code inside the container cannot determine which
modifier-key protocol to enable (modifyOtherKeys / kitty). The inner
PTY session has no terminal-type context, so Shift+Enter and Enter
produce identical byte sequences (\r), making them indistinguishable.

Pass the host TERM via --env TERM=<value> on every container exec
--interactive --tty call, falling back to xterm-256color when TERM
is not set on the host. Non-TTY exec paths are unaffected.

Closes #245
This commit is contained in:
2026-06-23 01:53:14 +00:00
parent b5b7f15ef9
commit 25ca14a8a2
2 changed files with 35 additions and 2 deletions
@@ -2,6 +2,7 @@
from __future__ import annotations
import os
import subprocess
from typing import Callable, cast
@@ -47,6 +48,11 @@ class MacosContainerBottle(Bottle):
cmd = ["container", "exec"]
if tty:
cmd.extend(["--interactive", "--tty"])
# Forward TERM so Claude Code can enable modifier-key protocols
# (e.g. modifyOtherKeys). Without it the inner PTY session has no
# TERM and Shift+Enter is indistinguishable from plain Enter.
term = os.environ.get("TERM", "xterm-256color")
cmd.extend(["--env", f"TERM={term}"])
if self.agent_workdir and self.agent_workdir != "/home/node":
cmd.extend(["--workdir", self.agent_workdir])
cmd.extend([self.name, self.agent_command, *full_argv])