Skip to content

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

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

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

Conversation

@xyh202131

@xyh202131 xyh202131 commented Aug 4, 2026

Copy link
Copy Markdown

变更说明

实现页面与 WorkflowRun Entity 之间的 WorkflowController 协调层。页面只发送创作命令并接收可渲染阶段,WorkflowRun 继续负责状态迁移、GenerationTask 恢复、Revision 重做与动作写回。

本 PR 包含

  • 创建“角色 + 首个动作”Run,以及为已有角色追加动作的 Run。
  • 协调四张角色候选、四张动作首帧候选、完整动画审核与动作发布。
  • 根据当前 Revision、活动卡片和 phase 恢复页面状态。
  • 合并同一个 Run 的并发加载与 resume() 请求。
  • 在一个 Controller 生命周期内复用同一个绑定 Run,使生成中的中断能作用于正在等待结果的实例。
  • 保存配置动作、中断、继续和节点重做后的检查点。

边界说明

验证

  • Controller 定向测试:8 项通过
  • 前端全量测试:60 项通过
  • TypeScript:通过
  • Lint:通过
  • 生产构建:通过
  • Controller 定向格式检查:通过
  • git diff --check:通过

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 6, 2026 10:32am

@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