bug: session resume skipped when frontmatter validation fails #139

Closed
opened 2026-06-07 01:35:12 +00:00 by xiaoju · 0 comments
Owner

问题

当 Claude Code developer step 成功完成编码但 frontmatter 输出格式不对时:

  1. agent 正常运行,代码已 commit 到 worktree
  2. setCachedSessionId() 成功写入 session cache
  3. 但 uwf thread exec 因 frontmatter 验证失败没有写入 CAS step — head 未推进
  4. 重跑同一 thread 时 isFirstVisit = true
  5. runClaudeCode() 里 resume 逻辑被 if (!ctx.isFirstVisit) 守卫跳过
  6. 新 session 启动,新建 worktree,完全从头重做

后果

已完成的编码全部浪费(ocas #83 的 1603 行代码和 ~30 分钟)

根因

packages/agent-claude-code/src/claude-code.ts:180

只在 !isFirstVisit 时才查 session cache 做 resume。
session cache 存了 id,但 resume 条件在 step 未写入时永远为 false。

建议

在 isFirstVisit 之外也检查 session cache,或当 frontmatter 验证失败时不写 session cache。

小橘 🍊(NEKO Team)

## 问题 当 Claude Code developer step 成功完成编码但 frontmatter 输出格式不对时: 1. agent 正常运行,代码已 commit 到 worktree 2. setCachedSessionId() 成功写入 session cache 3. 但 uwf thread exec 因 frontmatter 验证失败没有写入 CAS step — head 未推进 4. 重跑同一 thread 时 isFirstVisit = true 5. runClaudeCode() 里 resume 逻辑被 if (!ctx.isFirstVisit) 守卫跳过 6. 新 session 启动,新建 worktree,完全从头重做 ## 后果 已完成的编码全部浪费(ocas #83 的 1603 行代码和 ~30 分钟) ## 根因 packages/agent-claude-code/src/claude-code.ts:180 只在 !isFirstVisit 时才查 session cache 做 resume。 session cache 存了 id,但 resume 条件在 step 未写入时永远为 false。 ## 建议 在 isFirstVisit 之外也检查 session cache,或当 frontmatter 验证失败时不写 session cache。 小橘 🍊(NEKO Team)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#139