psmux: task window name starting with '-' creates no window; session reads as crashed

未关闭 适合新手
#1,061 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@RECOHA 已经在做这个了。

开始于 2026年11月23日。

  • #1062 来自 @RECOHA —— 未关闭

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli, tooling

调研方向

从 adapters/generic.py 开始,其中 task_window_name 返回 task_id[-40:] 并将其传给 new-window -n(还要检查 attach 路径,使两边对名称达成一致)。用 issue 中的 psmux 代码片段复现:以 - 开头的名称不会产生窗口,且 id 为空。完成的样子应是一个去掉开头连字符的名称(当结果为空时有回退方案),再加上一个单元测试,断言针对示例 52 字符 task id 返回的名称。

由索引模型根据 Issue 内容生成。

描述

What happens

On Windows with the psmux backend, a dev/review session "crashes" a few seconds after launch with an empty log, and the run pauses with:

no work produced: dev session crashed (no completed turn or qualifying activity was observed — the CLI may be waiting on a human ...)

session-lifecycle.jsonl for the task shows an empty window id:

{"event": "pane-pin-failed", "window": "", "error": "TmuxError: psmux list-panes -t failed: psmux: no server running on session ''"}

Cause

The window is named with the last 40 characters of the task id (runs.task_window_name → task_id[-40:], used by GenericAdapter for new-window -n). When that slice starts with -, psmux parses the name as an option: new-window exits 0, prints nothing for -P -F, and creates no window. The empty id then reads as a crashed session.

Whether it hits depends only on the story key's length and where its dashes fall, so it is deterministic per story. In one sprint, 7 of ~30 story keys hit it on dev-N or review-N.

Repro (psmux 3.4.0)

$s = "t-$(Get-Random)"; psmux new-session -d -s $s "cmd /c ping -n 30 127.0.0.1 >nul"
psmux new-window -t "=${s}:" -n "abc-def-dev-1"  -P -F "#{window_id} #{pane_id}" "cmd /c ping -n 10 127.0.0.1 >nul"   # prints "@2 %2"
psmux new-window -t "=${s}:" -n "-abc-def-dev-1" -P -F "#{window_id} #{pane_id}" "cmd /c ping -n 10 127.0.0.1 >nul"   # prints nothing, exit 0
psmux kill-session -t $s

Example task id that triggers it: 3-2-aaaaaa-a-bbbbbbbbb-c-dd-eeeeeee-ff-ggggggg-dev-1 (52 chars; the 40-char slice begins with -).

Suggested fix

Strip leading dashes in task_window_name, so the adapter and attach stay consistent:

def task_window_name(task_id: str) -> str:
    return task_id[-40:].lstrip("-") or task_id

I applied the equivalent change locally on 0.13.2 (in adapters/generic.py) and the affected story launched normally.

Environment

  • bmad-loop 0.13.2 (also checked main: task_window_name still returns task_id[-40:])
  • psmux 3.4.0, Windows 11, adapter claude
主要语言
Python
星标
196
派生
78
平均合并
9 小时 24 分钟
30 天内合并 PR
44

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bmad-code-org/bmad-loop 的其他 Issue

查看 bmad-code-org/bmad-loop 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。