Skip to content

feat(desktop): 搜索对中文短词按字召回,不再需要搜整句话才能命中 - #3569

Open
yan-xdt wants to merge 10 commits into
makecindy:mainfrom
yan-xdt:feat/issue-3331-cjk-fts
Open

feat(desktop): 搜索对中文短词按字召回,不再需要搜整句话才能命中#3569
yan-xdt wants to merge 10 commits into
makecindy:mainfrom
yan-xdt:feat/issue-3331-cjk-fts

Conversation

@yan-xdt

@yan-xdt yan-xdt commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

侧栏任务搜索、search_chat_historysession_search 现在能对 2~4 字中文短词做按字召回,不再依赖语义索引。

messages_fts 一直用 porter unicode61,连续汉字会被收成一个 token,搜「登录」打不中「登录报错了」。本 PR 按 #3331 的方案 A:写入时在汉字之间、以及汉字与英文/数字边界插入空格;查询时把中文收成相邻 phrase("登 录")。英文 porter 不变。预览从原文重建,不展示带空格的索引文本。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:Closes feat: 侧栏任务搜索 / session_search 的中文搜索几乎不可用,改进讨论 #3331;顺手修复 Windows 全量单测中的 PowerShell 后代进程清理用例偶发失败,影响开发效率及CI稳定性 #3574(单测偶发失败)
  • 本 PR 包含:
    • cjk_seg SQL 函数:只处理 \p{Script=Han};combining mark 附着在前一个汉字上,不阻断分词;中英相邻也切开
    • 四个会写 messages 的建连点都注册该函数(factory、DB worker、inline 回滚 worker、0099 companion);漏注册会让插入消息失败,而不是搜索静默降级
    • 查询侧 buildMessagesFtsMatch:CJK 收成相邻 quoted phrase;侧栏 / search_chat_history 多词 OR,session_search 多词 AND
    • 0099 存量重建:DROP messages_fts 后按 cjk_seg(m.content) 回填;健康库再跑会复用现有 FTS 行,不整表重建
    • snippet 从 messages.content 重建并转义原文 < / > / &,避免用户内容里的 <mark> 被当成高亮标记;高亮按码点坐标切,emoji / İ 不错位
    • 顺手修复两处与本 PR 无关的单测偶发失败(Windows 全量单测中的 PowerShell 后代进程清理用例偶发失败,影响开发效率及CI稳定性 #3574):Windows probe 后代清理预算 2s→8s——2s 盖不住满载机器上清理 powershell 自身冷启动 + Win32_Process BFS,超时走 catch 静默放弃、孤儿后代留到存活检查超时,正是 Windows 全量单测中的 PowerShell 后代进程清理用例偶发失败,影响开发效率及CI稳定性 #3574 的失败形态;probe 输出带诊断(操作被预算截断)时与整体 ETIMEDOUT 同口径 skip;codexProxyHost.test.ts 文件级超时放宽到 20s——首用例承担整条 SUT 模块链的冷编译加载,满载 CI 上超出 vitest 默认 5s。三处都只放宽预算 / 对齐既有 skip 口径,断言语义不变
    • 帮修 Windows unit 的 windowsPackagedInstanceBarrier mutex 用例(2eefb2a62):不修这个 PR 的 CI 过不了——该用例已连续多轮挂在 timed out acquiring,且 fix(desktop): relink Codex thread across providers #3543 把同类修复摘除后没有其它修复在路上,只能在本 PR 帮修。helper 先报 started、锁住后报 locked,超时按启动 / 等锁 / 探测三段独立计时(此前 powershell 冷启动 + Add-Type 编译与 mutex 竞争共用一个预算,满载 runner 上必超);waitForExit 等真实 exit 事件再收口,消除 release 后重试与仍持锁进程的竞态。生产行为改动集中在 barrier acquire 的内部计时与脚本协议,对外契约不变
  • 明确不包含:Memory / 通讯录 / 群历史 FTS;jieba / trigram / 第三方 tokenizer;拼音或首字母;服务端和 Mobile
  • 用户可见变化:没开「聊天记录语义索引」时,侧栏和两个历史搜索工具也能命中中文短词;结果预览保留原文空格,不出现「foo 登 录 bar」这种假空格
  • 是否存在 breaking change:无。旧安装升到含 0099 的版本时执行一次 FTS 重建;回滚代码后索引形态仍是按字切开,旧查询(整段 CJK 当一个 token)会变窄,需再发一条重建 migration 才能回到旧形态

UI 变化

侧栏搜索结果的 snippet / 标题高亮仍走既有 <mark>bg-search-match-bg / text-search-match-fg,没有新控件、新文案或新颜色。改动是高亮切点:按原文码点切,emoji 不再被切成半个代理对。Light / Dark 都未做实机目检。

  • 引用的设计规范:docs/design-rules/DESIGN.md §10「Theme System & Token Reference」的 Light / Dark Dual-Mode Delivery Gate,以及 §15.4 将 search-match-bg 列为语义豁免色。本次复用既有搜索高亮 token,无新增硬编码颜色。

怎么验证的

自动验证

pnpm --filter desktop db:validate
结果:通过(0000..0099,100 条 SQL + journal / snapshot 对齐)

pnpm --filter desktop run --if-present typecheck
结果:通过

pnpm --filter @cindy/mcps run build
结果:通过(该包没有 typecheck script,`build` 即 `tsc --noEmit`)

pnpm --filter desktop exec vitest run src/main/localDb/__tests__/chatHistorySearch.pure.test.ts src/main/localDb/__tests__/conversationSearch.pure.test.ts src/main/maker-host/__tests__/session-search.test.ts src/renderer/features/cc-agent/sidebar/__tests__/keywordRanges.test.ts src/renderer/features/cc-agent/sidebar/__tests__/snippetMarkup.test.ts src/renderer/__tests__/highlightSegments.test.ts
结果:通过(6 files / 54 tests)

pnpm --filter @cindy/mcps exec vitest run src/__tests__/searchChatHistoryTool.test.ts
结果:通过(10 tests,含 query 最长 256 的 schema 校验)

pnpm test:unit
结果:通过

pnpm check:dco
结果:通过(1 commit signed off — range b7837c74..69297735)

pnpm --filter @cindy/maker-core exec vitest run src/agents/pi/windows-git-path-powershell.test.ts src/agents/pi/windows-git-path.test.ts
结果:通过(Windows 实机,10 + 43 tests,含两个真 PowerShell 用例)

pnpm --filter desktop exec vitest run src/main/maker-host/__tests__/codexProxyHost.test.ts
结果:通过(185 tests)

手工验证

  • Windows,--isolated 沙箱,用正式库副本做存量升级,未写共享 Cindy userData
  • 升级后侧栏搜「登录」「foo登录bar」「登录 报错」能命中存量中文短词;snippet 保留原文空格,不出现索引侧假空格
  • 约 5 万条白名单消息 DROP+INSERT 约 3 秒;FTS +12%,整库 +0.55%

未执行的验证

  • 依赖 better-sqlite3 的定向套件最初因 NODE_MODULE_VERSION 137 vs 127 无法加载 native addon;本机按 .nvmrc 重建依赖后已复跑通过(cjkSeg 10、segmentMessagesFtsCjkMigration 4、cjkFtsMatch.integrationbetterSqliteFactoryruntime)。
  • Light / Dark 未做实机目检。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:

影响与回滚

  • 影响范围:Desktop 本地 messages_fts。0099 升级时对白名单 role 做一次 DROP + 按字回填;之后每条消息写入经触发器调用 cjk_seg。Memory / 通讯录 / 群历史表不改。漏注册 cjk_seg 会让插入消息失败。顺手修复里唯一的生产行为改动是 maker-core Windows probe 失败收尾路径的后代清理超时 2s→8s,不影响 probe 主流程预算。
  • 回滚 / 降级方式:回滚代码不会自动把 FTS 还原成整段 CJK token。索引会保持按字切开,旧客户端仍能搜,但整段中文 MATCH 会变窄。若必须回到旧形态,需要后续 migration 再重建,不能改写已进 main 的 0099。
  • 已知限制:汉字被标点隔开时(「边,界」)按字 phrase 仍可能命中,这是按字索引的固有噪声。超长消息的 snippet 扫描目前没有输入上限,输出窗口有上限;粘贴过很大日志的消息在侧栏边打字边搜时可能变慢,不在本 PR 处理。
  • Mobile 冷更判断:不涉及 apps/mobile 原生配置或 runtime fingerprint,不触发冷更。
  • 存量插件影响:无。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范章节(不涉及 UI 则跳过)
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档(docs/dev-rules/database-and-migrations.md 写明写 messages 必须注册 cjk_seg
  • 已确认测试结果或说明未执行原因

messages_fts 写入侧用 cjk_seg 在汉字间及中英边界插空格,查询侧收成相邻
phrase;侧栏 / search_chat_history 多词 OR,session_search 多词 AND。
snippet 从原文重建并转义标签,高亮按码点坐标切。存量重建 migration 为 0099。

Signed-off-by: yan <yan233@xd.com>
@yan-xdt
yan-xdt requested a review from a team as a code owner August 28, 2026 09:44
@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 为 Desktop 的 messages_fts 增加按汉字分词,并统一侧栏、search_chat_historysession_search 的中文短词查询。

  • 新增 cjk_seg SQLite 函数并在数据库工厂、worker、回滚 worker 和迁移路径注册
  • 通过 0099 companion migration 重建或复用 FTS 与 rowid 映射,并更新维护触发器
  • 新增 CJK phrase 查询构造、原文 snippet 重建和按码点高亮
  • 当前 snippet 重建没有复现 porter/tokenizer 的实际匹配语义,部分合法结果会显示无关且无高亮的预览

Confidence Score: 4/5

合并前应修复 FTS 实际命中与 snippet 重建语义不一致的问题,否则部分搜索结果会展示无关且无高亮的预览。

新的召回路径由 porter unicode61 判断命中,但预览仅按原始查询 token 做精确定位,因此词干命中和跨标点中文 phrase 命中会丢失实际命中上下文。

Files Needing Attention: apps/desktop/src/main/localDb/cjkSeg.ts, apps/desktop/src/main/localDb/chatHistorySearch.ts, apps/desktop/src/main/maker-host/session-search.ts

Important Files Changed

Filename Overview
apps/desktop/src/main/localDb/cjkSeg.ts 新增 CJK 分词、坐标映射及原文 snippet 重建;后者无法定位 porter 词干命中和跨标点 phrase 命中。
apps/desktop/src/main/localDb/chatHistorySearch.pure.ts 新增有限长、转义后的 messages_fts MATCH 构造,并按入口支持 OR/AND 语义。
apps/desktop/src/main/localDb/chatHistorySearch.ts 侧栏和历史搜索改用分字 MATCH 及原文预览,但继承了 tokenizer 命中与预览定位不一致的问题。
apps/desktop/src/main/maker-host/session-search.ts session_search 改为多词 AND 并重建原文 snippet,同样可能返回不含实际命中的预览。
apps/desktop/drizzle/scripts/0099_segment_messages_fts_cjk.ts companion migration 原子地校验或重建 FTS、rowid 映射及触发器,未发现当前数据一致性缺陷。
apps/desktop/src/main/localDb/registerCjkSeg.ts 集中注册并探测连接级 cjk_seg 函数,主要生产连接均已覆盖。
apps/desktop/src/renderer/features/cc-agent/sidebar/snippetMarkup.ts 安全解析受控 <mark> 哨兵并按正确顺序还原实体,未发现注入路径。
apps/desktop/src/renderer/features/cc-agent/sidebar/keywordRanges.ts 新增折叠偏移到原文 UTF-16 偏移的映射,避免 Unicode 大小写扩展和代理对导致错切。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Q[用户或工具查询] --> M[构造 FTS5 MATCH]
  M --> F[messages_fts<br/>porter unicode61]
  F --> R[召回消息]
  R --> C[读取 messages.content 原文]
  Q --> T[抽取原始 query tokens]
  C --> S[buildSnippetFromContent]
  T --> S
  S --> O[侧栏或工具结果预览]
Loading
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/localDb/cjkSeg.ts:164-180
**词干命中丢失预览定位**

当查询经 `porter unicode61` 词干化后命中不同表面形式,或中文 phrase 跨标点命中时,这里仍按原始查询 token 精确定位正文;定位失败便返回正文开头且不添加 `<mark>`,导致侧栏、`search_chat_history``session_search` 的合法结果看不到实际命中上下文。

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(desktop): 搜索对中文短词按字召回,不再需要搜整句话才能命中" | Re-trigger Greptile

Comment thread apps/desktop/src/main/localDb/cjkSeg.ts

@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: 6929773534

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/cjkSeg.ts
ConversationSearchBox 收到的是 visibleSnippet 原文,不是 buildSnippetFromContent
的 <mark> 协议。没有哨兵时原样展示,避免字面量 &lt; 被解成 <。

Signed-off-by: yan <yan233@xd.com>

@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: 1b8611ddaa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/chatHistorySearch.pure.ts
Comment thread apps/desktop/src/main/localDb/cjkSeg.ts
长度帽只加在会按字展开的汉字 token 上。Latin / 数字整段是一个 FTS token,
截成 64 字后 quoted MATCH 不再精确命中。

Signed-off-by: yan <yan233@xd.com>

@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: 7aef4ab861

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/conversationSearch.ts Outdated
Comment thread apps/desktop/src/main/localDb/chatHistorySearch.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@yan-xdt 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/localDb/conversationSearch.ts / apps/desktop/src/main/localDb/chatHistorySearch.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:redline 改动碰到红线路径(updater / DB schema 等,review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) touches:security 改动碰到安全边界(review-pr 自动维护,仅展示) labels Aug 28, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

这条 PR 进入维护者确认:产品 UI(会话搜索高亮)、安全敏感写法、规则文档和较大核心改动都命中了。请维护者直接在 PR 上 Approve;若要改请 Request Changes,作者改完后再 Approve。讨论 issue:#3572

本轮 CI 未绿、还有未 resolve 的 conversation,确认通过后也还要先处理这些卡点。

@MagicLizi MagicLizi added the awaiting-discussion 等待维护者讨论(review-pr) label Aug 28, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

命中 UI 路径(apps/desktop/src/renderer/features/cc-agent/lib/highlightSegments.tsx / apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx / apps/desktop/src/renderer/features/cc-agent/sidebar/keywordRanges.ts 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范

可见命中改为字面匹配或 cjk_seg token 序列,不再用 preview 非空当证据。
FTS 查询用 substr 限制传回字符数,snippet 扫描同一上限。

Signed-off-by: yan <yan233@xd.com>

@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: ed9492d883

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/renderer/features/cc-agent/sidebar/snippetMarkup.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@yan-xdt 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/sidebar/snippetMarkup.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

searchConversations 给 renderer 的是原文切片。原文里同时出现 <mark> 和实体时,
旧启发式会进协议模式并把 &lt; 解成 <。默认当原文,只有显式 protocol:true 才解码。

Signed-off-by: yan <yan233@xd.com>

@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: 12e4c4d800

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/drizzle/scripts/0099_segment_messages_fts_cjk.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@yan-xdt 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/drizzle/scripts/0099_segment_messages_fts_cjk.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

SQLite 自定义函数是连接级的,持久触发器引用它会让回退后的旧客户端
插入消息直接报 no such function。持久 insert/update 触发器改回只写
原文,并用 pragma_function_list 守卫在已注册函数的连接上跳过;新
连接由 registerCjkSeg 挂 TEMP 触发器按字写入。应用 0099 后回退旧
客户端插入仍成功,只是新行不再按字切。

Signed-off-by: yan <yan233@xd.com>

@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: a064bd7151

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/conversationSearch.ts
清理 powershell 的 2s 预算覆盖不了满载机器上自身冷启动加 Win32_Process
BFS,超时后走 catch 静默放弃,孤儿后代留到存活检查超时——即 makecindy#3574 的
偶发失败形态。清理只在 probe 失败的收尾路径执行,放宽不占交互预算。
测试侧同步把存活检查的进程启动余量放宽,并让 probe 输出带诊断(操作
被预算截断)时与整体 ETIMEDOUT 同口径 skip,不改任何断言语义。

Signed-off-by: yan <yan233@xd.com>
@yan-xdt
yan-xdt force-pushed the feat/issue-3331-cjk-fts branch from 0e7d237 to 7d209fe Compare August 28, 2026 13:46
@yan-xdt

yan-xdt commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 7d209fec7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/registerCjkSeg.ts
@yan-xdt

yan-xdt commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 7d209fec7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@yan-xdt
yan-xdt force-pushed the feat/issue-3331-cjk-fts branch from 7d209fe to 9adea2c Compare August 28, 2026 14:36
每个用例都经 resetModules 加动态 import 重新加载整条 SUT 模块链,首
用例承担全部依赖的首次编译加载,满载 CI 上超出 vitest 默认 5s 报超时。
只放宽本文件 testTimeout,断言与流程不变。

Signed-off-by: yan <yan233@xd.com>
helper powershell 的冷启动(Add-Type 编译、.NET 加载)与 mutex 竞争共用
一个超时预算,满载 CI 上冷启动吃光预算直接报 timed out acquiring——
Windows unit 已连续多轮挂在 mutex 用例上。helper 现在先报 started、锁住
后报 locked,超时按启动 / 等锁 / 探测三段独立计时;waitForExit 等真实
exit 事件再收口,消除 release 后重试与仍持锁进程的竞态。测试补
started/locked 解析、脚本顺序锁定与强杀后等 exit 的用例。

Signed-off-by: yan <yan233@xd.com>

@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: 2eefb2a62f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/chatHistorySearch.pure.ts
token 码点帽从 64 提到 256,与 MCP schema 的 query 上限对齐。此前
65~256 字连续汉字被截成 64 字前缀 phrase,只含前缀的消息会假阳性命中
——messages_fts 按字 phrase 与群历史整段 token 两条路径都是。整段保留
后两条路径都精确;超 256 截断只防御绕过 schema 的超长侧栏输入,
MATCH_CHAR_CAP 按 token 粒度截断不会切出半个 phrase。

Signed-off-by: yan <yan233@xd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:redline 改动碰到红线路径(updater / DB schema 等,review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) touches:security 改动碰到安全边界(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 侧栏任务搜索 / session_search 的中文搜索几乎不可用,改进讨论

2 participants