Uh oh!
There was an error while loading. Please reload this page.
docs: tmux 追随フックの生存確認を接続ベースに修正 - #101
Merged
Merged
Conversation
PR #100 で devbase 側の判定は connect ベースにしたが、docs が配っている tmux プロンプトフックのサンプルは `test -S` のままだった。-S はファイルの種別しか見ない ため、VS Code の異常終了で残った listen していない孤児ソケットも通過してしまい、 フックが tmux show-environment からの拾い直しを早期 return でスキップする。 その結果、tmux セッション環境には生きたソケットが入っているのに、すでに動いている ペインのシェルだけが古い値を持ち続け、`devbase up --open` が毎回「手元で実行する コマンドの提示」へ degrade していた(実機で再現を確認)。 - サンプルの guard に `nc -U -w 1 <sock> </dev/null` による接続確認を追加。 macOS の nc は -z を付けると Unix ドメインソケットで誤判定するため付けない (生存ソケットで rc=1 になることを実測) - -S を前段に残し、ソケットファイルが無い一般ケースでは nc を起動しないままにする - 孤児ソケットは ls でも test -S でも見分けが付かない旨を本文に明記 - CHANGELOG に Fixed エントリを追加 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01622CAKyYfonYuZ6AqRJvDg
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 freeto 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.
概要
#100 で devbase 側の IPC ソケット判定を connect ベースにしましたが、ドキュメントが配っている tmux プロンプトフックのサンプルは
test -Sのままで、同じ穴が残っていました。実環境でこれが原因となり、#100 のマージ後もdevbase up --openが自動で開かない状態が続いていたため修正します。症状と原因
~/.tmux.confのupdate-environmentは正しく効いていて、tmux のセッション環境には生きたソケットが入っています。それでも既に動いているペインのシェルだけが古い値を持ち続けていました。VSCODE_IPC_HOOK_CLI...8dd26478......8d9a04ee...橋渡しをするはずのプロンプトフックが、次の guard で早期 return していたためです。
-Sはファイルの種別しか見ないので、VS Code の異常終了で残った孤児ソケットも通過します。lsでもtest -Sでも生きているものと区別が付かず、生死の判定には実際の接続が必要です。tmux セッションの作成時刻と死んだソケットの mtime が一致することからも裏付けが取れました。
devbase-1/devbase-28d9a04ee/846482f8(同時刻)devbase-3/devbase-45656afb6/8c041b39(08-19 10:06)変更点
nc -U -w 1 <sock> </dev/nullによる接続確認を追加-Sは前段に残す。ソケットファイルが無い一般ケースでは追加のプロセスを起こさないためlsでもtest -Sでも見分けが付かない」旨を明記ncのフラグについてmacOS の
ncは-zを付けると Unix ドメインソケットで誤判定します。生きているソケットに対してもrc=1を返すため、-zは付けていません。nc -z -U <sock>nc -U -w 1 <sock> </dev/null動作確認
bash -n— 構文 OK~/.bash_profileに同じ修正を適用し、関数を直接呼んで検証8d9a04eeから生きている8dd26478へ拾い直すncの挙動を実測(上表)ruff check --select=E9,F63,F7,F82 lib(CI と同じ引数)— All checks passed