Skip to content

fix(skills): 恢复 botmux-send 按需指引 - #477

Merged
deepcoldy merged 1 commit into
deepcoldy:masterfrom
LucasIcarus:ci/send_skill_op
Jul 16, 2026
Merged

deepcoldy merged 1 commit into
deepcoldy:masterfrom
LucasIcarus:ci/send_skill_op

Conversation

@LucasIcarus

Copy link
Copy Markdown
Collaborator

Summary

  • 在默认 prompt 注入模式的首轮 compact catalog 中恢复 botmux-send 的“复杂发送”发现入口;完整约 14 KB skill 仍只在匹配后通过 botmux skill show botmux-send 按需读取。
  • 明确普通正文是 raw text,不是 JSON:禁止先 JSON.stringify / JSON 转义再传位置参数;多行正文使用 quoted heredoc / stdin,Windows 场景使用 UTF-8 --content-file。
  • 中英文 routing hints 与完整 skill 同步补强,并补齐 prompt / global / off、inline / system-prompt、follow-up 不重复注入等回归测试。

发现

  1. botmux send 的普通正文路径按原始字符串发送:位置参数直接拼接,stdin / --content-file 原样读取;只有 --card-json / --card-file 的卡片输入按 JSON 解析。因此 shell 和 botmux 不会把二次转义后的字面量 \n 自动还原成换行。
  2. fix(cli): 强化 botmux send 多行 heredoc 提示 #9(05-15)已经在 routing 与完整 skill 中禁止 botmux send "第一行\n第二行"。但 feat(skills): 内置技能改可选注入模式(global|prompt|off,默认 prompt),根治 codex 等全局 CLI 泄漏 #389(07-07)为避免 Codex 等 CLI 污染全局 skills 目录,将默认改为 prompt,同时把 send/history/quoted/bots 都视为 routing 已覆盖并排除出 compact catalog。
  3. 这使默认 Codex 只在首轮看到简短 heredoc 提示,后续只有很短的发送 reminder;botmux-send 中关于正文来源、Markdown、附件/卡片、mention、跨群、PowerShell 编码等完整规则失去可发现入口。它与最近问题变频繁的时间点吻合,但这是代码路径与时间线推断,不是 telemetry 已证明的因果关系。

决策与取舍

  • 保留 feat(skills): 内置技能改可选注入模式(global|prompt|off,默认 prompt),根治 codex 等全局 CLI 泄漏 #389 的核心设计:默认仍为 prompt,不恢复全局安装;dashboard 的 prompt | global | off 三档与 per-bot 配置语义不变。
  • 只恢复一个低成本索引:prompt 新会话首轮增加一行约 282/302 bytes(中/英文)的 send trigger,并收窄到“首次复杂发送 / 多行或结构化 Markdown / 附件卡片 / mention / 跨群 / attention”;不会常驻注入 14,183-byte 全文。
  • 不扩展每轮 reminder:follow-up 仍保持现有短提醒,避免持续 token 开销和视觉噪音;现有会话不会被追溯注入,新会话开始生效。
  • 不做 runtime 自动反转义或猜测修复:合法 JSON、代码、正则和有意发送的字面量 \n 都存在歧义,自动改写会破坏现有行为。此次只修正发现链路和输入契约说明。

影响面

  • prompt + 全局 skillsDir CLI:Codex、Gemini、OpenCode、Cursor、Coco、Traex、Pi、Oh My Pi、MTR、Kiro CLI 走首轮 inline catalog;Genius、Grok 走 system-prompt catalog,均新增同一条精简入口。
  • global、off、Claude-family dynamic 注入的模式解析和安装行为不变;所有使用共享 routing 的 CLI 会看到更明确的 anti-double-escape 文案。
  • 不改 send runtime、飞书 API、PTY/Tmux backend、会话恢复或 dashboard UI;无需 UI 截图。

验证

  • git diff --check:通过。
  • pnpm exec vitest run --project unit test/builtin-skills.test.ts test/skill-injection-mode.test.ts test/prompt-builder.test.ts test/cli-adapters.test.ts:4 files / 389 tests passed。
  • pnpm build:通过(tsc + dashboard bundle)。
  • pnpm test:8192 passed / 1 failed。唯一失败为 upstream/master 现有 test/dashboard-monitoring-ui.test.ts 断言仍要求 .ui-info-pop-floating { pointer-events: none },而 upstream 当前样式已为 auto;本 PR 未修改 dashboard 文件,单独复跑同样失败。
  • 本 checkout pnpm daemon:restart 启动验证:6 个 daemon/dashboard 进程均 online;随后已恢复原 canonical checkout 的 live wrapper。

@LucasIcarus
LucasIcarus marked this pull request as ready for review July 16, 2026 08:35
@LucasIcarus
LucasIcarus requested a review from deepcoldy as a code owner July 16, 2026 08:35
@deepcoldy
deepcoldy merged commit 059ed2d into deepcoldy:master Jul 16, 2026
@LucasIcarus
LucasIcarus deleted the ci/send_skill_op branch July 17, 2026 06:31
Wenne pushed a commit to Wenne/botmux that referenced this pull request Jul 28, 2026
`/repo <name>` / 选仓卡 / 跳过 / mid-session 切仓在无 buffered 输入时会空启动
CLI,但 session 上没有任何状态记录「CLI 已起、尚未接收真实用户轮」。下游只能
用 `ds.worker` 活没活当代理判据,于是首条真实业务消息被当 follow-up 处理,
PR deepcoldy#477 的 opening routing 与 built-in skill discovery 永远进不了首个真实 turn。

新增持久化 `Session.initialUserTurnPending` 与 `core/initial-user-turn.ts`
(mark/is/claim/release,claim 为同步读-改-写,保证并发首消息只有一个 opener)。
live-worker 与 worker-null/refork 两条投递分支统一:pending 时走
`buildNewTopicCliInput`,完整透传 sender / mentions / attachments /
availableBots / bot identity / locale / whiteboard / substituteTrigger /
Codex App text+application+message context;投递失败或被拒时归还状态。
refork 的 `resume` 增加守卫,避免 resume 一个从未产生真实轮的 CLI 会话。

顺带统一卡片路径:原先在同样场景下会 `buildNewTopicCliInput('')` 发一个空
`<user_message>` 开场,与 `/repo` 文本路径行为不一致,现改为同样空启动 + 打标记。

Claude-Session: https://claude.ai/code/session_01S13JmEqSSHFZTwmyRjD7Cm
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.

2 participants