Skip to content

Fix/pi typeahead busy#235

Open
Hellovolcanoone wants to merge 8 commits into
deepcoldy:masterfrom
Hellovolcanoone:fix/pi-typeahead-busy
Open

Fix/pi typeahead busy#235
Hellovolcanoone wants to merge 8 commits into
deepcoldy:masterfrom
Hellovolcanoone:fix/pi-typeahead-busy

Conversation

@Hellovolcanoone

Copy link
Copy Markdown
Collaborator

◆ 修复描述

修复新版 Pi 在 botmux 中偶发卡在 Pi is busy 的问题。

新版 Pi 在完成一轮回复后,botmux 的 idle/prompt 检测可能没有识别到它已经回到可输入状态,导致后续飞书消息虽然已经被 botmux 收到并路由到同一个 session,但一直停留在 pending queue
中,日志表现为:

Queued message (...) — Pi is busy

本次将 Pi adapter 标记为支持 type-ahead:

supportsTypeAhead: true

这样当 botmux 没有及时识别到 Pi idle 时,仍可把后续消息写入 Pi TUI,由 Pi 自己排队处理,避免消息长期卡住。

同时补充了 write-input 单测:

将 Pi 纳入 paste-buffer 输入路径覆盖
断言 Pi adapter 的 supportsTypeAhead 为 true
验证:

pnpm vitest run test/write-input.test.ts 通过
pnpm build 通过
本地安装并重启 botmux 后,运行态日志确认后续 PI 消息已进入 Writing to PTY / Writing to PTY (flush),不再卡在 Pi is busy 队列中。
新增优化逻辑:

如果消息还没有被 flush 到 PTY,且此时 CLI 仍 busy / still booting,新来的增量消息会合并到 pending queue 尾部。
等后续 flush 时,只写一次 PTY,内容用空行拼接。
正在 flush 或可以立即写入 PTY 的场景保持原行为,不合并,避免影响正在发送中的输入。
验证已通过:

pnpm vitest run test/worker-queue-merge.test.ts test/input-gate.test.ts test/write-input.test.ts
pnpm build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant