fix(sidecar): spawn the sidecar without resolving tsx from the session directory - #23
Merged
Merged
Conversation
…n directory .mcp.json に書く起動コマンドが cmd /c npx tsx <entry> になっており、npx は カレントディレクトリから tsx を解決する。サイドカーを spawn するのは CLI で あり、その作業ディレクトリはユーザーのプロジェクトであるため、liplus-chat 側に しか無い tsx がそこで探される。 実測(作業ディレクトリ = C:\Users\smile\ClaudeCode): npx --no-install tsx --version -> npx canceled due to missing packages and no YES option: ["tsx@4.23.12"] tsx はグローバルにも無い。npx はレジストリからの取得を試み、非対話で spawn されたサイドカーにはその確認へ答える経路が無い。停止するか失敗するかの違いで、 どちらでもサイドカーは起動せず部屋には誰も入らない。 command = node、args = [絶対パスの tsx cli, 絶対パスの entry] に変更した。 名前で引くものが無くなるため解決の起点がどこであっても影響しない。node は .exe であり直接 spawn できるので、PATHEXT のための cmd /c ラッパーも不要に なり Windows 分岐そのものが消えた。 sidecar/test/round-trip.test.mjs は最初からこの形で spawn しており CI で通って いた。実装側だけが別の経路を使っていて、テストは実装の起動形を見ていなかった。 生成コマンドの形を crates/mcp-config のテストで固定し、npx が再び現れたら 落ちるようにした。 entry と runner は一度の探索で解決する。別々に引くと片方だけ別ツリーを指す 状態が作れてしまうため。環境変数の上書きは両方に用意した。 #22
smileygames
commented
Aug 21, 2026
smileygames
left a comment
Member
Author
There was a problem hiding this comment.
AI self-review (execution_mode = auto)
受け入れ条件の照合(issue #22 完了条件)
| 条件 | 結果 | 根拠 |
|---|---|---|
liplus-chat-room エントリが node と絶対パスだけで構成される |
pass | spawn_form は node + [runner, entry] のみを返す。npx / cmd / PATHEXT 依存が消えた |
| 生成コマンドの形がテストで固定されている | pass | registers_the_room_server_when_no_config_exists が command == "node" と args 配列全体を assert。npx が戻れば落ちる |
作業ディレクトリに tsx が無くてもサイドカーが起動できる |
実装済 / 実機未確認 | 解決を伴わない絶対パス指定。実際の spawn は Master の実機でのみ確かめられる |
制約の照合
- 解決の起点をセッションの作業ディレクトリに置かない: pass。名前で引く要素が残っていない。
- runner を環境変数で上書きできる: pass。
LIPLUS_SIDECAR_RUNNER。entry と対称。 - entry と runner を一度の探索で解決: pass。別々に引くと片方だけ別ツリーを指す状態が作れる。
この欠陥が CI をすり抜けた理由
sidecar/test/round-trip.test.mjs は最初からこの正しい形で spawn していた。node_modules/tsx/dist/cli.mjs を絶対パスで指定しており、CI でも通っていた。つまりテストは正しい起動形を実演していながら、実装が使う起動形を一度も見ていなかった。
テストが実装と別の経路を通っていると、テストの緑は実装の緑ではない。今回はテスト側が正しく実装側が誤っていたため、緑が誤りを隠す方向に働いた。生成コマンドの形を assert に入れたのはこの穴を塞ぐため。
検証
- CI 全ステップ pass(
npm run build/sidecar:check/sidecar:test/cargo check/cargo test8 pass) npx --no-install tsx --versionがセッションの作業ディレクトリでmissing packagesにより失敗することを実測。推測ではない。
scope deviation
なし。
次の期待
execution_mode = auto のため人間レビューゲートなし。CI green(CI pass / check pass 2m16s)。self-review pass により squash merge へ進む。
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.
Closes #22
観測
.mcp.jsonへ書く起動コマンドがcmd /c npx tsx <entry>になっていた。npxはカレントディレクトリからtsxを解決するが、サイドカーを spawn するのは CLI であり、その作業ディレクトリはユーザーのプロジェクトである。実測(作業ディレクトリ =
C:\Users\smile\ClaudeCode):tsxはグローバルにも無い。npxはレジストリからの取得を試み、非対話で spawn されたサイドカーにはその確認へ答える経路が無い。停止するか失敗するかの違いで、どちらでもサイドカーは起動せず部屋には誰も入らない。直し方
nodetsx/dist/cli.mjs, 絶対パスの entry]名前で引くものが無くなるため、解決の起点がどこであっても影響しない。
nodeは.exeであり直接 spawn できるので、PATHEXT のためのcmd /cラッパーも不要になり Windows 分岐そのものが消えた。entry と runner は一度の探索で解決する。別々に引くと、片方だけ別ツリーを指す状態が作れてしまうため。環境変数の上書きは両方に用意した。
テストが見ていなかったもの
sidecar/test/round-trip.test.mjsは最初からこの形で spawn しており、CI で通っていた。実装側だけが別の経路を使っていて、テストは実装の起動形を見ていなかった。生成コマンドの形を
crates/mcp-configのテストで固定した。npxが再び現れたら落ちる。検証
cargo test(crates/mcp-config、8 pass)cargo check --target x86_64-pc-windows-gnunpx --no-install tsxがセッションの作業ディレクトリで失敗することを実測release type
patch — 起動不能の修正。