Repository navigation
fix(adopt): Claude 历史会话标题跳过 skill 展开,优先使用 AI 标题 - #1976
Merged
deepcoldy merged 1 commit intoOct 17, 2026
Merged
Conversation
/adopt 卡片的 Claude 历史条目:选首条提示词时跳过 isMeta 记录(skill 展开等 Claude 自己写入的轮次),尾部扫描同时读取 aiTitle。标题优先级 customTitle > aiTitle > 首条真实提示词,三者皆无才丢弃。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 16, 2026
VincentSayHi
marked this pull request as ready for review
October 16, 2026 10:37
VincentSayHi
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 16, 2026 10:37
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
|
🚀 Released in v3.46.0 |
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.
问题
在飞书里发
/adopt会弹出「选择要接入的 CLI 会话」卡片,分成两部分:「运行中」(tmux / herdr / zellij 里正在跑的 CLI 会话)和「历史」(磁盘上可恢复的对话记录,最多 20 条)。Claude 历史条目的标题取对话记录里的「首条用户消息」,但没有跳过
isMeta: true的记录。isMeta是 Claude Code 给自己写入的轮次打的标记,比如 skill 展开正文、本地命令说明。所以用 skill 开场的会话,标题会变成 skill 展开正文的开头「Base directory for this skill: …」,看不出会话内容。改了什么
只改了
src/services/resumable-session-discovery.ts里解析 Claude 家族对话记录的部分;src/adapters/cli/types.ts只改了ResumableSession.title的注释。isMeta === true的记录。这个判断放在 botmux 来源判定之后,所以 isMeta 记录照样参与「是不是 botmux 注入的会话」的判断,只是不会被拿来当标题。findLatestClaudeCustomTitle改名为findLatestClaudeTitles,常量CLAUDE_CUSTOM_TITLE_TAIL_BYTES改名为CLAUDE_TITLE_TAIL_BYTES,两者都只在本文件内部使用。函数在同一个最多 4 MiB 的尾部窗口里,同时取最新的 customTitle(/rename设置的标题)和 aiTitle(Claude Code 自动生成的会话标题)。aiTitle 只认type === 'ai-title'且值为非空字符串的记录,这和 Claude Code 自己读取 aiTitle 的规则一致;侧链(sidechain)记录忽略。有意的行为变化
/resume列表里显示的更接近。影响面
/adopt卡片里「历史」这一来源。改动涉及的共用代码只有parseClaudeTranscript和尾部扫描函数,两者只被discoverClaudeFamilySessions调用;没有新增导出。claude-code(包括自定义 configDir 的档案变体)、seed、relay、genius。codex、traex(rollout 解析部分没动)、antigravity、grok、opencode。测试与验证
test/resumable-session-discovery.test.ts新增 14 条测试,只加不改,原有断言没动。先写测试并确认它们按预期失败(11 条失败、3 条通过,通过的 3 条是守卫用例),再改实现。覆盖的场景:aiTitle键也忽略;实际跑过的命令:
bun run buildbunx vitest run --project unit test/resumable-session-discovery.test.tsbunx tsc --noEmit -p tsconfig.jsonbun run test没有在飞书客户端里对改动后的版本做实机点击。下方示意图是用真实演示环境生成的卡片 JSON 渲染的。
全量测试说明(同批三个 PR 相同)
bun run test就有约 20 个用例失败,都是资源采样、钥匙串、PTY 计时、路径别名这类和本机环境有关的用例,与本 PR 无关。判定方法:本分支的失败用例集合不超出 master 的失败集合;偶发的新失败单独重跑两次,都通过的,判为机器满载时的不稳定用例。bun run test:bun(用 bun 跑的那组测试)在三个 PR 合在一起的版本上跑过,基线是稍早的 master。比 master 多出的偶发失败(cli-update-target 等 6 个文件,都与本 PR 无关)按 runner 相同的隔离方式单独重跑两次,均通过;runnable / deferred 的文件数与 master 相同。bun run test时,比稍早的 master 多出 2 个跳过用例,都在test/credential-only-dispatch-flow.integration.test.ts。它们来自 master 最新一次提交,在 master 上单独跑这个文件同样全部跳过,与本 PR 无关。效果示意
演示环境:一个已退出、用 skill 开场的 Claude 会话,加两个运行中的 herdr Claude 窗格,其中一个窗格设了标签「demo-task · 示例」;路径是
/private/tmp/botmux-demo,卡片搜索框过滤为botmux-demo。下面两张图是用改动前、后的代码,对同一个演示环境(真实的 herdr 窗格和 Claude 对话记录)实际生成卡片 JSON,再在本地按飞书卡片样式渲染出来的示意图,不是飞书客户端截图。图里「候选: #N」的编号随本机历史会话的数量变化,与改动无关。
改动前(master):skill 开场的会话在「历史」里的标题是「Base directory for this skill: …」。

改动后(本 PR):历史条目改为显示 AI 标题,skill 开场的会话不再拿 skill 正文当标题。

图里另外两个现象(运行中条目同名分不清、历史里重复列出运行中的会话)由同批另外两个 PR 处理。
与其他 PR 的关系
同批还有两个 PR,也都改
/adopt选择卡片:三者互相独立,任何一个单独合并都能通过构建和测试;三个放在一起看效果最完整。
已知遗留
/rename改了名、之后又把 customTitle 清空,卡片仍显示旧名。这个差异改动前就有,本 PR 没有处理。🤖 Generated with Claude Code