Skip to content

[待开发]Workflow 后端 contract 与运行入口 #1188

Description

@JAVA-LW

Issue 元数据

已确认事实

  • Parent issue: [待开发]Workflow 运行与发布契约 ADR #1187
  • Workflow 后端第一版必须承载 workflow_start / workflow_end 专属节点、触发器配置、同步 / 异步运行、/api/ex/{slug}、定时触发和全局 OpenAPI 注册。
  • 现有 orchestration runtime、published flow run、logs、monitoring、OpenAPI 构建链和 TaskQueue 是可复用基础。
  • 用户确认 /api/ex/{slug} 全系统唯一,扩展接口触发器保存时需要验证冲突,已存在则失败。

不可协商不变量

  • Workflow 节点类型不得与 AgentFlow 节点类型重名。
  • /api/ex/{slug} 归属 application publish contract,不开放给 runtime plugin 任意注册系统接口。
  • 同步返回值只能来自 workflow_end 明确声明的返回字段。
  • 同步超时时间由 workflow_start 配置。
  • 扩展接口参数来源必须覆盖 URL/path、query、form、body。
  • workflow 扩展接口注册到全局 OpenAPI,不只进入应用内 API docs。

待验证假设

  • 后端可以通过 workflow schema / compiler 分支支持 workflow_startworkflow_end,而不改写 AgentFlow 既有 start / answer contract。
  • 现有 FlowRunStatus::Queued 和 TaskQueue contract 足以支撑异步第一版和定时触发第一版。
  • 全局 OpenAPI 构建链可以读取已发布 workflow 扩展接口配置并生成动态路径文档。

验收证据

  • 新 workflow 文档和编译产物能识别 workflow_start / workflow_end
  • API sync / async contract 有自动化测试覆盖。
  • /api/ex/{slug} dispatcher 能验证 slug、认证、发布状态、HTTP 方法、URL/path 参数、query 参数、form 参数、body 参数、响应 schema 和 run 归因。
  • 全局 OpenAPI 包含已发布 workflow 扩展接口的具体路径、方法、参数和响应 schema。
  • 定时触发能创建异步 run;失败 run 记录为 failed,不自动重试。
  • 日志和监控读取仍能展示 workflow runs。

执行边界

  • 主要文件 / 模块:api/crates/domain/src/flowapi/crates/domain/src/system_defaults/flow_document.rsapi/crates/orchestration-runtimeapi/crates/control-plane/src/application_public_apiapi/crates/control-plane/src/orchestration_runtimeapi/apps/api-server/src/routesapi/apps/api-server/src/openapi* / docs builder、Postgres repository mappers as needed。
  • 验证:L3 任务按各自边界补最小测试;仓库级重型门禁可延后到 QA / CI,除非 contract 无法局部证明。
  • 停止 / 升级条件:需要 migration 改历史 run shape、独立 workflow runtime、开放插件 raw route 注册、完整 HA scheduler 或全局 OpenAPI 物化策略超出现有架构时,回到 L1。

生命周期

  • 当前阶段:ready
  • 关闭条件:所有直接 L3 子任务完成并通过对应后端 contract 验收。

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiPublic API or protocol contract workarea:backendBackend API, service, repository, or runtime workarea:runtimeRuntime and execution behaviorarea:workflowWorkflow authoring and orchestration UXchild-issueChild implementation issuecontractContract or API semantics changegrade:g3Cross-domain decision or implementation worklevel:l2Epic / workstream issueneeds-backendNeeds backend workparent-issueParent tracking issuephase:readyIssue is shaped and ready for implementationpriority:p1High priorityrisk:highHigh risk if implemented incorrectlysize:lLarge implementation and review sizetype:featureFeature or new capability

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions