Skip to content

fix: add merge-commit guard and diagnostic warnings to get_pr_commit_messages()#189

Closed
Copilot wants to merge 3 commits intobugfix/issue-184from
copilot/sub-pr-188
Closed

fix: add merge-commit guard and diagnostic warnings to get_pr_commit_messages()#189
Copilot wants to merge 3 commits intobugfix/issue-184from
copilot/sub-pr-188

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

get_pr_commit_messages() used a bare except Exception: pass, silently swallowing all failures from git log HEAD^1..HEAD^2 — including cases where HEAD isn't a merge commit (shallow fetch, non-merge checkout), making failures completely invisible.

Changes

  • Merge-commit guard: runs git rev-parse --verify HEAD^2 before the range query; emits a ::warning:: annotation with stderr details and returns early if HEAD lacks a second parent
  • git log failure logging: logs result.stderr as a ::warning:: annotation when the command exits non-zero, instead of silently falling through
  • Exception logging: both except Exception blocks now emit ::warning:: annotations rather than silently passing
# Before
try:
    result = subprocess.run(["git", "log", ...], check=False)
    if result.returncode == 0 and result.stdout:
        return [...]
except Exception:
    pass          # ← silent, no diagnostic output
return []

# After
# 1. Guard: verify HEAD^2 exists and warn if not
# 2. Run git log; warn with stderr on non-zero exit
# 3. Catch/log any subprocess exception

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI and others added 2 commits March 16, 2026 22:58
…heck and warning logs

Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on PR commit message retrieval and validation implementation fix: add merge-commit guard and diagnostic warnings to get_pr_commit_messages() Mar 16, 2026
Copilot AI requested a review from shenxianpeng March 16, 2026 22:59
@shenxianpeng shenxianpeng marked this pull request as ready for review March 16, 2026 23:28
@shenxianpeng shenxianpeng requested a review from a team as a code owner March 16, 2026 23:29
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.

2 participants