Repository navigation
Conversation
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Co-Authored-By: Claude Opus 4.7 <[email protected]>
- 在 TmuxPipeBackend 类里显式声明 claudeJsonlPath / cliPid / cliCwd 三个可选字段, 与 PtyBackend / TmuxBackend 对齐,避免 worker 用类型强转动态挂字段 - 把 private isReattach 改成 _isReattach + public get isReattach(), worker.ts 去掉 (backend as any).isReattach - reattach 路径(ownsSession + _isReattach)也跑一次 applySessionOptions, 补齐旧 bmx-* session 升级后缺失的 set-clipboard / window-size largest 等配置
Owner
|
@LikaiLee 感谢这次扎实的修复!我和 Codex(在飞书话题里)一起 review 了这个 PR,结论是方向完全正确 —— 我顺手 push 了一个 cleanup commit(
剩余几个建议给后续 follow-up(不阻塞这次合并):
完整的 review 讨论过程包括 Codex 在本地的 |
sensuossss
added a commit
that referenced
this pull request
Jun 24, 2026
按多 agent review 逐条修(合入 master 前): High - #1 runtime: revisit 后 D#001/D#002 同 node.id 并发,inFlight/nodeControllers/ nodeAbortCleanups 改按 dispatchKey(instance) 存取 + 守卫删除;cancel 按 instance abort。原先无守卫 inFlight.delete(node.id) 会删掉活着的新实例 → 整 run 误崩。 - #2 host: architect 手搓 BotSnapshot 漏 disableCliBypass → 受限 bot 在 architect 步骤悄悄提权。改用权威 botToSnapshot()。 - #3 architect: 复用 attempts/001 不清旧 manifest,watcher 见旧 manifest 直接 finish('ok') → revise-dag 后修订不生效。dispatch 前 rmSync(attemptDir)。 - #4 test: 加 runWorkflow 集成测试,断言 restricted override 真的写进 worker 的 req.botSnapshot.disableCliBypass(降权红线看门)。 Medium - #5/#12 daemon-run: driveV3Run 顶部记 wasAlreadyTerminal,已终态短路,避免 coalesce 重驱 / "/start" 重试重发 gate 卡与 done/failed 消息。 - #6 security: gate handler 的 waitId 未校验就 path-join → 加 isValidWaitId (含 # 给 A#001-gate 形态) 拦 ../ 逃逸。 - #7 dashboard: catalog 前缀路由用 startsWith 误吞 runId 以 catalog 开头的 v3 run 详情页 → 改带边界正则。(本就是合并时我引入的) - #8 daemon: 线程内 "/workflow new" grill fall-through 时 cmdContent 仍是字面量, 被待回答 ask 拦截器当答案吞掉 → ask 拦截加 !threadGrill。 - #9 test: 补 manifest 软链逃逸(symlink→外部)的拒绝用例,防 realpath 被简化成 resolve。 Nit - #16 v3-blocked handler: String(formValue) 把 object/array 强转成非空垃圾过校验 → 改 typeof==='string'。 - #17 v3.ts: 抽 isTerminalRunStatus(),统一 poll/loop 的终态停轮判定(消死代码)。 校验:pnpm build 通过;v3/daemon/dashboard 相关单测全绿(含新增 2 条)。
This was referenced Nov 20, 2026
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.
背景
安装 tmux 后,botmux 会从原来的 PTY backend 自动切到 tmux backend。旧实现用
tmux attach-session/ attachedtmux new-session作为 worker 的观察层:这导致两个问题:
viewer 退出被误判为 CLI 崩溃
tmux attach-session在 daemon/node-pty 环境中可能因为open terminal failed: not a terminal/lost tty退出。claude_exit,daemon 触发 auto-restart,连续多次后出现:Claude crashed 4 times in 1 min, not auto-restarting。真实 CLI 生命周期和观察层生命周期混在一起
onExit等价于 CLI 退出。修改思路
把 botmux 自有 tmux session 也改成
pipe-pane模型:这样 worker 不再依赖
tmux attach-session这个 viewer 进程:tmux new-session -d启动 CLI,再通过pipe-pane观察。pipe-pane观察已有bmx-*session。tmux send-keys/paste-buffer。capture-pane初始化 Web 终端/卡片,不再依赖 attach client 输出。主要改动
session-backend-selector,集中选择 backend:PtyBackendTmuxPipeBackendreattachTmuxPipeBackend创建 detached sessionTmuxPipeBackend:bmx-*sessionkill()/destroySession()时只停止 observer,不向 daemon 上报claude_exitonExit#{pane_id},把异常或空输出都视为 pane gone,覆盖display-messagestatus=0 但 stdout 为空的 tmux 行为resize-windowstatus off、mouse on、set-clipboard on、history-limit 50000、window-size largestworker:captureCurrentScreen()onExittmuxBackend兼容字段为什么这样改
直接修补
tmux attach-session的退出判断只能避免误报,但仍然让 botmux 依赖一个不稳定的 viewer 进程。pipe-pane更符合 daemon 场景:botmux 后台观察/写入 tmux pane,而不是伪装成一个交互式终端用户 attach 进去。这次改动把生命周期语义重新对齐:
claude_exit,daemon 可以按现有逻辑 restart / crash guard/closekillbmx-*的 ownership 语义Test plan
vitest run test/tmux-reattach-backend.test.ts test/tmux-pipe-backend.test.ts test/worker-pipe-initial-screen-order.test.ts test/tmux-copy-mode.test.ts test/session-backend-selector-shape.test.tstsc --noEmittsc && esbuild src/dashboard/web/app.ts --bundle --outfile=dist/dashboard-web/app.js --platform=browser --format=iife --minify🤖 Generated with Claude Code