Skip to content

[P1] sla: no conditional timer primitive — SLA can't pause on waiting_customer; metrics are unfair #1310

Description

@xuyushun441-sys

来源:docs/PLATFORM_GAPS_FROM_TEMPLATES.md 第 35 条(P1)。

现象

平台没有「条件性计时器」原语。所有时间字段都是绝对时刻,无法做「状态切换时暂停 / 恢复」。

最痛的场景是 SLA:

  • 工单进入 waiting_customer(等客户回复),SLA 计时应暂停
  • 客户回复后状态回到 in_progress,SLA 继续累计
  • 总耗时 = 真实处理时间,不该把「等客户」的时间算给坐席

今天的 resolution_due_at 是创建时按 SLA 策略加出来的绝对时刻,整段全程跑表。这导致:

  • 客户三天不回,工单 SLA 必然爆 → 业绩不公正
  • KPI / 工资 / 升迁全错
  • 客服管理者必须手动扣减 → 失去自动化意义

复现

helpdesk 模板:

TIC-2026-006 创建于 2026-05-22,resolution_due_at = 2026-05-24
2026-05-22: status → waiting_customer
2026-05-26: 客户回复,status → in_progress
当前 SLA: 已逾期 2 天(不应)

当前 workaround

  • 加 paused_at / total_paused_minutes 字段,写两个 flow 在状态切换时累加 —— 模板侧能写但易错、不能跨模板复用、UI 显示混乱
  • 干脆放弃 SLA 提醒 —— 失去模板核心卖点

建议范围

M1:声明式 timer 字段

  • spec 新字段类型 timer:{ name, startsAt: cel, pauseWhen: cel, resumeWhen: cel, dueAfter: duration | cel }
  • 系统层维护 accumulated_duration / due_at(动态计算)
  • 状态机切换时自动评估暂停 / 恢复

M2:分级 SLA

  • sla_policy 上能挂多个 timer:first_response_due / resolution_due
  • 业务对象引用 policy + 起步时刻

M3:暂停审计

M4:通知集成

验收

关联

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

    enhancementNew feature or requestpriority:p1High: required for production / M2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions