Skip to content

[P0] notification: no outbound notification channel — every flow's notify node is a no-op #1292

Description

@xuyushun441-sys

来源:docs/PLATFORM_GAPS_FROM_TEMPLATES.md 第 1 条(P0)。
实证发现自 objectstack-ai/templates 仓库中的 7 个模板:contracts / procurement / compliance / content / todo / hotcrm / helpdesk。
每一个模板都被这个缺陷击中,且没有任何模板侧能彻底绕过去的方案。

现象

Flows / state machines 里写的 notify 节点调用是成功的(dev server 日志里能看到节点执行、notify.send 之类的调用记录),但没有任何外发通道把消息真正送到收件人手里

  • 邮件 ❌(无 SMTP / SendGrid / SES adapter)
  • IM / 群机器人 ❌(飞书 / 钉钉 / 企业微信 / Slack / Teams 全无)
  • Webhook ❌(连最通用的「往 URL POST 一个 JSON」都没有)
  • 站内 inbox ❌(用户在 Console 内也看不到一个「未读通知」铃铛)

结果:业务用户根本不知道有事要处理。审批人不会主动去刷新工单页,客户不会主动登录工单门户看回复。整个系统看起来是「死的」。

复现路径

任选一个已发布模板:

cd packages/procurement
pnpm dev
# 浏览器:创建一个 procurement_request,把金额改到超过审批阈值
# 触发 procurement.approval_required 流程

预期:审批人 (Owner profile) 收到通知。
实际:审批人收到 0 条任何形式的通知。Flow 日志显示 notify 节点 OK。

相同复现可在 helpdesk 的 escalate_angry_customer.flow.ts、compliance 的逾期任务提醒、contracts 的续约 60 天提醒等任意 flow 中观察到。

当前模板侧的不得已 workaround

只能用「状态字段 + dashboard 视图」做轮询代偿:

// 例:procurement/src/dashboards/approver_inbox.dashboard.ts
{ type: 'table', filter: { status: 'pending_approval', approver: '{currentUser}' } }

代价:

  1. 用户必须主动登录才能看到。
  2. 离开当前页面就完全失联。
  3. 时效性归零——SLA 模板(helpdesk / compliance)的 SLA 失去意义。
  4. 跨设备 / 移动端 / 假期场景全部 0 触达。

建议范围(最小可用切片)

不追求一步到位做 7 种 channel,先把架构两个最普适的 channel 落地。

M1:通道抽象层

  • framework 新增 services/notification(或挂在 EmailServicePlugin 旁):
    • Channel 接口:send(envelope: NotificationEnvelope): Promise<DeliveryResult>
    • NotificationEnvelope{ to, subject?, body, locale, contextRef?, channelHint? }
    • 路由策略:根据收件人 profile 的 preferred_channels 选 channel,按 hint / 优先级降级
  • Flow 节点 notify 接入此服务(当前只是日志桩)

M2:两个内置 channel

  • inbox —— 站内 notifications 对象 + Console 顶栏铃铛 + 未读 badge(这是 P0 中的 P0,无外部依赖、任何部署都能用)
  • email —— SMTP adapter(最低门槛),SendGrid / SES 作为扩展点

M3:开发者扩展点

  • Plugin 形式注册 channel(社区可补飞书 / 钉钉 / Webhook)
  • 文档 + helpdesk / procurement 模板里至少一个 flow 真实接通

非目标(本 issue 不做)

  • 模板化邮件渲染(MJML 等)— 单开 issue
  • 通知聚合 / 摘要 / 静默时段 — 单开 issue
  • 推送 / SMS — 单开 issue

验收

  • notify 流节点能落到站内 inbox,并在 Console 顶栏有未读提示
  • notify 流节点能通过 SMTP 发出邮件,至少有一个模板(建议 helpdesk 的 escalate_angry_customer)真接通
  • 至少一个第三方 channel plugin 示例(建议 Webhook)
  • docs/PLATFORM_GAPS_FROM_TEMPLATES.md 把 gap Add metamodel interfaces for ObjectQL/ObjectUI contract #1 标为已解决
  • 七个模板的 README 不再需要「目前没有真实通知投递」的限制条款

影响面(按降序)

模板 被阻塞的核心场景
helpdesk SLA 预警、愤怒升级、新工单分诊提示
procurement 审批通知、超期提醒
compliance 整改任务到期、外审通知
contracts 续约 60/30/7 天提醒
content 发布日历到期提醒
hotcrm 商机阶段变更、跟进提醒
todo 截止日期提醒

参考:

  • 仓库:https://github.com/objectstack-ai/templates
  • 缺陷库:https://github.com/objectstack-ai/framework/blob/main/docs/PLATFORM_GAPS_FROM_TEMPLATES.md

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestpriority:p0Critical: blocker, must ship before MVP

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions