Skip to content

feat(im): 入站音视频交给模型,个人 IM 附件统一受管存放 - #5779

Merged
MagicLizi merged 15 commits into
mainfrom
dash/im-inbound-managed-files
Oct 11, 2026
Merged

MagicLizi merged 15 commits into
mainfrom
dash/im-inbound-managed-files

Conversation

@dashhuang

@dashhuang dashhuang commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

这次改了什么

摘要

Telegram 群里发的视频没有交给 bot:入站代码把视频、语音、音频一律标成“不支持”;群里“先发视频、再单独 @bot”时,群记录只存文件名,触发时也拿不到附件。

本 PR 修复这个问题,并把所有个人 IM 渠道的入站附件统一改为受管存放,不再写冻结的 cc-agent/*-media 目录(docs/dev-rules/media-storage-and-protocols.md:该目录是只读的历史兼容层):

  • Telegram 音视频交给模型:video / video_note / voice / audio 及 video/*、audio/* 文档,20MB 以内(Bot API 上限)下载后经 host.media.cacheMedia 进 cindy-media,以 file block(可读路径)交给模型;超限或格式不收时作为未提供原因告知模型。
  • Telegram 群“先发媒体、再 @”补齐附件:TelegramIM 在内存里记下群媒体的 file_id(200 条 / 24 小时,重启清空;受保护群不记;不随轮次出池,已受理轮次由群窗口游标防重复,同一轮已随附件送达的相册成员与被引消息排除)。触发时只补这一轮群上下文实际纳入那些消息的附件(groupWindowCore 组装结果新增 messageIds),名额与飞书群上下文一致(图片 6、文件 4,最新优先,先占名额再下载),经 contextAttachments 只进模型、不落库;全响应(ambient)轮次不补。
  • 非媒体文件统一受管存放:新增 IMHost.files。transport 把 PDF / docx / zip 等暂存到按账号隔离的 im-attachments/<渠道>/staging/,turnRunner 在任务确定后、交给模型和落库之前,移入 im-attachments/<渠道>/sessions/<任务ID>/(与微信既有目录同一棵树)。任务删除时统一清理所有渠道的附件目录(含微信,并补上 updateSessionInDb / setSessionsStatusInDb 路径漏清的情况);无人认领的暂存文件 24 小时后清理。实现见 apps/desktop/src/main/im/shared/inboundFileStaging.ts。
  • 各渠道收口:飞书、Discord、Telegram、企业微信的图片与音视频走 host.media,其余文件走 host.files;能力缺失或总仓拒收格式时标为不支持,不再回落写旧目录。飞书视频消息、Discord 音视频顺带改为下载后交给模型。移除飞书 mediaStore.getOrDownload 旧目录缓存。

变更类型

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

范围

  • 关联 Issue / 需求:Telegram 群里发给 bot 的视频没有被提供(Dash 反馈);附件不应继续写 cc-agent,所有个人 IM 渠道一并更新。
  • 本 PR 包含:个人 IM 渠道(飞书、Discord、Telegram、企业微信;钉钉不收文件,微信已是目标做法)的入站附件存放与 Telegram 音视频 / 群历史媒体;相关规则文档与 Telegram 能力台账(2j)。
  • 明确不包含:官方 bot(服务端入站)的音视频处理;cc-agent 下历史文件的清理(规则禁止新增该目录删除能力)。
  • 用户可见变化:
    • Telegram 视频、语音、音频(≤20MB)以及“先发视频再 @”能被 bot 读到;飞书视频、Discord 音视频同样会交给 bot。
    • 媒体仓不收的格式(如飞书 bmp / svg 图片、mkv)明确告知“未提供”,不再存旧目录。
    • 个人 IM 收到的普通文件随任务删除一起清理(归档保留)。
  • 是否存在 breaking change:无。旧消息里指向 cc-agent 的路径保持可读;IMHost.paths.*MediaDir 保留为只读兼容字段。

UI 变化

不涉及。

  • 引用的设计规范:不涉及

怎么验证的

自动验证

packages/lizi-im: npx tsc --noEmit
结果:通过
packages/lizi-im: npx vitest run
结果:50 个文件 726 个测试全部通过(新增飞书 attachmentDownloader、Telegram 音视频 / 群历史媒体、Discord / 企业微信受管存放等用例)
apps/desktop: pnpm run typecheck
结果:通过
apps/desktop: npx vitest run src/main/im src/main/localDb/ipc src/main/hook-control
结果:146 个文件 2833 个测试全部通过(新增 inboundFileStaging:暂存、移入任务、删除清理、过期清理、恶意文件名)
run-unit-gate.sh(pnpm test:unit)
结果:除 apps/desktop 外全部 PASS;apps/desktop 的 vitest 进程两次 SIGSEGV 崩溃(非断言失败,崩溃前用例全部通过)。
按门禁同一 exclude 以 --maxWorkers=3 单独重跑 apps/desktop:3369 个文件 50017 个测试全部通过,1 个文件 / 21 个测试跳过。

第 1 轮 review 收敛(f16babf8e,已 rebase 到 main 7c4ba33)后复跑:

packages/lizi-im: npx tsc --noEmit 通过;npx vitest run 50 个文件 730 个测试全部通过
apps/desktop: pnpm run typecheck 通过;npx vitest run src/main/im src/main/localDb/ipc src/main/hook-control 146 个文件 2835 个测试全部通过

CI「Linux unit tests (2/2)」唯一失败 src/renderer/__tests__/remoteAgentRelocationWiring.test.ts(ModelSelector 改道行带所属电脑)是 main 基线问题:本 PR 未改 renderer,rebase 到 main 7c4ba33 后在本地同样失败,来自 main 近期 provider-group 提交,本 PR 不修。

手工验证

未在真实 IM 中实测(见下)。

未执行的验证

  • 真实 Telegram / 飞书 / Discord / 企业微信收发附件未实测,计划合入个人版后在 Telegram 群验证:私聊视频、群里先发视频再 @、引用视频 @、语音、超过 20MB 的视频,以及 cc-agent/*-media 不再新增文件。

风险

风险分类

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

影响与回滚

  • 影响范围:个人 IM 渠道入站附件的落盘位置与生命周期;Telegram 群上下文会额外附带历史媒体(只进模型、不落库)。非媒体文件按账号隔离、文件名消毒、路径越界校验;暂存移入失败时保留暂存路径,不阻断本轮。下载期间配置换代(登出 / 换号)时回滚本次暂存。
  • 回滚 / 降级方式:直接 revert 本 PR;新路径下的文件仍可读,不涉及数据库结构变更。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO)
  • UI 改动已在「UI 变化」注明引用的设计规范章节(不涉及 UI 则跳过)
  • 未提交凭证、令牌或授权文件
  • 已核对受影响的文档,行为变化涉及的旧结论已同步修订(不涉及则无需修改文档)
  • 已确认测试结果或说明未执行原因

@dashhuang
dashhuang requested a review from a team as a code owner October 11, 2026 02:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-10-11T05:38:47.475569Z 927aefb New commits
🔒 Security Review ✅ Completed 2026-10-11T05:43:15.473280Z 927aefb New commits

Security findings

Advisory findings (1)

ℹ️ 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: 536424efed

ℹ️ 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 apps/desktop/src/main/im/shared/inboundFileStaging.ts
Comment thread packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
Comment thread apps/desktop/src/main/im/shared/turnRunner.ts Outdated
Comment thread packages/lizi-im/src/telegram/inbound.ts Outdated
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 2/5

[High impact] Refactors how incoming IM attachments are stored and routed to tasks.

应先修复飞书文件跨账号写入,以及路由改变后附件仍归旧任务的问题,再合并。

Findings

  1. P1 附件仍归旧任务 ▶
  2. P1 Security 旧文件写进新账号 ▶
  3. P2 中文长文件名被拒收 ▶
  4. P2 群背景图片无法回收 ▶
Fix with agent prompt
### Issue 1
apps/desktop/src/main/im/shared/turnRunner.ts:3981
提前落库会把附件移入任务 A。群上下文下载期间,用户可通过桌面更换接管目标。随后派发到任务 B 时,`adoptStagedInboundFiles` 会跳过已位于旧任务目录的文件,任务 B 仍保存任务 A 的附件路径。删除任务 A 就会让任务 B 的附件失效。

路由改变时,应为新任务复制附件并更新路径,同时保留提前落库记录使用的文件。

### Issue 2
packages/lizi-im/src/feishu/attachmentDownloader.ts:153-155
飞书普通文件下载完成后直接调用 `host.files.stage`,没有复查开始下载时的账号,也丢弃了返回的 `discard`。停止飞书连接不会等待这些下载结束。若旧下载在切换账号后完成,暂存目录会按当前账号解析,把旧账号的文件写进新账号目录。后面的连接检查只丢弃消息,不会撤销文件。

应在下载前捕获账号,写入前复查,并在写入后账号失效时回滚。

**How this was verified:** 飞书旧下载可在连接停止后继续完成,随后暂存函数按当前账号选择目录,而消息丢弃分支没有删除已写文件。

### Issue 3
apps/desktop/src/main/im/shared/inboundFileStaging.ts:55-57
`sanitizeInboundFileName` 按 JavaScript 字符数截断,但磁盘文件名还会加上 37 字节的 UUID 前缀。例如 80 个汉字加 `.pdf` 本身是 244 字节,Telegram 旧路径可保存;新路径变成 281 字节。在常见 Linux/macOS 文件系统上,这会触发 `ENAMETOOLONG`,附件被当作下载失败丢弃。

应按 UTF-8 字节预算截断,预留前缀和扩展名,并补中文文件名测试。

### Issue 4
packages/lizi-im/src/telegram/inbound.ts:473
新增群历史图片下载复用了普通入站图片路径,没有传 `staging: true`。`host.media.cacheImage` 因此把图片标为不可按缓存回收;缓存命中还会调用 `pinBlob`。这些图片只进入 `contextAttachments`,不会随消息落库建立任务引用,已有的集成缓存引用却会留下。本应可回收的群背景图片会持续占用媒体仓。

应为历史图片提供可回收的写入和缓存读取方式,不执行普通用户附件的固定保留操作。

---

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

Summary

本 PR 将个人 IM 普通文件改为按账号暂存、按任务保存,并补齐 Telegram 音视频和群历史附件。

  • Telegram sends supported voice and video to the model.
  • Telegram group turns can include media from earlier messages.
  • Personal IM attachments use storage tied to their task.

已说明的设计:dashhuang 在 PR 描述中明确说明,无人认领的暂存文件按龄、在下一次暂存时清理;拒绝消息留下暂存文件及清理等待下一次暂存不另报。

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[个人 IM 入站附件] --> B{附件类型}
  B -->|图片或音视频| C[媒体仓]
  B -->|普通文件| D[账号暂存目录]
  D --> E[任务确定后移入附件目录]
  E --> F[模型读取和用户消息落库]
  C --> F
  G[Telegram 当前群窗口的消息 ID] --> H[下载历史附件]
  H --> I[仅提供给模型]
  J[删除任务] --> K[清理各渠道任务附件目录]
Loading

Reviews (1) · Last reviewed commit: "refactor(im): 个人 IM 入站附件统一进受管存放,不再写 cc-a..." · Reviewed by Greptile

Comment thread apps/desktop/src/main/im/shared/turnRunner.ts
Comment thread packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
Comment thread apps/desktop/src/main/im/shared/inboundFileStaging.ts Outdated
Comment thread packages/lizi-im/src/telegram/inbound.ts Outdated
- video / video_note / voice / audio 与 video/*、audio/* 文档不再标 unsupported,
  20MB 以内按文件下载(file block 路径),超出标 oversize
- TelegramIM 内存记下群媒体 file_id(200 条 / 24h,受保护群不入池,
  已随本轮送达的出池),群上下文实际纳入的消息附件经 contextAttachments
  只进模型、不落库;名额与飞书同口径,先占名额再下载,全响应轮次不补
- groupWindowCore 组装结果附带 messageIds;能力台账登记 2j

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
- 音视频经 host.media.cacheMedia 入 cindy-media(可回收暂存,消息落库时转为附件引用)
- host 未提供 cacheMedia 或总仓拒收格式时标 video/audio 不支持,不降级写 legacy 目录
- 下载期间配置换代时回滚本次暂存的媒体

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
- 新增 IMHost.files:非媒体文件按账号暂存到 im-attachments/<渠道>/staging,
  turnRunner 在任务确定后移入 im-attachments/<渠道>/sessions/<任务ID>,
  任务删除时统一清理(含微信),无人认领的暂存文件 24h 后清理
- 飞书、Discord、Telegram、企业微信:图片与音视频走 host.media,其余文件走
  host.files;能力缺失或总仓拒收格式时标不支持,不再回落写 cc-agent/*-media
- 飞书视频消息、Discord 音视频改为下载后交给模型(进媒体总仓)
- 移除飞书 mediaStore.getOrDownload 旧目录缓存;更新媒体规则与能力台账

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang
dashhuang force-pushed the dash/im-inbound-managed-files branch from 536424e to f16babf Compare October 11, 2026 02:59

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

ℹ️ 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 packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated

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

ℹ️ 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 packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.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: 330822805c

ℹ️ 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 packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
Comment thread packages/lizi-im/src/telegram/inbound.ts Outdated
Comment thread packages/lizi-im/src/telegram/index.ts Outdated

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

ℹ️ 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 packages/lizi-im/src/discord/inbound.ts Outdated
Comment thread apps/desktop/src/main/im/shared/turnRunner.ts Outdated
Comment thread packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
@dashhuang

Copy link
Copy Markdown
Member Author

收敛检查点(第 5 轮):入站附件不变量

第 1–5 轮的 review 反馈归为三族。下面每族一条不变量,本 PR 的实现与测试以此为准;之后同族的反馈对照这里判断。

I1 分类:单一判据
一个入站附件的去处只由 packages/lizi-im/src/inboundKind.ts 的 classifyInboundAttachment(mime, fileName) 判定一次,MIME 或扩展名任一命中即归类:

  • image → host.media.cacheImage
  • av → host.media.cacheMedia
  • file → host.files.stage

图片和音视频收不收,由总仓的白名单和真实字节决定;拒收或 host 缺对应能力时标不支持,不回落文件暂存,也不写 cc-agent/*-media。飞书、Discord、Telegram(document 和原生音视频)、企业微信(文件消息)全部复用这个函数。各渠道都有「octet-stream + 扩展名」的测试。

I2 回滚:落库前的写入都可撤销

  • 消息落库前,入站图片一律 cacheImage({ staging: true })。音视频走 cacheMedia,也是可回收暂存。文件走 files.stage,返回 discard。
  • 落库时由 host pin 成用户附件;不落库的(群历史上下文)一直保持可回收,且不调用 getCachedImage 去 pin。
  • 下载期间发生换代时,回滚本次写入:飞书在写入前后复查 accountScope;Telegram、Discord、企业微信按连接代次判断,并调用 stagedDiscards / discard。

I3 归属:任务目录只放落库消息引用的文件

  • adoptStagedInboundFiles 只领养触发消息自己的附件,时机在授权等早退检查之后、构建模型消息之前;归到别的任务的附件会复制一份。
  • 群历史附件(contextAttachments)只进本轮模型,不落库,留在 staging,24 小时后回收。
  • 任务删除时清理所有渠道的 sessions/<任务ID>;归档不清理。

本 PR 不处理(已接受的边界)

  • Telegram 群媒体池只存在内存里(200 条 / 24 小时),重启后清空。
  • 暂存移入时 rename 和 copy 都失败(磁盘级故障)的附件,保留在 staging。
  • 同一账号断线重连时丢弃的消息,其暂存文件按龄回收。

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

ℹ️ 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 apps/desktop/src/main/im/shared/turnRunner.ts Outdated
Comment thread packages/lizi-im/src/feishu/attachmentDownloader.ts
Comment thread apps/desktop/src/main/localDb/ipc/sessions.ts Outdated
Comment thread packages/lizi-im/src/telegram/inbound.ts
@dashhuang

Copy link
Copy Markdown
Member Author

收敛检查点补充(第 6 轮)

第 6 轮的 4 条反馈都已对照前面的不变量收口(提交 c2afc7e):

  • I1 补漏:Telegram 群历史分配名额时的预判(expectedAttachmentKind)改为复用 classifyInboundAttachment。我又清点了一遍,lizi-im 入站路径上已经没有其他自行判断 image/ 的调用点;剩下的 wecom/media.ts 是出站逻辑,不在本范围。
  • I3 补全:受保护内容的轮次不落库,所以也不领养附件。这和群历史一样,附件留在 staging 按龄回收。
  • I2 升级为批次级:飞书在逐项写入前后复查之外,downloadAttachments 还会累计整批的回滚句柄;批次收口时再核一次账号,一旦换代就整批回滚。
  • 任务删除与复活的竞态(新族):删除任务时,异步清理附件目录前会复查该任务仍为 deleted(行不存在也算)。如果任务已经复活就保留目录;读库失败也按保留处理。

新增划定的边界(本 PR 不处理):飞书下载完成后,wsClient 因同账号的连接换代(重连、开话题期间断开)丢弃消息时,已写入的附件不再回滚。这些写入都在原账号自己的作用域里:媒体是可回收缓存,文件留在 staging,24 小时后回收。跨账号的情况已由 I2 覆盖。

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

ℹ️ 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 apps/desktop/src/main/localDb/ipc/sessions.ts Outdated
Comment thread packages/lizi-im/src/wecom/index.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: 5f48381b14

ℹ️ 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 apps/desktop/src/main/localDb/ipc/sessions.ts Outdated

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 5f48381b14

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread apps/desktop/src/main/im/telegram/adapter.ts
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.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: ac43a3666d

ℹ️ 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 packages/lizi-im/src/inboundKind.ts
Comment thread packages/lizi-im/src/wecom/index.ts
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.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: 85d373319f

ℹ️ 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 packages/lizi-im/src/feishu/attachmentDownloader.ts Outdated
Comment thread apps/desktop/src/main/im/host.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: 5743f5d132

ℹ️ 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 docs/dev-rules/media-storage-and-protocols.md Outdated

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

ℹ️ 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 packages/lizi-im/src/discord/inbound.ts
Comment thread apps/desktop/src/main/im/shared/inboundFileStaging.ts
Comment thread packages/lizi-im/src/feishu/attachmentDownloader.ts
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang

Copy link
Copy Markdown
Member Author

边界补充(第 12 轮)

以下两条为本 PR 明确不处理的罕见交错,修复它们都需要新增机制(排队期间的临时引用、暂存续租或队列登记)。如有需要另开 issue:

  • 排队中消息的媒体被手动超限清理逐出:媒体以可回收暂存写入,到派发落库时才 pin。在这段排队期间,如果用户手动执行超限缓存清理,媒体可能被逐出。这在本 PR 之前就已存在:企微图片本来就用 staging,cacheMedia 写入的音视频本来就是 isCache。
  • 排队超过 24 小时的轮次,不领养的暂存文件被按龄清扫:只涉及受保护群附件和群历史附件这两类不领养进任务目录的暂存文件。

@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: 927aefb8b9

ℹ️ 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 apps/desktop/src/main/localDb/ipc/sessions.ts
@dashhuang

Copy link
Copy Markdown
Member Author

边界补充(第 13 轮):如果删除请求在等待 DB 写入或共享任务清理期间恰好切换了账号,发起删除的账号的 IM 附件目录可能残留。这只会多占该账号自己的磁盘,不会误删数据,也不会跨账号暴露数据。本 PR 不为此把原始账号的作用域透传到所有删除入口。

@MagicLizi MagicLizi added touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) labels Oct 11, 2026
@dashhuang

Copy link
Copy Markdown
Member Author

边界补充(维护者决定,2026-10-12):群历史附件与群聊文本、引用附件采用同一信任模型。群友的媒体或文件可能被带进主人触发的轮次。非 Full access 时,群轮次照旧走逐轮强确认;Full access 是主人对该任务的明确授权,本 PR 不另做隔离。

@MagicLizi
MagicLizi merged commit c8ec6f2 into main Oct 11, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants