-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
workflowGitHub ActionsGitHub Actions
Description
Task
Context
{
"repo": "WhiteElephant-abc/agent",
"event_type": "pullrequest",
"event_id": "22364883024",
"trigger_user": "WhiteElephant-abc",
"issue_number": 149,
"pr_title": "fix: 修复 review comment 提及无法正确响应的问题",
"pr_body": "## 问题描述\n\nIssue #136 报告了机器人没有正确响应 review comment 中的提及,仅响应 review 本身中的提及。\n\n## 问题原因分析\n\n经过深入分析,我发现根本原因是:\n\n当 GitHub 发送 review comment 的通知时,`latest_comment_url` 指向的是 **review 本身** 而不是 **review comment**。但是:\n\n1. **之前的修复(PR #138)** 只处理了当通过 ID 匹配到 review 但 review body 为空的情况,会继续搜索其他包含 `@` 的节点\n\n2. **但是还有一个隐藏问题**:如果 review 本身因为 body 为空而**没有被添加到 timeline 中**,那么 `find_trigger_node` 通过 ID 匹配时根本找不到任何节点,也就无法执行回退搜索!\n\n## 修复方案\n\n修改 `extract_pr_timeline_items` 函数,**即使 review body 为空也将其添加到 timeline 中**。\n\n这样当 `latest_comment_url` 指向 review 时:\n1. `find_trigger_node` 能够通过 ID 匹配到 review\n2. 发现 review 的 body 不包含 `@WhiteElephantIsNotARobot`\n3. 执行 `break` 退出精确匹配循环\n4. 继续执行逆序搜索,找到 review comment 中的 `@` 提及\n\n## 变更内容\n\n- 修改 `extract_pr_timeline_items` 函数中处理 reviews 的逻辑\n- 移除 `if r.get(\"body\"):` 条件判断,确保所有 reviews 都被添加到 timeline\n- 添加详细注释说明原因\n\n## 测试建议\n\n1. 在 PR review comment 中提及 `@WhiteElephantIsNotARobot`\n2. 验证机器人能够正确响应 review comment 中的提及\n3. 确保原有的 review 本身提及功能仍然正常工作\n\nFixes #136\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)",
"review_comments_batch": [
{
"id": "PRRC_kwDORAzJJ86j2GGN",
"user": "WhiteElephant-abc",
"body": "@WhiteElephantIsNotARobot ",
"path": "server.py",
"diff_hunk": "@@ -213,20 +213,18 @@ def extract_pr_timeline_items(resource_data: Dict) -> List[TimelineItem]:\n # 2. 审核\n reviews = resource_data.get(\"reviews\", {}).get(\"nodes\", [])\n for r in reviews:\n- if r.get(\"body\"):\n- # GraphQL返回的是submittedAt(驼峰命名),不是submitted_at(下划线命名)\n- # 优先使用submittedAt,如果没有则使用createdAt"
}
],
"diff_url": "https://api.github.com/repos/WhiteElephant-abc/agent/pulls/149.diff",
"clone_url": "[email protected]:WhiteElephantIsNotARobot/agent.git",
"head_ref": "fix/review-comment-mention-v4",
"base_ref": "main",
"head_repo": "WhiteElephantIsNotARobot/agent:fix/review-comment-mention-v4",
"base_repo": "WhiteElephant-abc/agent:main",
"current_comment_id": "PRRC_kwDORAzJJ86j2GGN",
"current_review_id": "PRR_kwDORAzJJ87ealKb",
"is_mention_in_body": true,
"is_truncated": false
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
workflowGitHub ActionsGitHub Actions