Skip to content

PR Review回复中commit链接格式错误 #293

@CarlJi

Description

@CarlJi

问题描述

在PR Review场景中,codeagent回复评论时会附带新产生的commit链接,但链接格式不正确。

当前行为

生成的commit链接格式:

https://github.com/qiniu/codeagent/pull/290/commit/e38008d4153b2b789b17a4606d08a6cfe52db0f2

期望行为

正确的commit链接格式应该是:

https://github.com/qiniu/codeagent/pull/290/commits/e38008d4153b2b789b17a4606d08a6cfe52db0f2

问题分析

URL中的差异:

  • ❌ 错误:/pull/{pr_number}/commit/{commit_sha}
  • ✅ 正确:/pull/{pr_number}/commits/{commit_sha}

注意 commit vs commits (复数形式)

影响

  • 用户点击commit链接时会跳转到错误的页面
  • 影响用户查看代码变更的体验
  • 可能导致404错误或显示不正确的内容

相关代码位置

需要检查以下可能的文件:

  • internal/modes/tag_handler.go - PR处理逻辑
  • internal/modes/review_handler.go - Review处理逻辑
  • internal/github/client.go - GitHub API交互
  • internal/interaction/progress_comment.go - 进度评论生成

修复建议

查找代码中生成commit链接的位置,将:

// 错误的格式
fmt.Sprintf("https://github.com/%s/pull/%d/commit/%s", repo, prNumber, commitSHA)

// 修改为正确格式
fmt.Sprintf("https://github.com/%s/pull/%d/commits/%s", repo, prNumber, commitSHA)

复现步骤

  1. 在PR中添加review comment
  2. 触发codeagent处理
  3. 查看codeagent回复中的commit链接
  4. 点击链接验证是否正确跳转

优先级

  • 级别: Bug (中等优先级)
  • 影响范围: PR Review功能
  • 用户体验: 影响链接可点击性

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions