无秩序守卫:/generate 可把已失败的 code-prototype 覆写为 completed #162

Closed
opened 2026-08-12 11:26:13 +08:00 by lhk229 · 1 comment
Owner
[B3-set-task-status-issue.md](/attachments/a65dcd7f-2161-41ce-99f5-cf7f696ffda9)
Author
Owner

manifest set_task_status 无秩序守卫:/generate 可把已失败的 code-prototype 覆写为 completed

分支归属:master 既有行为,与 M0(立项策划 Agent)分支无关。在 feat/five_min_design 排查 game-chat manifest 绑定问题时顺带发现,逐字节确认 master 上一致,故单独提出。

事实

改写 manifest task.status 的写入路径有两条,秩序保护不对称:

函数 位置 秩序守卫
set_task_status_if_current apps/ai-game-creator-shell/src-tauri/src/agent/generation/trace.rs:613-637 :先过 should_replace_task_status,按 status_rank 判定是否允许覆盖
set_task_status apps/ai-game-creator-shell/src-tauri/src/project/manifest.rs:580-588 task.status = status 直接覆写

无守卫的那条有实际调用方:record_draft_task_progressmanifest.rs:387-413)把 code-prototype 连同其余九个种子任务一起批量置为 Completed(清单见 manifest.rs:396-407),而该函数由用户可随时触发的 game.generate_draft 命令调用。

因此存在这条时序:某轮 code-prototype 被后端合法判定为 failed → 用户触发一次生成草案 → manifest 里该任务被无条件改写为 Completed,失败判定被抹除。

影响范围(已核实,比初判要窄)

  • game-chat 实时徽标与阶段归档不受影响:两者都走 projectGameChatPrimaryProgress,其中 main.status === 'failed' 会在读 manifest 之前短路返回 failed(apps/ai-game-creator-shell/src/features/agent-runtime/gameChatRuntimeProjection.ts:267-274)。所以这条不会让 game-chat 显示"已完成"。
  • 未核实:完整 16 任务 DAG 视图直接以 manifest 为事实源,该路径是否会因此显示已完成,需要该视图的 owner 确认。
  • manifest 文件本身的数据完整性确定受损(失败记录被静默抹除)。

需要确认的产品意图

record_draft_task_progress 的命名与语义表明"生成草案确实完成了这些设计类种子任务",把它们置为 Completed 可能是有意设计。真正存疑的只有一点:

当目标任务当前是 failed 时,草案生成是否应当把它改写为 completed

如果答案是否,最小修复是让 set_task_status 复用 should_replace_task_status(或在 record_draft_task_progress 侧改调 set_task_status_if_current 的等价物),并补一条回归:failedcode-prototypegame.generate_draft 后不得变为 completed

如果答案是是(草案生成即意味着重置该任务的失败状态),建议在 manifest.rs 就近加注释说明该覆写是有意的,避免后续排查者反复怀疑,并把这条不对称记进 pitfalls。

相关

排查上下文见 docs/project-memory/shared-memory/pitfalls.md 2026-08-12 条(陷阱二):任何给 manifest 补身份字段的方案若只改造 update_manifest_task_status_at,会因这条旁路保留旧身份印记而制造"校验通过"的假象。

# manifest `set_task_status` 无秩序守卫:`/generate` 可把已失败的 code-prototype 覆写为 completed **分支归属**:master 既有行为,与 M0(立项策划 Agent)分支无关。在 `feat/five_min_design` 排查 game-chat manifest 绑定问题时顺带发现,逐字节确认 master 上一致,故单独提出。 ## 事实 改写 manifest `task.status` 的写入路径有两条,秩序保护不对称: | 函数 | 位置 | 秩序守卫 | |---|---|---| | `set_task_status_if_current` | `apps/ai-game-creator-shell/src-tauri/src/agent/generation/trace.rs:613-637` | **有**:先过 `should_replace_task_status`,按 `status_rank` 判定是否允许覆盖 | | `set_task_status` | `apps/ai-game-creator-shell/src-tauri/src/project/manifest.rs:580-588` | **无**:`task.status = status` 直接覆写 | 无守卫的那条有实际调用方:`record_draft_task_progress`(`manifest.rs:387-413`)把 `code-prototype` 连同其余九个种子任务一起批量置为 `Completed`(清单见 `manifest.rs:396-407`),而该函数由用户可随时触发的 `game.generate_draft` 命令调用。 因此存在这条时序:某轮 `code-prototype` 被后端合法判定为 `failed` → 用户触发一次生成草案 → manifest 里该任务被无条件改写为 `Completed`,失败判定被抹除。 ## 影响范围(已核实,比初判要窄) - **game-chat 实时徽标与阶段归档不受影响**:两者都走 `projectGameChatPrimaryProgress`,其中 `main.status === 'failed'` 会在读 manifest 之前短路返回 failed(`apps/ai-game-creator-shell/src/features/agent-runtime/gameChatRuntimeProjection.ts:267-274`)。所以这条**不会**让 game-chat 显示"已完成"。 - **未核实**:完整 16 任务 DAG 视图直接以 manifest 为事实源,该路径是否会因此显示已完成,需要该视图的 owner 确认。 - manifest 文件本身的数据完整性确定受损(失败记录被静默抹除)。 ## 需要确认的产品意图 `record_draft_task_progress` 的命名与语义表明"生成草案确实完成了这些设计类种子任务",把它们置为 Completed 可能是有意设计。真正存疑的只有一点: > 当目标任务当前是 `failed` 时,草案生成是否应当把它改写为 `completed`? 如果答案是否,最小修复是让 `set_task_status` 复用 `should_replace_task_status`(或在 `record_draft_task_progress` 侧改调 `set_task_status_if_current` 的等价物),并补一条回归:`failed` 的 `code-prototype` 经 `game.generate_draft` 后不得变为 `completed`。 如果答案是是(草案生成即意味着重置该任务的失败状态),建议在 `manifest.rs` 就近加注释说明该覆写是有意的,避免后续排查者反复怀疑,并把这条不对称记进 pitfalls。 ## 相关 排查上下文见 `docs/project-memory/shared-memory/pitfalls.md` 2026-08-12 条(陷阱二):任何给 manifest 补身份字段的方案若只改造 `update_manifest_task_status_at`,会因这条旁路保留旧身份印记而制造"校验通过"的假象。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GenarrativeAI/Genarrative#162