Skip to content

fix(send): 统一续轮中的飞书强调格式提示 - #2716

Merged
deepcoldy merged 7 commits into
deepcoldy:masterfrom
wzono:pr/lark-markdown-writing-guidance
Nov 3, 2026
Merged

deepcoldy merged 7 commits into
deepcoldy:masterfrom
wzono:pr/lark-markdown-writing-guidance

Conversation

@wzono

@wzono wzono commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

改了什么

  • 在内置 botmux-send 指南中说明飞书安全强调格式
  • 向有飞书传输的续轮注入独立 <botmux_formatting> 提示
  • 覆盖普通 inline、Claude hook sidecar、transcript、Codex App clean-input 和 EBSD service-user 路径
  • 保持 noTransport、零提示注入和 adopt 原始桥接契约不变

为什么

长生命周期会话的后续轮次不会重新获得完整首轮说明,容易重新生成飞书不稳定的强调格式。将短小、独立的格式提示放入各实际模型输入路径,可避免每轮重复整份发送说明。

影响面

只增加提示上下文,不修改消息渲染、发送 API、权限或持久状态。Codex App 使用 application-grade additional context;EBSD 保留原 service-user 安全信封,格式提示不会被解释为本地命令。

验证

  • bun run test -- test/prompt-builder.test.ts test/initial-user-turn-opening.test.ts test/codex-app-clean-prompt.test.ts:3 个测试文件、183 个测试全部通过
  • bun run build:通过
  • git diff --check origin/master...HEAD:通过
  • 独立 R1 发现的 Codex clean-input 与 EBSD 两个覆盖缺口已修复,R2 复核通过

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T05:44:22.739118Z 9b4652b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66acf88a95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/initial-user-turn-opening.test.ts Outdated
Comment on lines +377 to +379
expect(followUp).toContain('短进度优先纯文本');
expect(followUp).toContain('强调仅包短词或无中文标点的短语');
expect(followUp).toContain('标点和后文放在 `**` 外');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Assert formatting delivery without pinning localized wording

Any harmless edit to ai.followup.feishu_safe_emphasis now breaks these literal substring assertions even when the correct fragment still reaches every input channel. This conflicts with the root AGENTS.md requirement “不钉文案和文档措辞”. Resolve the expected fragment via t() or use a unique override fixture, and assert its placement and context kind rather than copying the shipped Chinese sentences. Apply the same correction to the equivalent assertions added in the other two test files.

AGENTS.md reference: AGENTS.md:L149-L149

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fcd0268. Tests now resolve the localized fragment through t() instead of copying shipped wording; bare transcript prompt consumers strip <botmux_formatting>, with dashboard and insight-preview regressions added. Focused suite: 202/202; build and diff-check pass.

});
// transcript + solo keeps the historical contract that visible content starts
// with the user's text. Hook mode still extracts this block into its sidecar.
if (formattingBlock && bare) blocks.push({ key: 'formatting', text: formattingBlock });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip the new block when extracting bare transcript prompts

With inline injection, replyDelivery: 'transcript', and solo: true, this appends the formatting block without a <user_message> wrapper. The fallback extractor in src/services/insight/prompt.ts does not remove botmux_formatting, and the dashboard’s cleanPromptText in src/dashboard/web/insights.ts also leaves it intact. Consequently, a short follow-up such as 继续 appears in the insight timeline and conversation replay with the internal formatting instructions presented as part of the user’s request. Update those consumers alongside the new envelope tag so they retain only the actual user text.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fcd0268. Tests now resolve the localized fragment through t() instead of copying shipped wording; bare transcript prompt consumers strip <botmux_formatting>, with dashboard and insight-preview regressions added. Focused suite: 202/202; build and diff-check pass.

在内置发送技能和有飞书传输的续轮中统一注入安全强调格式,并覆盖 inline、Claude hook sidecar 与 transcript 模式。noTransport 与零提示注入保持不变。

Co-Authored-By: Claude Code <[email protected]>
@wzono
wzono force-pushed the pr/lark-markdown-writing-guidance branch from 66acf88 to fcd0268 Compare November 3, 2026 04:31
@deepcoldy

Copy link
Copy Markdown
Owner

你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改:
https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=4beq0a5b-4d91-4f44-a564-9ade96a6c290&qr_code=true

(本条为自动流程发出的提示消息)

deepcoldy#2716 新增的 <botmux_formatting> 是续轮前置块:claude-family 等
injectsSessionContext 会话的续轮里它取代 <botmux_reminder> 成为首个
块,非注入式 CLI 的续轮里它插在 session_id/role 与 reminder 之间。
两处显式枚举的块清单漏登记:

- resumable-session-discovery 的 BOTMUX_LEADING_BLOCK_TAGS:/clear 或
  转写轮转后新文件首个存活用户回合是续轮时,botmux 自己的会话在
  /adopt 列表里漏判成外部会话(矩阵实测 24 个 CLI × 多配置共 372 组
  true→false,补标签后归零)
- claude-code 的 BOTMUX_ENVELOPE_TAGS:无 <user_message> 的 bare/hook
  形态下短消息的提交指纹被格式块占据,补登后指纹只含用户正文

补 5 条回归测试(发现 4 + 指纹 1),vitest/bun 双腿变异均咬红。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

自动评审(首次 review,最终以维护者复审为准)

整体方向没问题:新增的续轮格式提示在 inline / Claude hook sidecar / transcript / Codex App additionalContext / EBSD service-user 各路径接线一致,noTransport、mira、zero-injection、adopt 桥接的豁免口径与 botmux_reminder 对齐;两处展示层清洗(dashboard cleanPromptText、insight safePromptPreview)也已随块补上。评审中发现两处旁路块清单漏登记,已代为追加修复提交 9b4652b8c(直接推到本分支,未改写原提交)。

P2(已修复):/adopt 来源识别漏判

src/services/resumable-session-discovery.ts 的 BOTMUX_LEADING_BLOCK_TAGS 是一份显式枚举的"续轮前置块"清单(该文件注释明确要求新增前置块在此登记一处)。<botmux_formatting> 未登记,而它在续轮里的位置正是旧块的位置:

  • claude-code/seed/relay/genius 等 injectsSessionContext 会话:续轮以 <botmux_formatting> 开头(此前该位置是 <botmux_reminder>,有 ^ 锚正则兜底);
  • codex/traex/pi 等非注入式 CLI:该块插在 <session_id>/<role> 与 <botmux_reminder> 之间,四条 ^ 锚顺序正则全部失配;
  • 无 <sender> 尾块时(senderTag: false、solo 会话)尾邻接正则也接不住。

后果:/clear 或转写轮转后,新 jsonl 中首个存活用户回合是续轮时,botmux 自己的会话会在 /adopt 列表里被当成外部会话(重复桥接风险)。用真实 builder 输出做差分矩阵(24 个 CLI × delivery/solo/sender 配置),实测 372 组判定从 true 翻成 false;补登标签后归零。

P3(已修复):提交指纹剥离清单漏登记

src/adapters/cli/claude-code.ts 的 BOTMUX_ENVELOPE_TAGS(extractMessageContentForFingerprint 的无 <user_message> 回退剥离路径)漏了该标签,transcript solo 等裸形态下短消息(如「继续」)的 30 字符提交指纹会变成 继续 <botmux_formatting>短进度优先纯文本。当前比对两侧(写入文本 vs 转写记录)都带该块,功能上自洽、不构成现行故障,但破坏了该清单"指纹只含用户正文"的既定契约,一行补登保持完整。

修复与验证(9b4652b8c)

  • 两处清单各加一行;新增 5 条回归测试(发现 4:清单组合×2、body 紧邻 >、builder 真实形状的端到端发现;指纹 1)
  • 变异:分别摘掉两处标签,vitest 与 bun test 双腿均确定性咬红(4 / 1),恢复后全绿
  • 定向测试:相关 10 个测试文件 vitest 617 通过;bun test 双腿对发现/指纹文件 170+152 全绿(另两个改动测试文件用 vi.hoisted/importOriginal,按仓库约定只跑 vitest)
  • bunx tsc、bun run build 通过

一个非阻断的既有缺口(本 PR 未引入、也未扩大):transcript solo 的 bare 续轮(裸用户文本、无任何信封)在轮转后的新文件里本来就无法被来源识别(修复前是纯文本,现在尾随一个格式块但仍无 </user_message> 邻接);这类会话的来源一直依赖首轮完整信封,建议另开 issue 评估是否让 bare 形态也携带可识别结构。

@wzono

wzono commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 9b4652b8cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

复审补两个 P3:

- bare(replyDelivery=transcript + solo)续轮刻意把 <botmux_formatting>
  追加在用户正文之后且无 <user_message> 壳,三个「还原用户原文」的消费
  者此前只剥标签不剥块体,内部格式提示混进可见文本:/rewind 轮次预览
  (summarizeUserText)、恢复失败/重投卡片的任务行(userMessageExcerpt,
  同时覆盖 ordinary-recovery-retry 的 2000 字摘出路径)、codex/traex
  原生标题模型输入(extractBotmuxLarkNativeSessionTitlePrompt)。三处
  在无壳兜底路径先整块剥掉该块。
- mir 走 normalizeMircliPrompt 自行展平信封,新块不在其摘要项里,模型
  实际收不到格式提示:新增 summarizeFormatting,以 EBSD 同款
  「Response formatting:」纯文本行透传;无信封兜底输入也剥掉该块,
  不让原始 XML 漏给 mircli。mira 维持排除(自有 runner 协议)。

补 6 条回归测试(三展示面各 1 + mir 3),五处守卫 vitest/bun 双腿变异
均咬红。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

复审两条 P3 已修(追加提交 28a02de67,未改写既有提交)

按复审意见核实并修复,两处均先用真实 builder 输出 + 真实消费者函数复现:

P3-a|bare solo 格式块漏进三处用户原文展示面 ✅

复现确认:transcript + solo 续轮输入为 继续看一下这个 PR\n\n<botmux_formatting>…</botmux_formatting>(无 <user_message> 壳),三个消费者的无壳兜底路径只剥标签、块体留下:

  • core/context-rewind.ts summarizeUserText(/rewind 轮次预览)
  • services/ordinary-recovery-notice.ts userMessageExcerpt(恢复失败卡片任务行;ordinary-recovery-retry.ts 2000 字摘出走同一函数,一并覆盖)
  • core/session-title.ts extractBotmuxLarkNativeSessionTitlePrompt(codex/traex 原生标题等待态)

均采用复审建议的方案①:在无 <user_message> 兜底路径先整块剥掉 <botmux_formatting>…</botmux_formatting>(连块体),再走原有标签剥离/空白折叠。非 bare 路径块在 <user_message> 之前、抽取内文即可排除,不受影响。另独立 grep 确认仓库内同类泛标签剥离消费点只有这三处(group-context-card 那处是空判非提取,无关)。

P3-b|mir 归一化丢弃格式块 ✅(选透传方案)

复现确认:send 模式 mir 续轮经 normalizeMircliPrompt 后只剩 User request:\n继续,格式提示丢失。mir 与 mira 不同(mircli 由本 runner 自行展平信封成纯文本段落),且 mir 回复同样回投飞书,故采用透传而非排除:新增 summarizeFormatting,以 EBSD 同款 Response formatting: <guidance> 独立段落放在 User request: 之前;无 <user_message> 的兜底输入也整块剥掉该块,未来配置变化时不向 mircli 漏原始 XML。生产现状下 mir 配置 transcript 会在 replyDeliveryFor 回落 send(实测有 warning),bare 形态不可达,剥块为防御性处理。mira 维持排除不变。

验证

  • 新增 6 条回归测试(三展示面各 1;mir 3:透传/无块时不留行/无信封不漏标签)
  • 五处守卫变异(三处剥离 + mir 透传 push + mir 兜底剥离),vitest 与 bun test 双腿均确定性 1 fail(其余 pass),恢复后全绿
  • 定向 11 个相关测试文件 262 通过(含 test-hygiene、available-bots-collapse、ordinary-recovery IPC 等);bunx tsc、bun run build 通过

复审第三轮:bare(replyDelivery=transcript + solo)续轮没有
<user_message> 壳,<botmux_formatting> 追加在用户正文之后;/adopt
发现侧不走泛标签剥离、直接 truncateTitle 的标题路径因此把内部提示
带进 picker 标题(选中后还会进新会话卡片与 resume 列表):

- claude 家族历史扫描与 live enrich 共用 cleanUserPromptForTitle
  入口,在此整块剥除(覆盖 fallbackTitle、herdr live title、
  claudeFirstUserTurn.prompt)
- codex/traex rollout 四个标题赋值点(canonical fallback、legacy
  event_msg title、history_mutation 与 response_item 的 weakTitle)
  统一经 titleFromUserText 剥块后再 truncateTitle;只动标题赋值,
  不参与首回合镜像绑定的 text 不变
- 抽出 utils/stripBotmuxDisplayBlocks 单一实现,上一轮三处展示面
  (context-rewind、ordinary-recovery-notice、session-title)与 mir
  无信封兜底改调它,消除正则重复

helper 范围只限 <botmux_formatting>:codex bare 形状里的前导
<session_id> 在 master 同形状下本就进标题(bare solo 不可识别的
既有缺口的一部分),不在本特性里扩大行为变化。

补 5 条端到端标题断言(claude 1 + rollout 4,含 traex 强弱两条
路径;codex 用例同时钉死 session_id 既有部分保留)。共享 helper
变异 9 处调用点测试全红,rollout/claude 两个接线旁路变异分别 4/1
红,vitest 与 bun 双腿一致。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

复审第三轮:/adopt 标题消费点已补(追加提交 b9d4f4ae8)

复审指出的同一根因残留已修复,三条证据均独立用真实 builder 输出 + 真实发现函数复现。采用建议的 helper 方案,并按"断言发现结果 title 而非 helper"写测试。

落点(5 个真实入口,4 处代码改动点)

  • claude 家族共用入口:cleanUserPromptForTitle 整块剥除。它是 claudeFirstUserTurn 的标题清洗点,一处覆盖复审列的三个现象——历史扫描 fallbackTitle(resumable-session-discovery)、herdr live enrich 的 firstUserTurnOfLine(adopt-live-enrich 直接复用 claudeFirstUserTurn,无需另改)、claudeFirstUserTurn.prompt 本身。
  • codex/traex rollout 四个标题赋值点:recordCanonicalUserText 的 fallbackTitle、recordWeakUserText 的 weakTitle、legacy event_msg/user_message 的 title、新格式 response_item 的 weakTitle,统一经新增的 titleFromUserText = truncateTitle(stripBotmuxDisplayBlocks(text))。只包标题赋值,参与首回合镜像绑定的 text 一字未动。
  • 统一 helper:新增 src/utils/prompt-display-strip.ts 的 stripBotmuxDisplayBlocks;上一轮三处展示面(context-rewind、ordinary-recovery-notice、session-title)与 mir 无信封兜底全部改调它,消除同一正则的 8 处重复。

一处与复审证据的出入(范围说明)

复审 #8 的 codex 标题是 <session_id>sid-rx</session_id> 继续看一下这个 PR <botmux_formatting>…。对照 master 源码与构造实测:master 上 codex bare solo 续轮本就是 <session_id>s</session_id>\n\n继续看一下这个 PR(skipSessionId=false 且无 user_message 壳),该形状 master 上同样漏判、标题本就含 session_id。因此 formatting 部分是本 PR 新增(已剥),session_id 部分是 master 既有(刻意保留)——修后 codex 标题 = <session_id>sid-rx</session_id> 继续看一下这个 PR,与 master 净行为一致。session_id 进 bare picker 标题建议另开 issue,不混进本特性。复审的 master 对照探针只展示了 claude 家族(injectsSessionContext,天然无 session_id 块),所以那三条干净。

验证

  • 5 条端到端标题断言:claude 家族发现标题 1 条;rollout 4 条(codex legacy event_msg、codex 新格式 response_item、traex canonical fallback、traex weak history + task_complete)。codex 两条同时钉死 session_id 既有部分保留。
  • 变异(vitest / bun 双腿计数一致):① 中和 helper 本体 → 9 条红(5 条 /adopt 标题 + 上轮 3 展示面 + mir 兜底),证明所有调用点都与 helper 有真实关系测试;② rollout 包装旁路 → 4 红;③ claude 入口旁路 → 1 红。恢复后全绿。
  • 定向 13 个相关测试文件 505 通过(含 adopt-live-enrich、command-rewind、ordinary-recovery IPC、test-hygiene、三个 prompt 注入文件);bunx tsc、bun run build 通过。

复审第四轮:grok 的 discoverGrokSessions 不走 claude 家族与 rollout
的标题入口,自己在 readFirstUserChunk 后直接 truncateTitle。grok
适配器 injectsSessionContext=true 且在结构化转写白名单,bare
(replyDelivery=transcript + solo)续轮可达,形状与 claude 家族相同
(用户正文 + 追加在后的 <botmux_formatting>);来源结构识别只过滤
掉带完整信封的 opening,bare 漏判后标题会带上内部提示,显示在
/adopt picker。补调 stripBotmuxDisplayBlocks 后再截断,并加
discoverGrokSessions 端到端标题断言(无 generated_title、回退首个
用户块的夹具)。变异双腿咬红(vitest 1,bun 另加预存 /proc/fd
环境性 1 红)。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

复审第四轮:grok /adopt 标题已补(追加提交 6cf48006a)

复审指出的第八个消费端成立,已修。

修复与证据

src/services/grok-transcript.ts 的 discoverGrokSessions 不经 claude 家族的 cleanUserPromptForTitle、也不经 rollout 的 titleFromUserText,自己在 readFirstUserChunk 后直接 truncateTitle(firstPrompt)。grok 适配器 injectsSessionContext: true 且在结构化转写白名单(reply-delivery.ts),bare(transcript + solo)续轮可达,形状与 claude 家族相同。现在改为 truncateTitle(stripBotmuxDisplayBlocks(firstPrompt)),复用同一个 helper。

测试:新增 discoverGrokSessions 端到端断言——updates.jsonl 首个 user_message_chunk 为 继续看一下这个 PR\n\n<botmux_formatting>…、summary.json 无 generated_title(强制走首提示回退标题),断言标题为 继续看一下这个 PR。变异(把剥离调用改回直传):vitest 精确 1 红,错误信息为 expected '继续看一下这个 PR <botmux_formatting>…' to be '继续看一下这个 PR'(与复审证据逐字一致);bun 腿新增用例同样咬红(文件内另有 1 个 findGrokSessionByPid 的 /proc/fd 预存环境性失败,在本 PR 原始 head 即红,与本改动无关)。

全仓消费端闭合审计

借这次把全部 /adopt 标题来源核完,确认不存在第九个:

来源 适配器 标题出处 状态
discoverClaudeFamilySessions claude-code / genius(seed/relay 同系) cleanUserPromptForTitle 共同入口 已剥(b9d4f4ae8)
discoverRolloutSessions codex / traex 4 个标题赋值点经 titleFromUserText 已剥(b9d4f4ae8)
discoverGrokSessions grok 首提示回退标题 已剥(本次 6cf4800)
discoverAntigravitySessions antigravity truncateTitle(display) bare 不可达(不在转写白名单);send 完整信封在标题赋值前被来源识别丢弃;前置格式块已在 9b4652b 加入 BOTMUX_LEADING_BLOCK_TAGS
OpenCode v1/v2 opencode / opencode2 SQL title 列(CLI 自有摘要) 非 prompt 文本,无关
tmux/zellij/orca live pane 各适配器 进程/窗格名 非 prompt 文本,无关
pi/coco/mtr/hermes/cursor — 无 listResumableSessions 磁盘入口(仅 live pane) 无 prompt 标题路径

claude 家族剩余两个 truncateTitle 是 Claude 自有的 customTitle/aiTitle(非注入轮文本);rollout 的 nativeMetadata.title 同理。dashboard cleanPromptText 与 insight safePromptPreview 的内联正则行为正确(浏览器 bundle 与 service 层各自内联),是否改调 helper 纯属整洁性,按复审意见不动。

定向 10 文件 352 过(唯一红为上述 grok /proc/fd 预存环境项);bunx tsc、bun run build 通过。

复审第五轮:traex 还有不经 rollout 解析的 DB 标题路径,
RolloutSessionMetadata.title 在 discoverRolloutSessions 里优先于
rollout 推出的标题,上一轮的 titleFromUserText 对它无效:

- normalizeTraexThreadDetails:threads.name/title 在 ≤0.207 库默认
  就是首条 prompt,bare(transcript + solo)续轮的格式块因此进
  picker resume 行;此 normalizer 同时喂 readTraexThreadTitle,
  herdr/tmux/zellij live pane 的 traexLiveTitle 一并覆盖。剥后
  纯空白(标题整块都是内部块)按空标题处理
- findTraexThreadByPid:orca live 发现单独 SELECT threads.title/
  first_user_message,不经 normalizer,两个可能镜像首 prompt 的
  列统一过 stripBotmuxDisplayBlocks 后再截断

真实 SQLite 夹具 3 条断言(normalizer 三行 + reader e2e + orca
pid 路径),两处守卫摘除 vitest/bun 双腿各 1 红。

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

复审第五轮:traex DB 标题两条路径已补(追加提交 4015394ef)

复审指出的第 9 个入口成立,用真实 SQLite 夹具复现(state_5.sqlite 中 threads.title 为 bare 形状):readTraexThreadDetails 的 title 带完整块、readTraexThreadTitle 折叠后仍带块、discoverRolloutSessions(traex) 端到端标题被 DB title 覆盖为 继续看一下这个 PR <botmux_formatting>…。master 对照同样确认(traex 不注入 session context 时 bare 文本里的 <session_id> 是 master 既有,与上轮 codex 同理保留)。

修复两点

  1. normalizeTraexThreadDetails(复审建议点):选定 name/title 候选后统一过 stripBotmuxDisplayBlocks;剥后为纯空白(标题整块都是内部块)按空标题处理。一处覆盖 picker resume 行(RolloutSessionMetadata.title 优先于 titleFromUserText 的推断标题)与 readTraexThreadTitle(herdr/tmux/zellij 的 traexLiveTitle)。
  2. findTraexThreadByPid(顺着同一 DB 入口审计出的第 10 个点,复审未列出):orca live 发现(orca-adopt-discovery.ts)单独 SELECT threads.title, first_user_message,完全不经 normalizer;这两列在 ≤0.207/0.210 都可能镜像首 prompt,统一剥块后再折叠截断,覆盖 orca live /adopt 卡片标题。

测试与变异

  • 3 条真实夹具断言:normalizer(polluted title / clean name 优先 / 纯块标题按空处理)、发现侧端到端(真实 readTraexThreadDetails 作为 loadSessionDetails,钉死 DB title 覆盖路径被剥净)、findTraexThreadByPid(真实锁文件 + /proc 所属线程,Linux 用例)
  • 两处守卫摘除:vitest 与 bun test 双腿均确定性咬红(各 1),恢复后全绿
  • 定向 13 文件 521 过(唯一红为 grok /proc/fd 预存环境项);tsc、build 通过

最终闭合审计(按"标题数据从哪来"穷举)

展示位置 标题来源 状态
/adopt 磁盘行:claude-code/genius discoverClaudeFamilySessions,首提示走 cleanUserPromptForTitle;customTitle/aiTitle 是 Claude 自有标题 已剥 9b4652b/b9d4f4ae8
/adopt 磁盘行:codex/traex rollout rollout 4 赋值点 → titleFromUserText 已剥 b9d4f4a
/adopt 磁盘行:traex DB 覆盖标题 normalizeTraexThreadDetails → nativeMetadata.title(优先覆盖) 已剥 本次
/adopt 磁盘行:grok discoverGrokSessions 自有标题 已剥 6cf4800
/adopt 磁盘行:antigravity send 完整信封标题前被来源识别丢弃;bare 不可达(零注入直返裸文本,不在转写白名单) 无需改
/adopt 磁盘行:opencode v1/v2 SQL session.title,CLI 自有摘要列 非 prompt 文本
/adopt live 行:herdr/tmux/zellij traex traexLiveTitle → readTraexThreadTitle → normalizer 已剥 本次
/adopt live 行:orca traex findTraexThreadByPid 自有 SELECT 已剥 本次
/adopt live 行:其它 手设 pane label / Claude TUI 终端标题 / orca terminal 名 非 prompt 文本
/rewind 预览、恢复卡片、重投摘要 summarizeUserText / userMessageExcerpt 已剥 28a02de
会话原生标题(spawn 时) extractBotmuxLarkNativeSessionTitlePrompt 已剥 28a02de
提交确认指纹 BOTMUX_ENVELOPE_TAGS 已剥 9b4652b
dashboard insight / insight 预览 作者提交内联正则 作者已修
mir 模型输入 normalizeMircliPrompt 透传/剥块 已修 28a02de

pi/coco/mtr/hermes/cursor 无 listResumableSessions 磁盘入口;worker-pool 两处会话标题走已修复的 extractBotmuxLarkNativeSessionTitlePrompt。

@deepcoldy
deepcoldy merged commit 803977d into deepcoldy:master Nov 3, 2026
11 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

@wzono 感谢这个 PR,已合入 master(803977d7)。

想法和接线都很扎实:五条续轮模型输入路径(inline / Claude hook sidecar / transcript / Codex App additionalContext / EBSD service-user)的豁免口径与既有 reminder 一致,展示层清洗也随块补齐。评审过程中自动评审与维护者复审沿「新增信封块的下游消费点」这条线多轮收敛,维护者追加了五个修复提交(未改动你的原提交):

  • 转写来源识别与提交指纹的块名登记
  • /rewind 预览、恢复失败卡片、会话原生标题三处用户原文还原
  • mir runner 的提示透传
  • /adopt 全部标题来源(claude/codex/traex rollout、grok、traex DB 线程标题、orca live 行)
  • 统一的展示面剥离工具与 20 条回归测试

Follow-up(非本 PR 阻断):bare transcript-solo 续轮本身不带 botmux 结构特征、在 /clear 或转写轮转后可能被 /adopt 列表误收,这是本 PR 之前就有的行为,已单独立项 #2744 跟踪;本 PR 已确保即使误收,标题也只显示用户原文。

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🚀 Released in v3.57.0

deepcoldy pushed a commit to Kerminate/botmux that referenced this pull request Nov 8, 2026
- prompt-builder:ebsd 信封自 deepcoldy#2716 起已带共享格式指引,期望值改用 feishuReplyPresentationGuidance。
- output-handoff-doc-provider:deliverFinalOutput 新引用的地址策略函数注入测试作用域。
- local-address-egress:bun 下一次性推进假时钟会先于首次发送的退避定时器,原用例永久挂起(CI 中被 SIGKILL),改为分步推进直到发送落定。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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