> [!left-bubble] ![[colot-mini.webp]] > [[GitHub Copilot CLI]]の `/research` によるレポートです。 ## Executive Summary 結論から言うと、**「cmux + GitHub Copilot CLI でマウスが効かなくなり、終了後に制御文字が流れて `reset` で直る」現象に“かなり近い”既知Issueは複数あります**。特に [github/copilot-cli](https://github.com/github/copilot-cli) では、alt-screen と mouse reporting 周りの不具合/UX問題が継続的に報告されており、`--no-alt-screen` や mouse無効化が回避策として挙がっています。[^1][^2][^3][^4] 一方で、**「cmux」を明示したIssueは検索上ヒットしませんでした**(0件)。[^9] また、`reset` で復旧する挙動自体は、端末が raw/cbreak など異常状態のまま残った場合に通常起こりうるものとして、`reset` のman page説明と整合します。[^10] ## 調査結果(Issue有無) ### 1) Copilot CLI 側には関連Issueが存在する 以下は今回の症状と関連性が高い報告です。 - **#1585**: alt-screen有効時に mouse reporting がテキスト選択を奪う問題。回避策として `copilot --no-alt-screen`、Shift/Optionでの選択回避が明記。[^1] - **#1678**: マウスホイールのスクロール対象が期待と異なる挙動になった報告。[^3] - **#1710**: alt-screen時に長い出力のスクロールが困難/不可能になる報告。[^4] - **#1679**: 端末に ANSI エスケープシーケンスがそのまま見える報告(本文中に `?1002h`, `?1006h`, `?1006l`, `?1002l` などが現れる)。[^2] - **#1384**: tmux利用時のカーソル表示挙動異常。tmux環境でのTUI整合性問題が継続していることを示す。[^5] - **#1453**: 実行中の追加入力でスクロールや再描画が破綻する報告。[^6] ### 2) 公式変更履歴から見える事実 - **v0.0.413**: `--experimental` 時に alt-screen をデフォルト有効化。[^7] - **v0.0.419**: `--mouse/--no-mouse` と mouse設定追加(alt-screenでmouse modeを無効化可能)。[^8] => つまり、Copilot CLI側もこの領域を明確に問題領域として扱い、最近まで修正/機能追加を継続しています。[^7][^8] ### 3) 「cmux」名義の公開Issueは確認できず - `"GitHub Copilot CLI" cmux mouse` 検索: 0件。[^9] - `repo:github/copilot-cli cmux` 検索: 0件。[^9] **解釈**: 症状は存在するが、公開Issue上は「cmux」ではなく「tmux」「alt-screen」「mouse reporting」「ANSI escape sequence」名義で報告されている可能性が高いです。[^1][^2][^5] ## 技術的な整合性(なぜ `reset` で直るのか) - `reset` は端末モードを sane に戻し、cooked/echoへ戻す・raw/cbreakを解除する目的のコマンドです。[^10] - xterm制御シーケンスでは `1002`(button event mouse)や `1006`(SGR mouse)がマウストラッキング関連モードです。[^11] - tmuxは `mouse on` の場合にマウスイベントを捕捉します。[^12] このため、**TUI + multiplexer + mouse tracking モードの組み合わせで、終了時に端末状態復元が崩れると、クリック/スクロールが制御シーケンスとして見える**現象は技術的に自然です(あなたの症状と一致)。[^2][^10][^11][^12] ## 実務的な対処(再発抑止) 1. Copilot CLIを最新(少なくとも 0.0.419 以降)へ更新。[^8] 2. まずは `--no-mouse`(または config の mouse無効)を試す。[^8] 3. 併せて `--no-alt-screen` も比較検証(症状切り分け)。[^1] 4. tmux側は必要に応じて mouse設定を一時OFFにして再現差分を見る。[^12] 5. 壊れた端末は `reset`(必要なら `stty sane`)で復旧。[^10] ## Confidence Assessment - **高い確度**: Copilot CLI側に「同系統(alt-screen/mouse/ANSI/スクロール破綻)」のIssue群が存在する点。[^1][^2][^3][^4][^5][^6] - **中程度の確度**: 「cmux 固有」かどうか。公開Issueでは cmux 明記のヒットがなく、tmuxや一般端末問題として報告されているため。[^9] - **高い確度**: `reset` で直る理由(端末モード再初期化)はman pageと整合。[^10] ## Footnotes [^1]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1585](https://github.com/github/copilot-cli/issues/1585) (open): alt-screen + mouse reporting による選択/コピー問題、`--no-alt-screen` 回避策記載。 [^2]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1679](https://github.com/github/copilot-cli/issues/1679) (open): ANSIシーケンス露出報告。Issue本文に `?1002h/?1006h` 等を含む。 [^3]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1678](https://github.com/github/copilot-cli/issues/1678) (open): マウススクロール挙動の変更報告。 [^4]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1710](https://github.com/github/copilot-cli/issues/1710) (open): alt-screenで長い出力のスクロール困難。 [^5]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1384](https://github.com/github/copilot-cli/issues/1384) (open): tmux利用時のカーソル挙動異常。 [^6]: [github/copilot-cli](https://github.com/github/copilot-cli) Issue [#1453](https://github.com/github/copilot-cli/issues/1453) (open): スクロールジャンプ/再描画破綻。 [^7]: [github/copilot-cli](https://github.com/github/copilot-cli) `changelog.md` (commit `3b7315490899c61cae6e06d3e9d86b54955c6332`), lines 67-75: v0.0.413 で `--experimental` 時 alt-screen デフォルト化。 [^8]: [github/copilot-cli](https://github.com/github/copilot-cli) `changelog.md` (commit `3b7315490899c61cae6e06d3e9d86b54955c6332`), lines 9-15: v0.0.419 で `--mouse/--no-mouse` と mouse config 追加。 [^9]: GitHub Issues検索(API)結果: `"GitHub Copilot CLI" cmux mouse` = total_count 0、`repo:github/copilot-cli cmux` = total_count 0。 [^10]: Ubuntu manpage `reset(1)` (`tset, reset - initialize or reset terminal state`), lines 116-120, 129-136: sane値へ復元、raw/cbreak解除、異常状態からの復旧用途。<https://manpages.ubuntu.com/manpages/noble/en/man1/reset.1.html> [^11]: xterm control sequences doc, lines 2930, 2932, 2940: `1000/1002/1006` mouse tracking constants。<https://invisible-island.net/xterm/ctlseqs/ctlseqs.html> [^12]: tmux man page HTML, lines 2602-2604, 3221-3223: `mouse on` 時に tmux がマウスイベントを捕捉。<https://man7.org/linux/man-pages/man1/tmux.1.html>