@cocorograph/hub-agent 0.7.88 → 0.7.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tmux.mjs +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocorograph/hub-agent",
3
- "version": "0.7.88",
3
+ "version": "0.7.89",
4
4
  "description": "Hub Hosted Cockpit のローカル常駐 agent。Hub と outbound WSS で接続し、ローカルの tmux/pty を中継する。",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
package/src/tmux.mjs CHANGED
@@ -338,7 +338,11 @@ export async function removeWorktree(name, opts = {}) {
338
338
  sessionNameFor(sanitized, "codex"),
339
339
  ]) {
340
340
  try {
341
- await execFileP(tmuxBin(opts), ["kill-session", "-t", target])
341
+ // `-t =<target>` で完全一致を強制 (T06593)。claude 名 `<wt>` は codex 名
342
+ // `<wt>__codex` の前方一致になるため、素の `-t` だと claude 不在時に
343
+ // claude kill が codex を先に巻き込んでしまう (ここでは両方 kill するので
344
+ // 結果は同じだが、意図した順序で確実に対象を kill するため exact に揃える)。
345
+ await execFileP(tmuxBin(opts), ["kill-session", "-t", `=${target}`])
342
346
  } catch (err) {
343
347
  const msg = err?.message || String(err)
344
348
  // session 不在は正常 (停止済みの worktree を消すパス / 片方の CLI しか起動していない)
@@ -694,7 +698,10 @@ export async function listSessions(opts = {}) {
694
698
 
695
699
  export async function killSession(name, opts = {}) {
696
700
  try {
697
- await execFileP(tmuxBin(opts), ["kill-session", "-t", name])
701
+ // `-t =<name>` で完全一致を強制 (T06593)。素の `-t <name>` は前方一致するため、
702
+ // claude セッション `<dir>` を kill しようとして claude が不在だと codex
703
+ // `<dir>__codex` に誤ヒットして codex を巻き込み kill してしまう。
704
+ await execFileP(tmuxBin(opts), ["kill-session", "-t", `=${name}`])
698
705
  } catch (err) {
699
706
  const msg = err?.message || String(err)
700
707
  if (
@@ -818,8 +825,13 @@ export async function createSession(name, cwd, opts = {}) {
818
825
  }
819
826
  }
820
827
  // 既存チェック
828
+ // ⚠️ `-t =<name>` で完全一致を強制する。tmux の `-t <name>` は「完全一致 →
829
+ // 先頭一致(prefix) → fnmatch」の順で解決するため、素の `-t <name>` だと
830
+ // claude セッション `<dir>` の重複チェックが codex セッション `<dir>__codex`
831
+ // (claude 名を接頭辞に含む) に**前方一致**して false positive の "duplicate
832
+ // session" を投げ、codex 稼働時に claude が起動できなくなる (T06593)。
821
833
  try {
822
- await execFileP(tmuxBin(opts), ["has-session", "-t", name])
834
+ await execFileP(tmuxBin(opts), ["has-session", "-t", `=${name}`])
823
835
  throw new Error("duplicate session")
824
836
  } catch (err) {
825
837
  const msg = err?.message || String(err)