Skip to content

fix(adopt): 按真实活跃时间排序 Orca 候选 - #2598

Merged
deepcoldy merged 1 commit into
deepcoldy:masterfrom
Aues6uen11Z:fix/adopt-orca-order
Oct 30, 2026
Merged

deepcoldy merged 1 commit into
deepcoldy:masterfrom
Aues6uen11Z:fix/adopt-orca-order

Conversation

@Aues6uen11Z

Copy link
Copy Markdown
Contributor

改了什么

  • Orca 候选优先展示当前终端标题,避免被 TraeX 数据库中的旧线程标题覆盖
  • TraeX 来源使用线程数据库的更新时间排序,不再把 TUI 动画或状态栏重绘当成用户活跃
  • 其他 Orca CLI 继续使用 Orca 提供的最近输出时间
  • 缺少可靠活跃时间的候选排在有时间的候选之后

为什么

Orca server 的 lastOutputAt 会被 TUI 持续重绘刷新,不能代表 TraeX 会话的真实交互时间;同时旧的标题优先级会把 Orca 当前标题替换成 TraeX 的历史标题,导致 /adopt 候选内容和顺序与实际活跃会话不一致。

影响面

  • 仅影响 /adopt 中 Orca 来源候选的标题与 Orca 内部排序
  • tmux、Herdr、Zellij 和历史恢复候选的发现与顺序不变
  • 不改变 Orca target identity、确认时重新发现和接入流程

验证

node node_modules/vitest/vitest.mjs run test/orca-adopt-discovery.test.ts test/adopt-picker-cache.test.ts test/card-builder.test.ts

结果:3 个测试文件、268 个测试全部通过。

已在本机重建并重启 daemon,通过真实 /adopt 候选核对标题和排序。

Copilot AI balanced review requested due to automatic review settings October 30, 2026 09:49

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@deepcoldy
deepcoldy merged commit 42a7475 into deepcoldy:master Oct 30, 2026
12 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

已合并,感谢贡献!🎉

标题优先级与按线程 updated_at 排序的改动解决了 TraeX 会话在 /adopt 里被 TUI 重绘带偏顺序、旧线程标题覆盖当前标题的问题,测试和真机核对都很扎实。

评审中有 4 个不阻断的观察项,记录在此供后续跟进(如有兴趣欢迎另开 PR):

  1. 非 TraeX 候选的 lastOutputAt 透传分支缺少测试:cliId !== 'traex' 时沿用 Orca 的 terminal.lastOutputAt 这条路径目前没有断言(变异为恒取线程时间后测试仍全绿)。补一条「claude-code Orca 候选保留 Orca 上报的 lastOutputAt」的用例即可钉住。顺带说明:claude/codex 的 TUI 同样存在 spinner/状态栏重绘刷新 lastOutputAt 的情况,本 PR 有意只对 traex 改用线程库时间,其他 CLI 的排序噪声属遗留取舍。
  2. readTraexThreadIndex() 目前无条件执行:对配置为其他 CLI 的 bot,每次 /adopt 会白白开库扫一次全表(本机实测冷启约 249 ms,热读 5–12 ms,处在飞书卡片回调 3 s 预算的关键路径上)。可以按 filterCliId === 'traex' || filterCliId === undefined 收口。
  3. Orca 终端标题未做单行化清洗:tmux/herdr/zellij 的标题在发现阶段会过 cleanLiveAdoptTitle(单行、≤80 码点、去控制字符),Orca 路径直接透传 terminal.title。本 PR 之后终端标题成了 traex 候选更常见的默认标题,超长文本、换行或 BEL 等控制字符会原样进卡片(无 Markdown 注入风险,仅版面问题)。建议在 toCandidate 里对 Orca 标题也过一遍同一清洗函数。
  4. Orca 路径缺少通用标题过滤:herdr 路径有 claudeTerminalTitle() 丢弃 Claude Code / CLI 显示名这类无信息量标题,Orca 没有对应处理。若某个 TUI 把终端标题设成 CLI 名或 worktree 名,它会盖过信息量更大的线程标题——与本 PR 修的「标题不对」是同一类问题的另一种形状。

再次感谢,欢迎继续贡献!

@github-actions

Copy link
Copy Markdown

@Aues6uen11Z @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 89a9cea…22d1c8d0b(20 个提交),同批合入的还有 #2546 #2556 #2589 #2591 #2545 #2538 #2595 #2596 #2597 #2581 #2539 #2515 #2536 #2575 #2366 #2606 #2544 #2593 #2603,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Kimi basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the middle column displays a welcome message "欢迎加入群组" (Welcome to the group) and system notifications about group creation and settings, rather than a list o…
Gemini basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the main content area displays a topic conversation. I can see messages from "Gemini".
Codex DM chat mode replies inline and keeps one session feishu-core-dm-modes-codex failed Feishu Messenger chat list did not load after 4 attempts (URL: https://acn2e4mfbjx2.feishu.cn/next/messenger/, title: 消息 - 飞书). A login redirect means the saved storage state expired; a skeleton list…

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

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.

3 participants