Repository navigation
fix(coco): 修复 CoCo 消息无法自动提交 - #25
Merged
Merged
Conversation
1. tmux-backend pasteText 添加 -p 标志强制 bracketed-paste 标记 2. coco.ts HISTORY_PATH 适配 macOS ~/Library/Caches 路径
There was a problem hiding this comment.
Pull request overview
This PR aims to fix CoCo/Trae CLI “multiline input can’t auto-submit” in botmux tmux mode by (1) using the correct CoCo history.jsonl path per platform (macOS vs Linux) for submit verification, and (2) making tmux paste operations reliably delimited via bracketed-paste markers.
Changes:
- Update CoCo submit-verification history path to be platform-specific (macOS
~/Library/Caches/..., otherwise~/.cache/...). - Add
-ptotmux paste-bufferinpasteText()to request bracketed-paste markers when supported/enabled. - Align the write-input test helper to use the same platform-specific CoCo history path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
test/write-input.test.ts |
Test helper now uses platform-specific CoCo history path and updates related comments. |
src/adapters/cli/coco.ts |
CoCo adapter now reads platform-specific history.jsonl; updates verification comment accordingly. |
src/adapters/backend/tmux-backend.ts |
pasteText() now passes -p to tmux paste-buffer and updates bracketed-paste documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
271
to
286
| @@ -280,7 +282,7 @@ export class TmuxBackend implements SessionBackend { | |||
| timeout: 5000, | |||
| env: tmuxEnv(), | |||
| }); | |||
| execFileSync('tmux', ['paste-buffer', '-t', this.cmdTarget, '-d'], { | |||
| execFileSync('tmux', ['paste-buffer', '-t', this.cmdTarget, '-d', '-p'], { | |||
| stdio: 'ignore', | |||
Owner
|
感谢 @ZBCccc 的修复!🙏 Review 结论(在隔离 worktree 上验证):
本 PR 是完整版(含测试),与 #25 重复的 #23 将作为 superseded 关闭。合并后会再补一个小重构把 CoCo 缓存根路径抽成共享 helper。 |
deepcoldy
added a commit
that referenced
this pull request
May 20, 2026
review nit:原注释写 'paste-buffer -d 自动 wraps',正是导致 PR #25 改错 backend 的误解来源。改成准确描述 -p 的作用。
ZBCccc
pushed a commit
to ZBCccc/botmux
that referenced
this pull request
May 21, 2026
PR deepcoldy#25 的 -p 加到了 TmuxBackend.pasteText,但运行时所有会话走的都是 TmuxPipeBackend(见 selectSessionBackend),其 pasteText 仍是无 -p 的 paste-buffer -d。没有 -p tmux 不会包 bracketed-paste 标记,CoCo/Ink 把 内容当成连续输入 burst,结尾 Enter 被吞成软换行,消息卡在输入框未提交; 下一条消息的 paste 才把上一条顶出去提交 —— 表现为'每次回复上一条'。 - TmuxPipeBackend.pasteText 的 paste-buffer 补 -p(对齐 TmuxBackend) - tmux-pipe-backend.test 增加 -p 断言作为回归护栏(旧测试 mock 掉了 pasteText,从未跑到真实 tmux flag,所以 PR deepcoldy#25 的错位没被拦住)
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.
背景
排查 CoCo / Trae CLI 在 botmux tmux 模式下的多行输入提交链路时,发现 CoCo 提交确认依赖两处行为:
history.jsonl路径是平台相关的:macOS 写入~/Library/Caches/coco/history.jsonl,Linux 写入~/.cache/coco/history.jsonl。此前 adapter 只按 Linux 路径读取,macOS 下会误读不到真实提交历史,影响提交确认、retry/failure 判断。pasteText()注入多行内容。为了让 CoCo / Ink 更可靠地识别 paste 边界,tmuxpaste-buffer需要带上-p,在应用启用 bracketed paste 时插入 paste 边界控制码。改动
src/adapters/cli/coco.ts~/Library/Caches/coco/history.jsonl,其他平台保持~/.cache/coco/history.jsonl。src/adapters/backend/tmux-backend.tspasteText()的tmux paste-buffer增加-p,在应用启用 bracketed paste 时插入 paste 边界控制码。test/write-input.test.ts验证
pnpm exec tsc --noEmit✅pnpm vitest run test/write-input.test.ts✅ 68 testspnpm vitest run test/tmux-backend-input.test.ts✅ 12 testsgit diff --check✅备注:本机 Node 为
v20.20.2,pnpm会提示项目期望node >=22,但上述验证命令均已通过。