Repository navigation
feat(adopt): herdr 运行中条目按标签页命名,位置行显示空间名 - #2090
Merged
deepcoldy merged 4 commits intoOct 23, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
VincentSayHi
force-pushed
the
feat/adopt-herdr-tab-names
branch
from
October 21, 2026 10:35
71cbfd3 to
3fe5490
Compare
VincentSayHi
marked this pull request as ready for review
October 21, 2026 10:36
VincentSayHi
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 21, 2026 10:36
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
Owner
|
已合并,感谢贡献!🎉 落地提交:8e52b12220(squash,作者署名保留为 VincentSayHi;补丁与评审版本逐字一致)。 这个改动让 评审过程中记录了几条不阻断的后续建议,供有兴趣时另开 PR/issue:
再次感谢,欢迎继续贡献。 |
|
🚀 Released in v3.51.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卡片「运行中」部分的 herdr 条目,标题目前按 #1977 取「窗格标签 > Claude 终端标题 > 目录名」,有两个不足:结果是同一目录下的多个会话只能靠开场标题区分,常常看不出是哪个;位置行只有
default:w1:p2E这种编号。改了什么
标题(只改 herdr 运行中条目,所有 CLI 用同一套规则),从左到右取第一个有值的:
1)标签页名 · 窗格标签→标签页名 · 原生标题→标签页名 · 新会话/rename设的名字或开场自动标题(实测 Claude Code 2.1.30x 执行/rename后终端标题立即变为新名);TraeX 是原生会话标题(fix(adopt): 展示 TraeX 原生会话标题 #1077)。Claude 终端标题是通用名时,改取对话记录里第一句真实用户输入,规则与历史条目相同(fix(adopt): Claude 历史会话标题跳过 skill 展开,优先使用 AI 标题 #1976)。number字段是稳定的创建计数,不能用。位置行与搜索
default:w9:p2)」(英文界面用半角括号);拿不到时和改动前一样只显示编号。实现分三层
src/core/session-discovery.ts):只把 agent / pane 记录里已有的 workspace_id、tab_id、窗格标签、原生标题记到AdoptableSession(无值不出现 key);不新增 herdr 调用、不读对话记录,原title取值不变。src/services/adopt-live-enrich.ts):只在卡片渲染路径(collectAdoptCandidates)里查herdr --session <名> workspace list/tab list,需要时读对话记录开头找第一句;与历史收集并发。src/im/lark/card-builder.ts):拼标题和位置行,新增两条 i18n 文案。三层共用的纯函数放在新文件
src/utils/live-title.ts:标题清洗(从session-discovery.ts原样挪来,行为不变)、标签页名 · …拼接与截断、按(herdr 会话, tab_id)分组计数。第一句判定抽成
claudeFirstUserTurn(src/services/resumable-session-discovery.ts),历史条目原有 164 个用例一字未改,全部通过。为什么这样设计
adopt_confirm)会在 3 秒的卡片回调里重新发现最多 4 次,且用不到标题,所以发现层零新增调用。影响面
toEqual、两条卡片金样不变,另有并排对照用例;Orca 条目与 herdr 条目混排时,和它单独渲染逐行相同)。codex、pi等条目,单条目时从目录名变为标签页名(没起名时就是1这样的默认名);多条目时显示<标签页名> · 新会话。/adopt <target>直达、adoptTargetLabel和 key、接管后的话题标题都没变;确认路径调用discoverAdoptableSessions的次数与改动前相同(有用例)。buildAdoptEntries末尾加locale,collectAdoptCandidates末尾加 options(截止时间、可注入补全),AdoptableSession/AdoptPickerEntry只加可选字段。测试与验证
新增 53 个用例,覆盖:单 / 多条目各档优先级(中英文);按(herdr 会话, tab_id)分组、缺 tab_id 不分组;自管窗格不计入;默认名按位置判定;
/rename后的终端标题、通用名改读第一句、无对话记录、botmux 信封;位置行格式与转义;按空间名、按未显示的标签页名搜索;各降级组合;端到端截止时间(假计时器)、真实子进程到点被杀、1 MiB 读取上限、并发上限;拼接截断(含 emoji);确认路径不补全;Orca 条目原样直通(不参与标签页分组、不触发 herdr 查询)。实际跑过的命令:
bun run buildbunx vitest run --project unit test/herdr-session-discovery.test.ts test/herdr-discovery.test.ts test/card-builder.test.ts test/card-builder-wire-golden.test.ts test/adopt-picker-cache.test.ts test/adopt-live-enrich.test.ts test/resumable-session-discovery.test.ts test/traex-live-adopt-title.test.ts test/session-adopt.test.ts test/session-discovery.test.ts test/command-handler.test.ts test/daemon-rename-route.test.ts test/test-hygiene.test.ts test/orca-adopt-discovery.test.ts test/adopt-target.test.tsadopt-live-enrich.test.ts是新文件)bunx tsc --noEmit -p tsconfig.jsonbun run test(变基前,基于d06d38563)bun run test:bun(变基前,基于d06d38563)变基到
c5e544e6c后,在最终提交上重跑了构建、上面的定向测试、tsc 和真实 herdr 环境的卡片核对;两套全量测试没有重跑。没有在飞书客户端里对改动后的版本做实机点击;用改动后的代码对一个真实 herdr 环境生成过卡片 JSON 核对,结果与预期一致。
全量测试说明
bun run test就有约 59 个用例失败,与本 PR 无关。判定方法同前几个 PR:本分支失败集合不超出 master;偶发的新失败单独重跑两次都通过的,判为机器满载时的不稳定用例。效果示意
演示环境:空间「示例空间」下三个标签页——没起名的「1」(一个 Claude,开场问正则表达式)、「整理笔记」(一个 Claude)、「代码评审」(两个 Claude 分屏,其中一个窗格标签为「前端」);路径
/private/tmp/botmux-demo,卡片搜索框过滤为botmux-demo。两张图是用改动前、后的代码对同一演示环境生成真实卡片 JSON、在本地按飞书卡片样式渲染的示意图,不是客户端截图。改动前(master):依次是「正则表达式概念解释」「整理笔记小技巧」「前端」「Markdown 基础介绍」,位置都只有

default:w9:pN。改动后(本 PR):「正则表达式概念解释」(标签页没起名,仍用 Claude 标题)、「整理笔记」、「代码评审 · 前端」、「代码评审 · Markdown 基础介绍」,位置为「示例空间(

default:w9:pN)」。与其他 PR 的关系
在 #1977(herdr 运行中条目的显示名)基础上扩展标题优先级;第一句规则复用 #1976;与 #1978 的去重互不影响;TraeX 原生标题(#1077)作为「原生标题」一档参与;#1620 接入的 Orca 条目原样直通,不受本 PR 影响。
已知遗留
<task-notification>、<pasted_content>、[Request interrupted by user]这类记录可能被当成第一句(历史条目同样如此)。~/.claude/projects下兜底找一次对话记录(受时间预算约束)。🤖 Generated with Claude Code