Fix /pr-comments 404 on PRs opened from forks#13284
Conversation
The pr-comments skill built its GitHub API paths from the head/fork repository (headRepositoryOwner/headRepository), but PR issue, review, and diff comments live on the base repository. For a PR opened from a fork (e.g. th1nkful/warp -> warpdotdev/warp) this made requests like /repos/th1nkful/warp/issues/9850/comments 404. Derive owner/repo from the PR URL instead, which always points at the base repo, so both same-repo and fork PRs resolve correctly. Update the SKILL.md fallback instructions to match and add a regression test. Co-Authored-By: Warp <agent@warp.dev>
|
@warp-dev-github-integration[bot] I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR updates the /pr-comments bundled skill and fetch script so comment API requests resolve the PR's base repository from the PR URL instead of using the head/fork repository. It also updates fallback documentation and adds regression coverage for same-repo, fork, and enterprise-host-style PR URLs.
Concerns
- No blocking correctness, security, or spec-alignment concerns found in the attached diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Description
The
/pr-commentsskill failed with a 404 for PRs opened from a fork. It built its GitHub API paths from the head (fork) repository viagh pr view --json headRepositoryOwner,headRepository, but a PR's issue, review, and diff comments live on the base repository. For a cross-repository PR (e.g.th1nkful/warp→warpdotdev/warp) this produced requests like/repos/th1nkful/warp/issues/9850/comments, which 404 because the fork doesn't own the PR.The fix derives
owner/repofrom the PR'surl(which always points at the base repo, e.g.https://github.com/OWNER/REPO/pull/N), so both same-repo and fork PRs resolve correctly. TheSKILL.mdfallback instructions are updated to match, and a regression test is added.Reported in the factory-client Slack thread.
Linked Issue
N/A — reported via Slack.
ready-to-specorready-to-implement.Testing
This is a Python/markdown change to a bundled skill (no Rust code), so the Rust presubmit and computer-use UI verification don't apply. Validated by:
Unit tests:
python3 -m unittest test_fetch_comments— 23 pass, including a newTestBaseRepoFromUrlregression test covering the fork case (warpdotdev/warp/pull/9850headth1nkful/warp→ basewarpdotdev/warp).End-to-end: ran the fixed
fetch_github_review_comments.pyagainst the reported fork PR Support OSC 8 hyperlinks (GH6393) #9850 (checked out viagh pr checkout 9850). Before:gh api /repos/th1nkful/warp/issues/9850/comments→ 404. After: the script exits 0 and fetches 143 comments from the base repo.I have manually tested my changes (script run end-to-end against the reported PR)
Agent Mode
CHANGELOG-BUG-FIX: Fixed
/pr-commentsreturning a 404 for pull requests opened from a fork.Conversation: https://staging.warp.dev/conversation/8d8e4dad-b68b-48cb-8b28-01b77f320a0f
Run: https://oz.staging.warp.dev/runs/019f1eec-b0e6-7c37-a7e1-3de05213c637
This PR was generated with Oz.