已生成资源/资产的持久化与画布完成操作不具备原子性,也不具备请求幂等性。 #134

Closed
opened 2026-08-04 20:03:10 +08:00 by k88936 · 2 comments
Member

范围:

  • 这是编辑器-生成共享架构的问题,并非角色动作特有。
  • 图片、视频、音效、背景音乐及角色动作流程均先持久化生成的项目资源/账户资产,再于独立的 SpacetimeDB 事务中调用 complete_editor_canvas_generation_with_items

现有防护:

  • 画布完成时读取最新画布并通过版本 CAS 保存。
  • 若同一 resourceId 已存在,完成操作会抑制重复放置。
  • 已完成的生成对话框可防止后续过期的布局保存覆盖。

缺失防护:

  • taskId 仅为元数据且属于确定性图层 ID 的一部分,并非唯一持久化键,也未用于查找或复用已生成的资源/资产。
  • 每次持久化尝试都会重新生成资源 ID 和资产 ID。
  • 若资源/资产创建成功但画布完成失败,先前记录不会回滚。
  • 重试 HTTP 生成请求会产生新的服务端任务 ID,导致现有的资源级去重检查无法使整个操作具备幂等性。

所需架构决策:

  • 优先采用单个 SpacetimeDB 事务,利用持久化生成作业提供的稳定操作键,幂等地 upsert 最终生成的资源/资产并完成画布。
  • 若外部生成工作流无法调用单一事务,则增加以所有者/项目/操作 ID 为键的持久化完成记录,确保资源创建、资产创建和画布完成在添加清理补偿逻辑前各自具备重放安全性。
  • 禁止添加仅针对角色动作的清理逻辑或 taskId 兜底方案;修复必须覆盖所有编辑器生成类型,并保留版本冲突处理机制。

所需测试:

  • 资源创建后、资产创建前发生故障。
  • 资源/资产创建后、画布完成前发生故障。
  • 发生版本冲突后,使用相同操作 ID 进行重试。
  • 成功后重复执行完成操作,应返回原始资源/资产/图层且不产生重复项。
  • 进程重启后重试,应保持相同的操作标识。
范围: - 这是编辑器-生成共享架构的问题,并非角色动作特有。 - 图片、视频、音效、背景音乐及角色动作流程均先持久化生成的项目资源/账户资产,再于独立的 SpacetimeDB 事务中调用 `complete_editor_canvas_generation_with_items`。 现有防护: - 画布完成时读取最新画布并通过版本 CAS 保存。 - 若同一 `resourceId` 已存在,完成操作会抑制重复放置。 - 已完成的生成对话框可防止后续过期的布局保存覆盖。 缺失防护: - `taskId` 仅为元数据且属于确定性图层 ID 的一部分,并非唯一持久化键,也未用于查找或复用已生成的资源/资产。 - 每次持久化尝试都会重新生成资源 ID 和资产 ID。 - 若资源/资产创建成功但画布完成失败,先前记录不会回滚。 - 重试 HTTP 生成请求会产生新的服务端任务 ID,导致现有的资源级去重检查无法使整个操作具备幂等性。 所需架构决策: - 优先采用单个 SpacetimeDB 事务,利用持久化生成作业提供的稳定操作键,幂等地 upsert 最终生成的资源/资产并完成画布。 - 若外部生成工作流无法调用单一事务,则增加以所有者/项目/操作 ID 为键的持久化完成记录,确保资源创建、资产创建和画布完成在添加清理补偿逻辑前各自具备重放安全性。 - 禁止添加仅针对角色动作的清理逻辑或 taskId 兜底方案;修复必须覆盖所有编辑器生成类型,并保留版本冲突处理机制。 所需测试: - 资源创建后、资产创建前发生故障。 - 资源/资产创建后、画布完成前发生故障。 - 发生版本冲突后,使用相同操作 ID 进行重试。 - 成功后重复执行完成操作,应返回原始资源/资产/图层且不产生重复项。 - 进程重启后重试,应保持相同的操作标识。
k88936 added this to the 美术画布 project 2026-08-04 20:03:10 +08:00
Author
Member

plan: 默认采用“全部 provider 生成作业化”,包括开发用 inline 模式。 ...

Q: ??? inline 仅同步领取并等待同一 job , this is fucking crazy ,,,, in what cases does inline was called ???

A: You’re right. Turning inline into “enqueue, claim, and wait” was an unjustified expansion and defeats the purpose of that diagnostic path. I’m checking every actual branch now so I can state precisely where inline is used and revise the plan around the real scope.

• Confirmed: inline here is only the explicit GENARRATIVE_EXTERNAL_GENERATION_MODE=inline diagnostic mode. It directly executes eight provider-backed handlers inside the HTTP request—image generation/edit, icon/UI extraction, character animation, video, sound effect,
and background music. It creates no job and has no lease. Production/default configs are queue; background removal and External v1 already always queue.

Perfect pixel and manual atlas splitting are also synchronous, but they do not consult this mode flag; I incorrectly conflated those with configured provider inline. The revised plan will preserve direct inline execution and will not enqueue/claim/wait.

plan: 默认采用“全部 provider 生成作业化”,包括开发用 inline 模式。 ... Q: ??? inline 仅同步领取并等待同一 job , this is fucking crazy ,,,, in what cases does inline was called ??? A: You’re right. Turning inline into “enqueue, claim, and wait” was an unjustified expansion and defeats the purpose of that diagnostic path. I’m checking every actual branch now so I can state precisely where inline is used and revise the plan around the real scope. • Confirmed: inline here is only the explicit GENARRATIVE_EXTERNAL_GENERATION_MODE=inline diagnostic mode. It directly executes eight provider-backed handlers inside the HTTP request—image generation/edit, icon/UI extraction, character animation, video, sound effect, and background music. It creates no job and has no lease. Production/default configs are queue; background removal and External v1 already always queue. Perfect pixel and manual atlas splitting are also synchronous, but they do not consult this mode flag; I incorrectly conflated those with configured provider inline. The revised plan will preserve direct inline execution and will not enqueue/claim/wait.
Member

已经由 6c53eda71c 修复

已经由 6c53eda71c487526a8b421fa881ce2faa8c572b6 修复
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GenarrativeAI/Genarrative#134