Skip to content

feat(workflow-controller): add resumable workflow coordination - #107

Open
xyh202131 wants to merge 10 commits into
1024XEngineer:mainfrom
xyh202131:feat/workflow-controller-coordinator
Open

feat(workflow-controller): add resumable workflow coordination#107
xyh202131 wants to merge 10 commits into
1024XEngineer:mainfrom
xyh202131:feat/workflow-controller-coordinator

Conversation

@xyh202131

Copy link
Copy Markdown

变更说明

实现 pages 与 WorkflowRun Entity 之间的 WorkflowController 协调层:页面只发出创作命令并接收阶段快照,状态推进、任务恢复和审核读取继续由 WorkflowRun Service 负责。

本 PR 包含

  • 转发角色生成、角色确认、动作生成、首帧确认、审核、中断与继续命令。
  • 按 active step 恢复角色候选、动作首帧、完整动画和审核阶段。
  • interrupted Run 恢复以及同一 Run 并发 resume() 去重。
  • 首帧确认重试时复用已存在的审核结果。
  • Controller 的读取、列表和订阅边界。

边界说明

验证

  • Controller 定向测试:10 项通过
  • 前端全量测试:35 项通过
  • TypeScript:通过
  • Lint:通过
  • 生产构建:通过
  • git diff --check:通过
  • Controller 3 个文件定向格式检查:通过

Depends on #86
Closes #106

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 4, 2026 9:55am

@xyh202131
xyh202131 marked this pull request as ready for review August 4, 2026 06:45

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three concrete issues keep this flow from being reliable as-is.

}

const taskIds = requireStep(run, 'first-frame').candidateTaskIds
const terminals = await Promise.all(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High: waitForTerminal subscribes only after it has already observed a non-terminal snapshot. If the generation completes in the gap between get() and subscribe(), that terminal event is missed and the promise can hang forever, which leaves start*/resume* calls stuck.

nextType: WorkflowStepType,
updatedAt: string,
): WorkflowRun {
return editCurrentRevision(run, updatedAt, (revision) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High: this helper advances the current revision without checking whether the run was interrupted meanwhile. interruptRun() only flips the run status, so an in-flight generation that finishes later can still move an interrupted workflow forward behind the user's back.

if (current.status !== expectedRevisionStatus) return false
if (revisions.slice(0, -1).some((revision) => revision.status === 'active')) return false

// 运行中/已中断保留唯一当前步骤;终态不得继续挂着 active 步骤。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: the terminal-state check only looks for active steps. A completed run can still contain failed steps and pass validation, so corrupted or partially failed history can be hydrated/saved as if it were valid.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 实现 WorkflowController 创作协调与恢复边界(Refs #37)

1 participant