Skip to content

fix(ci): make gate PR dedup work for open PRs - #823

Merged
nekomoto911 merged 1 commit into
Galxe:mainfrom
nekomoto911:fix/ci-gate-open-pr-dedup
Aug 20, 2026
Merged

nekomoto911 merged 1 commit into
Galxe:mainfrom
nekomoto911:fix/ci-gate-open-pr-dedup

Conversation

@nekomoto911

Copy link
Copy Markdown
Contributor

Summary

  • Gate PR-wide dedup (belongs_to_pr) used GET /commits/{sha}/pulls, which returns [] for commits that only exist on open PRs.
  • That made every re-approve after the first successful run treat the PR as "never passed" and re-run E2E/UT (seen on feat(consensus): add batched forward epoch sync #819 after merge-from-main + re-approve).
  • Switch the membership check to GET /pulls/{n}/commits (paginated), which correctly lists open-PR commits and still rejects SHAs from a reused branch name / foreign PR.

Test plan

belongs_to_pr used commits/{sha}/pulls, which returns [] for commits that
only exist on open PRs, so PR-wide dedup never fired and every re-approve
re-ran E2E/UT. Check pulls/{n}/commits instead.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6919def461

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +60 to +62
PR_COMMIT_SHAS=$(gh api \
"repos/${REPO}/pulls/${PR_NUMBER}/commits?per_page=100" \
--paginate --jq '.[].sha' 2>/dev/null || true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle pull requests with more than 250 commits

For a PR with more than 250 commits, a candidate workflow run can have a head_sha omitted from PR_COMMIT_SHAS: GitHub's List commits on a pull request endpoint explicitly caps the result at 250 commits, so --paginate cannot retrieve the remainder. In the e2e-docker.yml approval → gate.yml duplicate-check path, belongs_to_pr then rejects that run and expensive E2E jobs can execute again despite an in-progress or successful run. This can be validated on a >250-commit PR by comparing the candidate run's head_sha with gh api "repos/$REPO/pulls/$PR/commits?per_page=100" --paginate --jq '.[].sha'; use an uncapped membership mechanism for omitted commits.

AGENTS.md reference: AGENTS.md:L12-L12

Useful? React with 👍 / 👎.

@nekomoto911
nekomoto911 merged commit eae3527 into Galxe:main Aug 20, 2026
12 checks passed
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