-
Notifications
You must be signed in to change notification settings - Fork 46.7k
feat: add cross-PR conflict detection to github-code-review skill #38864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -467,6 +467,10 @@ EOF | |
| )" | ||
| ``` | ||
|
|
||
| ### Step 8b: Cross-PR Conflict Check (Optional) | ||
|
|
||
| Run the cross-PR conflict check (see Section 6). | ||
|
|
||
| ### Step 9: Clean up | ||
|
|
||
| ```bash | ||
|
|
@@ -479,3 +483,67 @@ git branch -D pr-$PR_NUMBER | |
| - **Approve** — no critical or warning-level issues, only minor suggestions or all clear | ||
| - **Request Changes** — any critical or warning-level issue that should be fixed before merge | ||
| - **Comment** — observations and suggestions, but nothing blocking (use when you're unsure or the PR is a draft) | ||
|
|
||
| --- | ||
|
|
||
| ## 6. Cross-PR Conflict Analysis (Optional) | ||
|
|
||
| Check whether the current PR modifies functions also changed by other open PRs. | ||
|
|
||
| ### During PR Review — Conflict Check | ||
|
|
||
| After posting your code review (Steps 7-8), run the cross-PR conflict check: | ||
|
|
||
| ```bash | ||
| # Install codegraph if not present | ||
| if ! command -v codegraph &>/dev/null; then | ||
| pip install codegraph-ai | ||
| fi | ||
|
|
||
| # Build index if not present (one-time, takes a few minutes) | ||
| if [ ! -d ".codegraph" ]; then | ||
| codegraph init --repo . --db .codegraph | ||
| # Re-run periodically (e.g. weekly) to keep the index fresh | ||
| codegraph pr-review prepare --db .codegraph --limit 500 | ||
| echo ".codegraph/" >> .gitignore | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mutates the repository under review and leaves a tracked |
||
| fi | ||
|
|
||
| # Ensure this PR is in the index (idempotent — safe to re-run on existing PRs) | ||
| codegraph pr-review update --db .codegraph --pr $PR_NUMBER | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linked upstream guide currently documents only |
||
|
|
||
| # Check for conflicts (dry-run to preview) | ||
| codegraph pr-review label --db .codegraph --pr $PR_NUMBER --comment-only --dry-run | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upstream documents label flags only for |
||
| ``` | ||
|
|
||
| If conflicts are found, post the conflict comment: | ||
|
|
||
| ```bash | ||
| codegraph pr-review label --db .codegraph --pr $PR_NUMBER --comment-only | ||
| ``` | ||
|
|
||
| If no conflicts are found, skip — no comment needed. | ||
|
|
||
| The conflict comment looks like: | ||
|
|
||
| ```markdown | ||
| ### :warning: Cross-PR Conflict Detected | ||
|
|
||
| This PR shares modified code with #37398, #37442, #37966. | ||
|
|
||
| **Shared functions:** | ||
|
|
||
| | Function | File | Also modified by | | ||
| |----------|------|-----------------| | ||
| | `_run_single_child` | `tools/delegate_tool.py` | #37633, #37724 | | ||
| | `delegate_task` | `tools/delegate_tool.py` | #37398, #37442, #37966 | | ||
|
|
||
| **Recommendation:** Coordinate with #37398, #37442, #37633, #37724, #37966 before merging. | ||
| ``` | ||
|
|
||
| ### Troubleshooting | ||
|
|
||
| | Problem | Fix | | ||
| |---------|-----| | ||
| | `Database locked` after interrupted `prepare` | `rm .codegraph/graph.db/neugdb.lock` | | ||
| | `prepare`/`update` fails to fetch PR diffs | Run `gh auth login` first — codegraph uses `gh` CLI for GitHub access | | ||
| | `prepare` seems stuck | Normal — indexing 500 PRs takes a few minutes. Let it finish | | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not install this package into the active environment. The linked codegraph guide requires an isolated virtual environment (
pr-analysis.md:17-23); this skill should make that prerequisite explicit or delegate the external setup to a supporting script.