Skip to content

fix: Plan 缓存键增加 task 描述校验 (Issue #5)#22

Merged
urika merged 1 commit into
mainfrom
fix/issue-5-cache-key
May 29, 2026
Merged

fix: Plan 缓存键增加 task 描述校验 (Issue #5)#22
urika merged 1 commit into
mainfrom
fix/issue-5-cache-key

Conversation

@urika

@urika urika commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

修复 Issue #5: Plan 缓存键增加冲突处理

修复

  • load_cached_plan 增加 task 描述校验
  • 缓存键碰撞时验证 task 描述是否完全匹配
  • 不匹配时跳过缓存并记录 warning

测试

  • pytest tests/ -q (163 passed)

Checklist

  • 测试通过
  • task 校验已添加

load_cached_plan 增加 task 校验,避免缓存键碰撞导致的不匹配

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@urika

urika commented May 29, 2026

Copy link
Copy Markdown
Owner Author

Code Review — PR #22: Plan 缓存键增加 task 描述校验

🟡 Major

1. 与 PR #23 的 api.py 修改完全重复

PR #23 (fix/issue-6-ci-config) 包含了对 agent_go/api.py 完全相同的修改(添加 task 参数 + cached_task != task[:200] 校验)。两个 PR 合并时会产生冲突。

建议: 两个 PR 只需保留一个修复 Issue #5 的版本。本 PR (#22) 更聚焦于单一 Issue,推荐保留本 PR 并让 PR #23 移除 api.py 的修改部分。

🟢 Minor

  1. cached_task != task[:200] 截断比较逻辑是安全的 — save_cached_plan 也存储 task[:200],所以两边截断一致。但存在理论上的边界情况:两个前 200 字符相同但后续不同的 task 会绕过校验。由于 SHA256 cache key 本身已包含完整 task 字符串,实际碰撞概率极低,可接受。

总结: 代码修改本身正确,建议保留本 PR 修复 Issue #5,PR #23 移除重复的 api.py 修改。

@urika

urika commented May 29, 2026

Copy link
Copy Markdown
Owner Author

📝 重复 PR 说明: PR #23 (fix/issue-6-ci-config) 已关闭。PR #23 中对 api.py 的修改与本 PR 完全重复,Issue #5 的修复以本 PR (#22) 为准。Issue #6 (CI 配置) 部分由 PR #24 继续负责。

@urika urika merged commit 6db873f into main May 29, 2026
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.

1 participant