修正: tmux の中で URL がクリックできない (OSC 8 が外側の端末へ届かない) - #150
Merged
Merged
Conversation
tmux は端末が Hls 能力を持つときだけ OSC 8 を書き出し、持たない端末ではリンクを 捨てて文字列だけを描く。tmux が xterm* へ既定で与える機能は clipboard/ccolour/ cstyle/focus/title で hyperlinks を含まないため、/etc/tmux.conf を焼き込んで以降、 Claude Code などが出す URL がクリックできない見た目だけのリンクになっていた。 terminal-features へ ",xterm-256color:hyperlinks" を追記する。tmux は綴りの違う 機能名を黙って受け取るため、show-options の文字列ではなく pty でクライアントを 繋いで Hls が定義されることを検査する。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UtHB25awYxRd5kKJr6vc8b
takemi-ohama
commented
Sep 3, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | codex | APPROVE
修正が必要な指摘はありません。
takemi-ohama
commented
Sep 3, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | gemini | APPROVE
テスト例外時に tmux プロセスが残らないよう、確実なリソース解放について 1 点のみ軽微な提案を行っています。
_client_capabilities の finally で client.wait(timeout=5) が TimeoutExpired を 投げると、以降の kill-server まで到達せず `sleep 30` を抱えた tmux サーバーが 残る。kill-server を先に実行してクライアントを自発的に終わらせ、なお待ち切れ なかった場合も TimeoutExpired を握り潰して後始末を続けるようにする。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GRDMb2WUxD8aenYmZfKzj
# Conflicts: # CHANGELOG.md # tests/containers/test_tmux_conf.py
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
概要
tmux の中で Claude Code などが出す URL がクリックできなくなっていたのを直します。
tmux は端末が
Hls能力を持つときだけハイパーリンク (OSC 8) を書き出し、持たない端末ではリンクを捨てて文字列だけを描きます。tmux が
xterm*へ既定で与える機能はclipboard/ccolour/cstyle/focus/titleの 5 つでhyperlinksを含みません。そのため v3.1.0 で
/etc/tmux.confを焼き込んで以降、コンテナ内の作業が tmux 経由になった時点でリンクが落ちていました。
terminal-featuresへ,xterm-256color:hyperlinksを追記します。実測
疑似端末に tmux クライアントを繋ぎ、tmux が外側の端末へ実際に書いたバイト列を採取して
比較しました。外側は VS Code 統合ターミナル 1.135.0 (
TERM=xterm-256color) です。Hls[missing]\033]8;%?%p1%l%tid=%p1%s%;;%p2%s\033\\利用者環境でも、
~/.tmux.confへ同じ 1 行を置いてクライアントを繋ぎ直した状態で、表示文字と飛び先が異なるリンク (OSC 8 でしか成立しない) がすべて開けることを確認済みです。
関連 Issue
変更点
containers/base/tmux.confにset -ga terminal-features ",xterm-256color:hyperlinks"を追記tests/containers/test_tmux_conf.pyに検査を追加。tmux は綴りの違う機能名を黙って受け取るため、
show-optionsの文字列一致では守れない。pty.openptyでクライアントを接続し、
show-messages -JTのHlsが定義されることを見るdocs/user/container-operations.mdの既定設定表に 1 行追加CHANGELOG.mdのUnreleasedにFixedとして記載動作確認
uv run pytest tests/containers -qが 122 件通るHls が定義されていない: 47: Hls: [missing])補足
反映にはイメージの再ビルドとコンテナの作り直しが要ります (
devbase build base)。動作中のコンテナで先に戻すには、
~/.tmux.confへ同じ 1 行を書いてtmux source-file ~/.tmux.confした後、クライアントを繋ぎ直してください。端末の能力は接続時に決まるため、実行中のクライアントには反映されません。