Skip to content

feat(channels): integrate WeCom, Feishu, DingTalk and Telegram gateways - #19

Open
lien0219 wants to merge 986 commits into
mainfrom
feature/channel-gateway
Open

feat(channels): integrate WeCom, Feishu, DingTalk and Telegram gateways#19
lien0219 wants to merge 986 commits into
mainfrom
feature/channel-gateway

Conversation

@lien0219

@lien0219 lien0219 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

概述

实现 OpenXFlow 多渠道消息网关,统一接入企业微信、飞书、钉钉和 Telegram,并按生产级目标完善共享访问、服务身份、上下文隔离、持久化队列、消息审计、文件安全、Provider 回调安全和管理体验。

当前开发状态

本 PR 的生产功能实现与专项自动化收口已完成,现已进入四平台人工验收;人工验收完成前不合并到 main

已完成

  • 四平台统一 Provider Adapter、事件模型、能力模型和运行时工厂
  • 渠道连接、外部身份、自动发现会话、账号绑定和自定义指令
  • shared / bound_only / hybrid 访问策略
  • 成员隔离、群共享上下文和 Telegram 主题/线程级上下文隔离
  • 自动创建不可登录、非管理员的独立 Channel Service Identity
  • 服务身份仅执行连接、会话或指令显式授予的工作流 UUID
  • 共享路由使用服务身份、个人路由使用绑定用户身份
  • 统一群聊响应模式:mention_only / all_messages / commands_only / disabled
  • 能力驱动的处理中占位消息、消息更新和跨渠道响应策略
  • 渠道执行状态、执行身份、消息记录和出站投递幂等
  • 数据库持久化 Webhook 任务、租约恢复、失败重试和严格 FIFO
  • 同上下文串行,不同成员与会话并行
  • 连接并发、单用户排队、频率限制、每日配额、排队超时和任务超时
  • HTTP Webhook 与钉钉 Stream 统一进入持久化任务链路
  • 四渠道文件下载、资产跟踪、知识库处理和服务身份知识库授权
  • 文件内容类型校验、恶意文件扫描、压缩包遍历/炸弹和可执行文件伪装防护
  • Token 缓存、刷新、失效恢复和连接级运行指标
  • 投递重试、配置审计和消息中心筛选
  • 渠道中心生产配置、会话覆盖、账号、指令和运行记录管理体验
  • Telegram Webhook Secret、飞书 Verification Token、企微 EncodingAESKey 等 Provider 凭据前后端校验
  • Telegram UTF-16 mention 解析、钉钉/企微回调时效验证和适配器 fail-closed 校验
  • 受影响的认证、会话清理和进度跟踪 Playwright 用例稳定性修复

已完成专项回归

  • 生产访问策略与上下文主链路:65 项回归测试通过
  • 持久化 FIFO 队列主链路:53 项回归测试通过
  • Provider 安全与渠道网关专项:Python 3.14、Ruff、编译、后端回归、前端 Biome 和生产 UI 契约测试通过
  • 五项失败工作流已通过独立修复工作流验证,并以单个 squash 提交合入 feature/channel-gateway

人工验收中

  • 验证飞书、Telegram、钉钉、企业微信的私聊、群聊、文件、长消息、重复回调和异常恢复
  • 验证 SQLite 单进程模式下的多人并发、队列等待、重启恢复和消息幂等
  • 汇总人工验收问题,仅在 feature/channel-gateway 修复后复验
  • Test Docker Images 若长期仅处于 queued、尚未实际执行,按项目负责人授权不阻塞人工验收

自动化要求

每个阶段执行:

  • Ruff 格式与静态检查
  • Python 编译检查
  • 渠道专项回归测试
  • 前端格式、单元测试和 TypeScript 检查
  • SQLite/PostgreSQL 迁移校验
  • 最终仓库级 CI(长期排队且未执行的 Docker 检查不作为阻塞项)

人工验收状态

  • 后端生产链路完整实现
  • 前端生产管理能力完整实现
  • 四渠道能力矩阵与实际适配器一致
  • 安全、队列、消息、文件和审计专项自动化检查通过
  • 已实际执行的仓库级关键 CI 全部通过
  • 进入人工验收
  • 人工验收完成后合并

@github-actions

Copy link
Copy Markdown
Contributor

Migration Validation Passed

All migrations follow the Expand-Contract pattern correctly.

@github-actions github-actions Bot added the enhancement New feature or request label Jul 23, 2026
@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 24, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the enhancement New feature or request label Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

Copy link
Copy Markdown
Owner Author

持久工作流选择实现完成,进入最终人工验收

当前 feature/channel-gateway Head:2b6f62528a62086b648d864cac5caa66af30003f

本轮完成

  • 新增按 连接 + 会话 + 渠道身份 + 线程/Topic 隔离的持久工作流选择
  • 新增 /use-flow/切换工作流/current-flow/当前工作流
  • /use-flow default 恢复会话/连接默认路由
  • 显式业务指令仍只影响本次执行,不修改当前选择
  • 普通消息路由优先级:有效个人选择 → 会话覆盖 → 连接默认
  • 共享指令继续使用 Channel Service Identity,个人指令使用绑定用户身份
  • 指令禁用、删除、权限/作用域变化、过期后自动清除并回退默认工作流
  • 工作流 session_id 加入工作流维度,群共享上下文按 session_id 隔离
  • 新增 selected 执行触发类型及选择、指令审计关联字段
  • 新增 SQLite/PostgreSQL 兼容迁移 a1f4c7e9d2b6
  • 默认路由页增加用户切换开关与 TTL
  • 指令编辑增加“允许设为当前工作流”
  • 指令页增加活动选择列表、单项撤销、过期清理和分页
  • 路由文档已同步更新

自动化结果

  • 持久选择专项、系统指令、指令路由、SQLite 升降级:22 项通过
  • Channel Gateway Core:Ruff、编译、工作流语法、全部渠道契约测试通过
  • Database Migration Validation:迁移模式与模型一致性通过
  • Channel Gateway Frontend:TypeScript、单元测试通过
  • 最终 Head:Biome 格式检查通过
  • 后续同内容重跑若仅处于 queued,按既定人工验收规则不阻塞

人工验收重点

  1. 默认路由开启“允许用户切换工作流”,设置有效期。
  2. /总结/翻译 等指令开启“允许设为当前工作流”。
  3. 私聊验证 /use-flow /总结/current-flow、普通消息、显式 /翻译/use-flow default
  4. 群聊验证不同成员选择互不影响。
  5. 飞书线程或 Telegram Topic 验证不同线程选择互不影响。
  6. 重启后端后确认选择仍然存在。
  7. 禁用已选指令后确认自动回退默认工作流。
  8. 指令页确认活动选择可见、可撤销、可清理过期项。
  9. 运行记录确认触发类型为“当前工作流”,执行身份符合共享/个人规则。

人工验收完成前不合并到 main

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

@github-actions

Copy link
Copy Markdown
Contributor

Build successful! ✅
Docs draft deployment skipped because this repository has no deployment credentials configured.

Copy link
Copy Markdown
Owner Author

最终生产加固完成(持续工作流选择)

正式分支 Head:e6433e54cd19cabba8d2ff0f148655228f75a708

本轮已补齐:

  • 用户选择、恢复默认、自动失效、管理员撤销、手动/后台清理的完整渠道审计
  • 活动选择管理接口服务端聚合成员、会话、指令、工作流和执行身份,支持分页与搜索
  • 管理端删除额外的前 100 条指令/会话/账号拼装请求
  • 后台按批次自动清理过期选择,PostgreSQL 使用 SKIP LOCKED,SQLite 保持单进程兼容
  • 群聊系统指令可配置必须明确 @机器人;Telegram 支持 /command@bot_name
  • /current-flow 展示工作流名称、指令、执行身份、会话范围、剩余有效期和 endpoint
  • /commands 为允许持续选择的业务指令提供快捷切换动作
  • 活动选择按连接、过期、成员和工作流增加组合索引
  • 新增迁移 c7e2f4a9b1d3
  • 新增生产运维与人工验收文档

正式 Head 已执行并通过:

  • Channel Gateway Core(工作流语法、Ruff、编译、全部渠道契约测试)
  • Channel Gateway Frontend(单测、TypeScript、Biome)
  • Database Migration Validation(迁移规范、SQLModel/Alembic 一致性)
  • Extension Migration Checks
  • RBAC Productization(前后端)
  • Ruff Style Check
  • Development Scripts
  • GP Backend Auto-update Strings
  • Test Coverage Advisor
  • autofix.ci

CI 仍处于排队、Template Tests 仍在执行;按项目负责人此前确认的规则,未实际失败的排队任务不阻塞最终人工验收。

临时 PR #27#28 已关闭且未合并;临时分支引用已复位到正式 Head,没有临时生成器或引导脚本进入 feature/channel-gateway

下一阶段:四渠道最终人工验收,验收通过后再合并 main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants